From b7d4b7fe4faa066678983b7ff69a166bbf11886c Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Sun, 28 Jan 2007 18:55:53 +0000
Subject: [PATCH] Add features into our build process that can make use of the SVNKit library to interact with the Subversion workspace.  This includes three components:

---
 opends/build.xml |   83 +++++++++++++++++++++++++++++++++++------
 1 files changed, 70 insertions(+), 13 deletions(-)

diff --git a/opends/build.xml b/opends/build.xml
index 8cd4294..01c1aba 100644
--- a/opends/build.xml
+++ b/opends/build.xml
@@ -22,7 +22,7 @@
  ! CDDL HEADER END
  !
  !
- !      Portions Copyright 2006 Sun Microsystems, Inc.
+ !      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  ! -->
 
 <project name="Directory Server" basedir="." default="package">
@@ -111,6 +111,9 @@
   <!-- Properties for the checkstyle tool.                         -->
   <property name="checkstyle.dir"  location="${ext.dir}/checkstyle" />
 
+  <!-- Properties for the SVNKit tool.                         -->
+  <property name="svnkit.dir"  location="${ext.dir}/svnkit" />
+
   <!-- Properties for Directory Server version information.              -->
   <property name="dynconstants.file"
        location="${src.dir}/org/opends/server/util/DynamicConstants.java" />
@@ -129,7 +132,7 @@
 
 
   <!-- The build target that should be used before committing code. -->
-  <target name="precommit" depends="checkstyle,clean,dsml,javadoc,testwithcoverage"
+  <target name="precommit" depends="checkstyle,clean,copyrightdates,dsml,javadoc,testwithcoverage"
        description="Perform all processing needed before committing code." />
 
 
@@ -152,7 +155,7 @@
 
   <!-- The build target that should be used to build everything. -->
   <target name="all"
-       depends="checkstyle,dsml,javadoc,testallwithcoverage"
+       depends="checkstyle,clean,copyrightdates,dsml,javadoc,testallwithcoverage"
        description="Build using all defined targets." />
 
 
@@ -208,13 +211,34 @@
         <isset property="JVM_VENDOR" />
       </not>
     </condition>
+  </target>
+
+
+
+
+  <!-- Build the DynamicConstants.java file and any of its dependencies. -->
+  <target name="dynamicconstants" depends="init,buildtools">
+    <!-- Get the revision number of the current Subversion workspace -->
+    <taskdef name="getsvnrevision"
+             classname="org.opends.build.tools.GetSubversionRevision">
+      <classpath>
+        <fileset dir="${build.dir}/build-tools">
+          <include name="*.jar" />
+        </fileset>
+        <fileset dir="${svnkit.dir}">
+          <include name="*.jar" />
+        </fileset>
+      </classpath>
+    </taskdef>
+
+    <getsvnrevision property="REVISION_NUMBER" />
 
 
     <!-- Generate the DynamicConstants.java file.
       Be warned that the .stubs file references the following properties
       PRODUCT_NAME, SHORT_NAME, MAJOR_VERSION, MINOR_VERSION, POINT_VERSION,
       VERSION_QUALIFIER, FIX_IDS, timestamp, user.name, java.version,
-      java.vendor, java.vm.version, JVM_VENDOR, DEBUG_BUILD
+      java.vendor, java.vm.version, JVM_VENDOR, DEBUG_BUILD, REVISION_NUMBER
       If you change the name of any of those properties in this build.xml
       you'll need to relfect the same change in the .stubs file
     -->
@@ -230,6 +254,37 @@
 
 
 
+  <!-- Check modified files to see any copyright updates are needed. -->
+  <target name="copyrightdates" depends="buildtools"
+       description="Ensure updated files have the correct copyright year" >
+    <taskdef name="checkcopyrightdates"
+             classname="org.opends.build.tools.CheckCopyrightDates">
+      <classpath>
+        <fileset dir="${build.dir}/build-tools">
+          <include name="*.jar" />
+        </fileset>
+        <fileset dir="${svnkit.dir}">
+          <include name="*.jar" />
+        </fileset>
+      </classpath>
+    </taskdef>
+
+    <checkcopyrightdates>
+      <fileset dir="${src.dir}" includes="**/*.java" />
+      <fileset dir="${quicksetup.src.dir}" includes="**/*.java" />
+      <fileset dir="${statuspanel.src.dir}" includes="**/*.java" />
+      <fileset dir="${unittest.testng.src.dir}" includes="**/*.java" />
+      <fileset dir="${functest.testng.src.dir}" includes="**/*.java" />
+      <fileset dir="${basedir}" includes="**/*.xml" excludes="build/**/*" />
+      <fileset dir="${basedir}" includes="**/*.sh" excludes="build/**/*" />
+      <fileset dir="${basedir}" includes="**/*.bat" excludes="build/**/* " />
+      <fileset dir="${basedir}" includes="**/*.ldif" excludes="build/**/*" />
+    </checkcopyrightdates>
+  </target>
+
+
+
+
   <!-- Ensure that the source code meets basic style requirements. -->
   <target name="checkstyle" description="Perform basic source style checks">
 
@@ -280,13 +335,14 @@
 
 
   <!-- Compile the Directory Server source files. -->
-  <target name="cleancompile" depends="cleaninit,compile,compilequicksetup,compilestatuspanel"
+  <target name="cleancompile"
+       depends="cleaninit,compile,compilequicksetup,compilestatuspanel"
        description="Recompile the Directory Server source files.">
   </target>
 
   <!-- Compile the Directory Server source files. -->
   <target name="compile"
-       depends="init"
+       depends="init,dynamicconstants"
        description="Compile the Directory Server source files.">
 
     <mkdir dir="${classes.dir}" />
@@ -815,12 +871,6 @@
       </not>
     </condition>
 
-    <condition property="test.diff.svnpath" value="">
-      <not>
-        <isset property="test.diff.svnpath" />
-      </not>
-    </condition>
-
     <condition property="test.diff.enabled" value="true">
       <not>
         <isset property="test.diff.disable" />
@@ -846,13 +896,15 @@
         <fileset dir="${emma.dir}">
           <include name="*.jar" />
         </fileset>
+        <fileset dir="${svnkit.dir}">
+          <include name="*.jar" />
+        </fileset>
       </classpath>
     </taskdef>
 
     <coveragediff emmadatapath="${coverage.data.dir}"
                   outputpath="${cvgdiff.report.dir}"
                   diffpath="${test.diff.srcpath}"
-                  svnpath="${test.diff.svnpath}"
                   enabled="${test.diff.enabled}"
                   verbose="${test.diff.verbose}" />
 
@@ -1081,6 +1133,11 @@
         <fileset dir="${emma.dir}">
           <include name="*.jar" />
         </fileset>
+
+        <fileset dir="${svnkit.dir}">
+          <include name="*.jar" />
+        </fileset>
+
         <path refid="run.classpath" />
       </classpath>
     </javac>

--
Gitblit v1.10.0