[DynamicRebuildWindow] Moved ApplyModule to update.database from the compilation. Added pre-compilation subtask to ApplyModule (which compiles just the classes that ApplyModule needs). Corrected warning/error messages and status codes to improve compatibility with old Rebuild Window.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Tue, 01 Jun 2010 18:08:35 +0200
changeset 7539 0911fd2387bb
parent 7538 f39914f14dc8
child 7540 d2fbc4804ace
[DynamicRebuildWindow] Moved ApplyModule to update.database from the compilation. Added pre-compilation subtask to ApplyModule (which compiles just the classes that ApplyModule needs). Corrected warning/error messages and status codes to improve compatibility with old Rebuild Window.
build.xml
src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java
src-core/src/org/openbravo/data/Sqlc.java
src-core/src/org/openbravo/utils/DirFilter.java
src/build.xml
src/org/openbravo/erpCommon/ad_process/buildStructure/buildStructure.xml
src/org/openbravo/erpCommon/modules/ApplyModule.java
src/org/openbravo/erpCommon/modules/ApplyModule_data.xsql
src/org/openbravo/erpCommon/modules/ModuleUtiltiy.java
--- a/build.xml	Tue Jun 01 10:36:57 2010 +0200
+++ b/build.xml	Tue Jun 01 18:08:35 2010 +0200
@@ -323,7 +323,7 @@
   </target>
 
   <target name="buildvalidation" depends="init, core.lib">
-    <updatesystemstatus v="RB10"/> 
+    <updatesystemstatus v="RB11"/> 
     <ant dir="src-util/buildvalidation" target="buildvalidation" inheritAll="true" inheritRefs="true" />
   </target>
   
@@ -335,7 +335,7 @@
     <ant dir="src-util/modulescript" target="compile" inheritAll="true" inheritRefs="true" />
   </target>
 
-  <target name="compile.complete.deploy" depends="compile.complete.development, compile.complete.war, apply.module">
+  <target name="compile.complete.deploy" depends="compile.complete.development, compile.complete.war">
 
     <!-- Calculate wad checksum to enable smartbuild-->
     <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
@@ -348,12 +348,12 @@
   </target>
 
   <target name="compile.complete.development" depends="init" unless="mode.war">
-    <updatesystemstatus v="RB22"/>
+    <updatesystemstatus v="RB43"/>
     <ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
   </target>
 
   <target name="compile.complete.war" depends="init" if="mode.war">
-    <updatesystemstatus v="RB22"/>
+    <updatesystemstatus v="RB43"/>
     <antcall target="compile.complete" />
     <antcall target="war" />
   </target>
@@ -558,6 +558,8 @@
   </target>
 
   <target name="install.source" depends="init, create.database, wad.lib, trl.lib, compile.complete.deploy">
+    <echo message="applying modules" />    
+    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
 
     <antcall target="import.sample.data" />
     <antcall target="load.logoimages" />
@@ -590,14 +592,17 @@
   </target>
 
   <target name="update.database" depends="init, core.lib, database.lib, buildvalidation">
-    <updatesystemstatus v="RB21"/>
+    <updatesystemstatus v="RB12"/>
     <ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
     <antcall target="generate.entities.quick" />
+    <antcall target="apply.module" />
   </target>
 
   <target name="update.database.mod" depends="init, core.lib, database.lib, buildvalidation">
-    <updatesystemstatus v="RB21"/>
+    <updatesystemstatus v="RB12"/>
     <ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />
+    <antcall target="generate.entities.quick" />
+    <antcall target="apply.module" />
   </target>
 
   <target name="create.database.script" depends="init, core.lib">
@@ -638,10 +643,9 @@
       <isfalse value="${apply.modules.complete.compilation.var}" />
     </condition>
 
-    <updatesystemstatus v="RB22"/>
+    <updatesystemstatus v="RB43"/>
     <antcall target="apply.modules.compile"/>
 
-    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
     <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
 
   </target>
@@ -658,9 +662,13 @@
     </taskdef>
     <applyModule userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties"/>
   </target>
-
-  <target name="apply.module">
-    <updatesystemstatus v="RB23"/>
+  
+  <target name="compile.apply.module" depends="init">
+    <ant dir="${base.src}" target="compile.apply.module" inheritAll="true" inheritRefs="true" />
+  </target>
+  
+  <target name="apply.module" depends="compile.apply.module">
+    <updatesystemstatus v="RB31"/>
     <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
       <arg line="'${base.src}'" />
       <classpath refid="project.class.path" />
--- a/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java	Tue Jun 01 10:36:57 2010 +0200
+++ b/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java	Tue Jun 01 18:08:35 2010 +0200
@@ -72,8 +72,7 @@
         System.exit(1);
       }
       if (errors.size() > 0) {
-        log4j
-            .error("The build validation failed. The system hasn't been modified. Fix the problems described in the validation messages (either by uninstalling the affected modules, or by fixing the problems the validation found), and then start the build again.");
+        log4j.error("The build validation failed.");
         printMessage(errors);
         System.exit(1);
       }
--- a/src-core/src/org/openbravo/data/Sqlc.java	Tue Jun 01 10:36:57 2010 +0200
+++ b/src-core/src/org/openbravo/data/Sqlc.java	Tue Jun 01 18:08:35 2010 +0200
@@ -26,7 +26,9 @@
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Enumeration;
+import java.util.List;
 import java.util.Properties;
 import java.util.Stack;
 import java.util.StringTokenizer;
@@ -151,7 +153,14 @@
       strFilter = ".xml";
     else
       strFilter = argv[1];
-    dirFilter = new DirFilter(strFilter);
+    String listOfFiles = System.getProperty("sqlc.listOfFiles", null);
+    if (listOfFiles == null) {
+      dirFilter = new DirFilter(strFilter);
+    } else {
+      List<String> files = new ArrayList<String>();
+      files.addAll(Arrays.asList(listOfFiles.split(",")));
+      dirFilter = new DirFilter(files);
+    }
     log4j.info("directory source: " + dirIni);
     log4j.info("directory destiny: " + dirFin);
     log4j.info("file termination: " + strFilter);
--- a/src-core/src/org/openbravo/utils/DirFilter.java	Tue Jun 01 10:36:57 2010 +0200
+++ b/src-core/src/org/openbravo/utils/DirFilter.java	Tue Jun 01 18:08:35 2010 +0200
@@ -13,22 +13,32 @@
 
 import java.io.File;
 import java.io.FilenameFilter;
+import java.util.List;
 
 public class DirFilter implements FilenameFilter {
   String afn;
+  List<String> files;
 
   public DirFilter(String afn) {
     this.afn = afn;
   }
 
+  public DirFilter(List<String> files) {
+    this.files = files;
+  }
+
   public boolean accept(File dir, String name) {
-    boolean boolReturn;
-    // the name is obtained only to compare it with the filename and not
-    // with all the names in all the path
-    String f = new File(name).getName();
-    // returns true if the filter agrees or if it is a directory
-    boolReturn = f.indexOf(afn, f.length() - afn.length()) != -1
-        || new File(dir, name).isDirectory();
-    return boolReturn;
+    if (files != null) {
+      return (files.contains(name)) || new File(dir, name).isDirectory();
+    } else {
+      boolean boolReturn;
+      // the name is obtained only to compare it with the filename and not
+      // with all the names in all the path
+      String f = new File(name).getName();
+      // returns true if the filter agrees or if it is a directory
+      boolReturn = f.indexOf(afn, f.length() - afn.length()) != -1
+          || new File(dir, name).isDirectory();
+      return boolReturn;
+    }
   }
 }
--- a/src/build.xml	Tue Jun 01 10:36:57 2010 +0200
+++ b/src/build.xml	Tue Jun 01 18:08:35 2010 +0200
@@ -158,6 +158,20 @@
     </delete>
   </target>
 
+  <target name="compile.apply.module" depends="init">
+    <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}">
+      <src path="${base.src}"/>
+      <src path="../build/javasqlc/src"/>
+      <src path="../build/javasqlc/srcAD"/>
+      <classpath refid="project.class.path" />
+    </javac>
+  </target>
+  
   <target name="sqlc" depends="copy.srcClient">
     <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" />
--- a/src/org/openbravo/erpCommon/ad_process/buildStructure/buildStructure.xml	Tue Jun 01 10:36:57 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/buildStructure/buildStructure.xml	Tue Jun 01 18:08:35 2010 +0200
@@ -1,22 +1,22 @@
 <?xml version='1.0' ?>
   <Build>
     <mainSteps>
-      <mainStep code="RB10" errorCode="RB70">
+      <mainStep code="RB11" errorCode="RB70">
         <name>Initial Build Validation</name>
         <successMessage/>
-        <warningMessage>The validation had warnings</warningMessage>
-        <errorMessage>The validation failed</errorMessage>
+        <warningMessage/>
+        <errorMessage>The build validation failed. The system hasn't been modified, and is still stable, but you should fix the problems described in the validation messages below (either by uninstalling the affected modules, or by fixing the problems the validation found), and then start the build again.</errorMessage>
         <stepList/>
       </mainStep>
       <mainStep code="RB20" successCode="RB60" warningCode="RB60" errorCode="RB59">
         <name>Build</name>
         <successMessage>The build was successful</successMessage>
         <warningMessage/>
-        <errorMessage>The build failed</errorMessage>
+        <errorMessage><![CDATA[An error has occurred in the build. For a list of actions to take, go to <a href="http://wiki.openbravo.com/wiki/ERP/2.50/Update_Tips" target="_blank" class="MessageBox_TextLink">this link</a>]]></errorMessage>
         <stepList>
-          <step code="RB21" name="Database update"/>
-          <step code="RB22" name="Compilation"/>
-          <step code="RB23" name="Reference data"/>
+          <step code="RB12" name="Database update"/>
+          <step code="RB31" name="Reference data"/>
+          <step code="RB43" name="Compilation"/>
         </stepList>
       </mainStep>
     </mainSteps>
--- a/src/org/openbravo/erpCommon/modules/ApplyModule.java	Tue Jun 01 10:36:57 2010 +0200
+++ b/src/org/openbravo/erpCommon/modules/ApplyModule.java	Tue Jun 01 18:08:35 2010 +0200
@@ -35,7 +35,6 @@
 import org.openbravo.database.CPStandAlone;
 import org.openbravo.database.ConnectionProvider;
 import org.openbravo.erpCommon.ad_forms.Translation;
-import org.openbravo.erpCommon.reference.ActionButtonData;
 import org.openbravo.erpCommon.reference.PInstanceProcessData;
 import org.openbravo.erpCommon.utility.OBError;
 import org.openbravo.erpCommon.utility.SequenceIdData;
@@ -105,7 +104,7 @@
 
           final VariablesSecureApp vars = new VariablesSecureApp("0", "0", "0");
 
-          ActionButtonData.process179(pool, pinstance);
+          ApplyModuleData.process179(pool, pinstance);
 
           final PInstanceProcessData[] pinstanceData = PInstanceProcessData.select(pool, pinstance);
           final OBError myMessage = Utility.getProcessInstanceMessage(pool, vars, pinstanceData);
--- a/src/org/openbravo/erpCommon/modules/ApplyModule_data.xsql	Tue Jun 01 10:36:57 2010 +0200
+++ b/src/org/openbravo/erpCommon/modules/ApplyModule_data.xsql	Tue Jun 01 18:08:35 2010 +0200
@@ -54,7 +54,13 @@
       ]]></Sql>
     <Parameter name="lang"/>
   </SqlMethod>
-  
-  
-  
+
+  <SqlMethod name="process179" type="callableStatement" return="object" object="ApplyModuleData">
+      <SqlMethodComment>procedure AD_Language_Create</SqlMethodComment>
+      <Sql><![CDATA[
+        CALL AD_Language_Create(?)
+      ]]></Sql>
+      <Parameter name="adPinstanceId"></Parameter>
+   </SqlMethod>
+
 </SqlClass>
--- a/src/org/openbravo/erpCommon/modules/ModuleUtiltiy.java	Tue Jun 01 10:36:57 2010 +0200
+++ b/src/org/openbravo/erpCommon/modules/ModuleUtiltiy.java	Tue Jun 01 18:08:35 2010 +0200
@@ -19,7 +19,6 @@
 
 package org.openbravo.erpCommon.modules;
 
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -196,10 +195,4 @@
     return rt;
   }
 
-  /**
-   * @deprecated use ImportModule.getRemoteModule instead
-   */
-  public static InputStream getRemoteModule(ImportModule im, String moduleVersionID) {
-    return null;
-  }
 }