[DynamicRebuildWindow] Fixed compilation of ApplyModule related tasks so that the newest version of ApplyModule is indeed used.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Thu, 03 Jun 2010 18:42:12 +0200
changeset 7541 fe31293e17a5
parent 7540 a5359c030fbc
child 7542 5ccd207918d2
[DynamicRebuildWindow] Fixed compilation of ApplyModule related tasks so that the newest version of ApplyModule is indeed used.
build.xml
src/build.xml
--- a/build.xml	Thu Jun 03 16:20:34 2010 +0200
+++ b/build.xml	Thu Jun 03 18:42:12 2010 +0200
@@ -76,6 +76,7 @@
   <property name="base.lib" location="lib" />
   <property name="base.modules" location="modules" />
   <property name="build" location="build/classes" />
+  <property name="build.apply.module" location="build.apply/classes" />
   <property name="build.AD" location="srcAD" />
   <property name="build.sqlc" location="build/javasqlc" />
   <property name="build.core.lib" location="src-core/lib" />
@@ -216,6 +217,37 @@
     </dirset>
     <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
   </path>
+
+  <!-- This classpath is needed only for the apply.module task-->
+  <path id="apply.module.classpath">
+    <pathelement path="${build.apply.module}" />
+    <pathelement path="${base.src}" />
+    <fileset dir="${base.lib}">
+      <include name="**/*.jar" />
+    </fileset>
+    <fileset dir="${build.core.lib}">
+      <include name="openbravo-core.jar" />
+    </fileset>
+    <fileset dir="${build.trl.lib}">
+      <include name="openbravo-trl.jar" />
+    </fileset>
+    <fileset dir="${build.wad.lib}">
+      <include name="openbravo-wad.jar" />
+    </fileset>
+    <fileset dir="${base.lib}">
+      <include name="**/*.jar" />
+    </fileset>
+    <fileset dir="${base.db}/lib/">
+      <include name="**/*.jar" />
+    </fileset>
+    <fileset dir="${base.modules}">
+      <include name="*/lib/**" />
+    </fileset>
+    <dirset dir="${base.modules}">
+      <include name="*/build/classes/" />
+    </dirset>
+    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
+  </path>
   
   <macrodef name="updatesystemstatus">
      <attribute name="v" default="NOT SET"/>
@@ -600,7 +632,7 @@
 
   <target name="update.database.mod" depends="init, core.lib, database.lib, buildvalidation">
     <updatesystemstatus v="RB12"/>
-    <ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />
+    <!--<ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />-->
     <antcall target="generate.entities.quick" />
     <antcall target="apply.module" />
   </target>
@@ -668,11 +700,19 @@
     <ant dir="${base.src}" target="compile.apply.module" inheritAll="true" inheritRefs="true" />
   </target>
   
+  <!--
+  This task uses a special classpath.
+  This classpath is equivalent to the normal project.class.path, except for the fact that that the normal build folder
+  is replaced by the apply.module.build folder, in which the ApplyModule task related classes will be compiled.
+  This is done to workaround the fact that the javac task needs to compile all the related classes when upgrading openbravo
+  and if the normal build folder is included, none of them are recompiled by default unless the whole build directory is specified.
+  -->
   <target name="apply.module" depends="compile.apply.module">
     <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
       <arg line="'${base.src}'" />
-      <classpath refid="project.class.path" />
+      <classpath refid="apply.module.classpath" />
     </java>
+   <delete includeEmptyDirs="true"  dir="${build.apply.module}" />
   </target>
   
   <target name="apply.modules.compile" depends="wad.lib">
--- a/src/build.xml	Thu Jun 03 16:20:34 2010 +0200
+++ b/src/build.xml	Thu Jun 03 18:42:12 2010 +0200
@@ -159,16 +159,17 @@
   </target>
 
   <target name="compile.apply.module" depends="init">
+    <mkdir dir="${build.apply.module}" />
     <java classname="org.openbravo.data.Sqlc" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" failonerror="true">
       <arg line="'${base.config}'/Openbravo.properties .xsql . '${build.sqlc}'/src" />
       <jvmarg value="-Dsqlc.listOfFiles=ComboTableQuery_data.xsql,ActionButton_data.xsql,PInstanceProcess_data.xsql,SessionLogin_data.xsql,ApplyModule_data.xsql,TableSQLQuery_data.xsql,DateTime_data.xsql,ComboTableQuery_data.xsql,PrintJR_data.xsql,DocumentNo_data.xsql,WindowAccess_data.xsql,ComboTable_data.xsql,Tab_data.xsql,WindowTree_data.xsql,ErrorTextParser_data.xsql,Utility_data.xsql,MessageBD_data.xsql,LanguageCombo_data.xsql,Translation_data.xsql,Buscador_data.xsql,WindowTabs_data.xsql,Pinstance_data.xsql,ProcessRequest_data.xsql,Trigger_data.xsql,ProcessRun_data.xsql,Process_data.xsql,OrgTree_data.xsql,Seguridad_data.xsql,DefaultOptions_data.xsql,SystemPreferences_data.xsql,DefaultSessionValues_data.xsql,DefaultValues_data.xsql,Attribute_data.xsql,ClassInfo_data.xsql,"/>
       <classpath refid="project.class.path" />
     </java>
-    <javac includes="org/openbravo/erpCommon/modules/ApplyModuleTask.java" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on" verbose="false" nowarn="${friendlyWarnings}">
+    <javac includes="org/openbravo/erpCommon/modules/ApplyModuleTask.java" destdir="${build.apply.module}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on" verbose="false" nowarn="${friendlyWarnings}">
       <src path="${base.src}"/>
       <src path="../build/javasqlc/src"/>
-      <src path="../build/javasqlc/srcAD"/>
-      <classpath refid="project.class.path" />
+      <src path="../src-gen"/>
+      <classpath refid="apply.module.classpath" />
     </javac>
   </target>