From a97619fb15d0f947696f40981a760d5cec435bd9 Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Tue, 27 Apr 2010 14:22:32 +0000
Subject: [PATCH] Fixing build factory to work properly with JDK6u18, MacOS X and NetBeans.

---
 opendj-sdk/opends/build.sh  |    8 ++--
 opendj-sdk/opends/build.xml |   78 ++++++++++++++++++++++++++++++++-------
 opendj-sdk/opends/build.bat |    4 +-
 3 files changed, 70 insertions(+), 20 deletions(-)

diff --git a/opendj-sdk/opends/build.bat b/opendj-sdk/opends/build.bat
index 9160ea6..8f6dc4a 100644
--- a/opendj-sdk/opends/build.bat
+++ b/opendj-sdk/opends/build.bat
@@ -23,7 +23,7 @@
 rem CDDL HEADER END
 rem
 rem
-rem      Copyright 2008-2010 Sun Microsystems, Inc.
+rem      Copyright 2008 Sun Microsystems, Inc.
 
 setlocal
 
@@ -39,7 +39,7 @@
 
 
 :runAnt
-set CLASSPATH=%DIR_HOME%\ext\junit.jar:%DIR_HOME%\ext\xalan-j\xalan.jar:%DIR_HOME%\ext\xalan-j\serializer.jar
+set CLASSPATH=%DIR_HOME%\ext\junit.jar
 
 "%DIR_HOME%\ext\ant\bin\ant" %*
 
diff --git a/opendj-sdk/opends/build.sh b/opendj-sdk/opends/build.sh
index 24ade94..029a2b6 100755
--- a/opendj-sdk/opends/build.sh
+++ b/opendj-sdk/opends/build.sh
@@ -23,7 +23,7 @@
 # CDDL HEADER END
 #
 #
-#      Copyright 2008-2010 Sun Microsystems, Inc.
+#      Copyright 2008 Sun Microsystems, Inc.
 
 
 # Change to the location of this build script.
@@ -45,9 +45,9 @@
 fi
 
 
-# Make sure that the JUnit and Xalan-J JAR files are in the CLASSPATH so that ant will be
-# able to find them.
-CLASSPATH=`pwd`/ext/junit.jar:`pwd`/ext/xalan-j/xalan.jar:`pwd`/ext/xalan-j/serializer.jar
+# Make sure that the JUnit JAR file is in the CLASSPATH so that ant will be
+# able to find it.
+CLASSPATH=`pwd`/ext/junit.jar
 export CLASSPATH
 
 
diff --git a/opendj-sdk/opends/build.xml b/opendj-sdk/opends/build.xml
index bf109aa..dcd4f45 100644
--- a/opendj-sdk/opends/build.xml
+++ b/opendj-sdk/opends/build.xml
@@ -91,12 +91,12 @@
   <property name="guitools.src.dir" location="src/guitools"       />
 
   <!-- Properties for coverage diff reports                        -->
-  <property name="cvgdiff.dir" location="build/diff"                />
+  <property name="cvgdiff.dir" location="${build.dir}/diff"                />
   <property name="cvgdiff.report.dir"
             location="${cvgdiff.dir}/report"                        />
 
   <!-- Properties for code coverage testing.                            -->
-  <property name="coverage.dir"         location="build/coverage"            />
+  <property name="coverage.dir"         location="${build.dir}/coverage"            />
   <property name="coverage.report.dir"
             location="${coverage.dir}/reports/unit"                          />
   <property name="coverage.instr.dir"
@@ -150,6 +150,7 @@
 
   <!-- Properties for L10n for generating messages. -->
   <property name="msgl10n.prop.dir"  location="src/admin/messages/" />
+  <property name="msgl10n.diff.dir"  location="${build.dir}/l10nmsg/" />
 
 
   <!-- Properties for SNMP extension. -->
@@ -185,16 +186,15 @@
        description="Build a Directory Server package bundle with DSML.">
   </target>
 
-
-
-
-  <!-- The build target that should be used before committing code. -->
-  <target name="precommit" depends="clean,dynamicconstants,checkstyle,checkprecommit,dsml,testwithcoverage"
-       description="Perform all processing needed before committing code.">
+  <target name="initPrecommit">
+    <property name="isPrecommit" value="true"/>
   </target>
 
-
-
+  <!-- The build target that should be used before committing code. -->
+  <target name="precommit" depends="initPrecommit,clean,dynamicconstants,
+       checkstyle,checkprecommit,dsml,testwithcoverage"
+       description="Perform all processing needed before committing code.">
+  </target>
 
   <!-- The build target that should be used for nightly builds. -->
   <target name="nightly"
@@ -377,6 +377,7 @@
           message="Java version ${min.java.version} or later is required to build ${SHORT_NAME}."/>
   </target>
 
+
   <!-- Perform common initialization common to several targets. -->
   <target name="init">
 
@@ -724,11 +725,38 @@
   <!-- copy the l10n message properties files (for generated messages)-->
   <target name="copyl10nmessages">
     <copy todir="${build.dir}/classes/admin/messages/org/opends/server/admin/std/meta/">
-    <fileset dir="${msgl10n.prop.dir}" includes="*_fr.properties,*_de.properties,*_es.properties,*_ja.properties,*_ko.properties,*_zh_CN.properties,*_zh_TW.properties,*_pl.properties,*_ca_ES.properties">
-    </fileset>
+      <fileset dir="${msgl10n.prop.dir}" includes="*_fr.properties,*_de.properties,
+        *_es.properties,*_ja.properties,*_ko.properties,*_zh_CN.properties,
+        *_zh_TW.properties,*_pl.properties,*_ca_ES.properties">
+      </fileset>
     </copy>
-  </target>
 
+    <!-- check if the english generated files are different from the ones -->
+    <!-- used for localization and copy the files that are different to a -->
+    <!-- directory named diff -->
+    <mkdir dir="${msgl10n.diff.dir}/diff"/>
+    <copy todir="${msgl10n.diff.dir}/diff" verbose="true">
+      <fileset dir="${build.dir}/classes/admin/messages/org/opends/server/admin/std/meta/"
+        excludes="*_fr.properties,*_de.properties,*_es.properties,*_ja.properties,
+        *_ko.properties,*_zh_CN.properties,*_zh_TW.properties,*_pl.properties,
+        *_ca_ES.properties">
+        <different targetdir="${msgl10n.prop.dir}" ignoreFileTimes="true" />
+      </fileset>
+    </copy>
+
+    <fileset id="fs" dir="${msgl10n.diff.dir}/diff"/>
+    <condition property="dir_empty">
+      <length length="0">
+        <fileset refid="fs"/>
+      </length>
+    </condition>
+
+    <fail unless="dir_empty" if="isPrecommit"
+      message="Generated admin message properties files differ from existing files :
+ Copy all files from ${msgl10n.diff.dir}/diff to ${msgl10n.prop.dir}
+ and include them for commit to resolve.">
+    </fail>
+  </target>
 
   <!--
    ! Rebuild the Directory Server without destroying any existing configuration
@@ -2094,6 +2122,7 @@
       <jvmarg  value="-Demma.coverage.out.file=${coverage.data.dir}/unit.emma" />
       <jvmarg value="-Demma.coverage.out.merge=false" />
       <jvmarg value="-Dorg.opends.server.BuildRoot=${basedir}" />
+      <jvmarg value="-Dorg.opends.server.BuildDir=${build.dir}" />
       <jvmarg value="-Dorg.opends.server.RunningUnitTests=true" />
       <jvmarg value="-Dorg.opends.server.snmp.opendmk=${opendmk.lib.dir}"/>
       <jvmarg value="-Dorg.opends.test.suppressOutput=${org.opends.test.suppressOutput}" />
@@ -2239,26 +2268,38 @@
     <exec executable="${ant.home}/bin/${antcmd}" failonerror="true">
       <arg value="-buildfile" />
       <arg value="${ant.file}" />
+      <arg value="-Dbuild.dir=${build.dir}" />
       <arg value="-quiet" />
       <arg value="-Dexclude.ndb.xml=${exclude.ndb.xml}" />
       <arg value="compileadminsubtask" />
       <env key="ANT_OPTS" value="-Xmx${MEM}" />
+      <!-- Set classpath to workaround Apple JDK Xalan conflict -->
+      <env key="CLASSPATH" value="${ext.dir}/xalan-j/xalan.jar" />
     </exec>
   </target>
 
 
 
   <target name="compileadminsubtask">
+    <!-- Xalan-J Class Path : refer to it explicitly from each XSLT task. -->
+    <path id="xalan.class.path">
+      <fileset dir="${ext.dir}/xalan-j">
+        <include name="*.jar" />
+      </fileset>
+    </path>
+
     <!-- Generate introspection API for core administration components. -->
     <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/*Configuration.xml"
           excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/metaMO.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.java" />
       <param name="base-dir" expression="${admin.defn.dir}" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/meta/package-info.java" />
       <param name="type" expression="meta" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <!-- Generate client API for core administration components. -->
@@ -2266,11 +2307,13 @@
           excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/clientMO.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/client/\2CfgClient.java" />
       <param name="base-dir" expression="${admin.defn.dir}" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/client/package-info.java" />
       <param name="type" expression="client" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <!-- Generate server API for core administration components. -->
@@ -2278,11 +2321,13 @@
           excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/serverMO.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/server/\2Cfg.java" />
       <param name="base-dir" expression="${admin.defn.dir}" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <xslt basedir="${admin.defn.dir}" destdir="${admin.src.dir}" includes="**/Package.xml" style="${admin.rules.dir}/package-info.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)\.xml$$" to="\1/server/package-info.java" />
       <param name="type" expression="server" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <!-- Generate LDAP profile for core administration components. -->
@@ -2291,6 +2336,7 @@
           excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/ldapMOProfile.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
       <param name="base-dir" expression="${admin.defn.dir}" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <!-- Generate CLI profile for core administration components. -->
@@ -2298,6 +2344,7 @@
           excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/cliMOProfile.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
       <param name="base-dir" expression="${admin.defn.dir}" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <!-- Generate I18N messages for core administration components. -->
@@ -2305,13 +2352,16 @@
           excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/messagesMO.xsl">
       <regexpmapper handledirsep="true" from="^(.*)/([^/]+)Configuration\.xml$$" to="\1/meta/\2CfgDefn.properties" />
       <param name="base-dir" expression="${admin.defn.dir}" />
+      <classpath refid="xalan.class.path" />
     </xslt>
 
     <!-- Generate manifest file for core administration components. -->
     <tempfile property="admin.temp.dir" destDir="${build.dir}" prefix="tmp" />
     <mkdir dir="${admin.temp.dir}" />
     <xslt basedir="${admin.defn.dir}" destdir="${admin.temp.dir}" extension=".manifest" includes="**/*Configuration.xml"
-          excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/manifestMO.xsl"/>
+          excludes="${exclude.ndb.xml}" style="${admin.rules.dir}/manifestMO.xsl">
+      <classpath refid="xalan.class.path" />
+    </xslt>
     <concat destfile="${classes.dir}/admin/core.manifest">
       <fileset dir="${admin.temp.dir}" includes="**/*.manifest" />
     </concat>

--
Gitblit v1.10.0