[newupgrade] Added macrodef to improve the maintenance of the management of current state in the build.
authorAntonio Moreno <antonio.moreno@openbravo.com>
Wed, 02 Dec 2009 11:34:46 +0100
changeset 5617 e8ba7fe80521
parent 5616 a338adfec049
child 5618 277ab38775ac
[newupgrade] Added macrodef to improve the maintenance of the management of current state in the build.
build.xml
src/build.xml
--- a/build.xml	Tue Dec 01 19:25:38 2009 +0100
+++ b/build.xml	Wed Dec 02 11:34:46 2009 +0100
@@ -196,7 +196,18 @@
       <include name="*/lib/**" />
     </fileset>
   </path>
-
+  
+  <macrodef name="updatesystemstatus">
+     <attribute name="v" default="NOT SET"/>
+     <sequential>
+       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
+                          <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
+                          <transaction> UPDATE ad_system_info SET system_status='@{v}' ;
+                            DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
+       </sql>
+     </sequential>
+  </macrodef>
+  
   <taskdef resource="axis-tasks.properties" classpathref="project.class.path" />
   
   <target name="init" depends="code.rev">
@@ -528,16 +539,9 @@
     <antcall target="db.apply.modules.sampledata" />
   </target>
 
-  <target name="update.generate.entities.status" >
-        <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-                   <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-                   <transaction> UPDATE ad_system_info SET system_status='RB21' ;
-                     DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-        </sql>
-  </target>
   <target name="update.database" depends="init, core.lib, database.lib">
     <ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
-    <antcall target="update.generate.entities.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB21"/>
     <antcall target="generate.entities.quick" />
     <antcall target="db.apply.modules" />
   </target>
@@ -576,8 +580,7 @@
 
   <target name="apply.modules">
     <antcall target="update.database.mod" />
-
-    <antcall target="update.generate.entities.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB21"/>
     <antcall target="generate.entities" />
     
     <antcall inheritall="true" inheritrefs="true" target="apply.module" />
@@ -609,11 +612,7 @@
   </target>
 
   <target name="apply.module">
-    <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-               <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-               <transaction> UPDATE ad_system_info SET system_status='RB31' ;
-                 DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-    </sql>
+    <updatesystemstatus v="RB31"/>
     <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}">
       <arg line="'${base.src}'" />
       <classpath refid="project.class.path" />
--- a/src/build.xml	Tue Dec 01 19:25:38 2009 +0100
+++ b/src/build.xml	Wed Dec 02 11:34:46 2009 +0100
@@ -95,6 +95,16 @@
     <mkdir dir="${build.AD}/org/openbravo/erpCommon/reference" />
     <mkdir dir="${build.docs}" />
   </target>
+  <macrodef name="updatesystemstatus">
+     <attribute name="v" default="NOT SET"/>
+     <sequential>
+       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
+                          <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
+                          <transaction> UPDATE ad_system_info SET system_status='@{v}' ;
+                            DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
+       </sql>
+     </sequential>
+  </macrodef>
 
   <target name="validate.database">
     <taskdef name="validateDatabase" classname="org.openbravo.service.system.SystemValidationTask">
@@ -143,7 +153,7 @@
   </target>
 
   <target name="sqlc" depends="copy.srcClient">
-    <antcall target="update.sqlc.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB42" />
     <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" />
       <classpath refid="project.class.path" />
@@ -157,13 +167,6 @@
     <copy file="${base.src}/log4j.lcf" tofile="${build.AD}/log4j.lcf" />
     <ant dir="${build.AD}" target="buildAD" inheritAll="true" inheritRefs="true" />
   </target>
-  <target name="update.sqlc.status" >
-      	<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-      	  	       <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-      	  	       <transaction> UPDATE ad_system_info SET system_status='RB42' ;
-                     DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-      	</sql>
-  </target>
 
   <target name="copy.srcClient">
     <mkdir dir="${base.client.src}" />
@@ -297,7 +300,7 @@
   </target>
   
   <target name="compileSqlc" depends="sqlc">
-	<antcall target="update.compilesqlc.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB43"/>
     <javac  srcdir="${basedir}:${build.sqlc}/src:${build.sqlc}/srcAD:${base.src.test}:${base.modules}" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
       <classpath refid="project.class.path" />
     </javac>
@@ -308,14 +311,6 @@
   	<antcall target="calculate.version"/>
   </target>
 
-  <target name="update.compilesqlc.status" >
-      	<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-      	  	       <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-      	  	       <transaction> UPDATE ad_system_info SET system_status='RB43';
-                    DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-      	</sql>
-  </target>
-
 	<target name="calculate.version" depends="init">
 	  <condition property="revision.from.file">
 		<and>
@@ -362,24 +357,16 @@
   </target>
 
   <target name="wad" depends="init">
-    <antcall target="update.wad.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB41"/>
     <java classname="org.openbravo.wad.Wad" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}" failonerror="true">
       <arg line="'${base.config}' '${tab}' '${build.AD}/org/openbravo/erpWindows' '${build.AD}/org/openbravo/erpCommon' '${build.sqlc}/src' '${webTab}' '${build.AD}/org/openbravo/erpCommon/ad_actionButton' '${base.design}' '${base.translate.structure}' '${client.web.xml}' '..' '${attach.path}' '${web.url}' '${base.src}' '${complete}' '${module}' 'noquick' '${stopOnWadError}'" />
       <classpath refid="project.class.path" />
     </java>
     <antcall target="postwad" inheritall="true" inheritrefs="true" />
   </target>
-	
-  <target name="update.wad.status" >
-      	<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-      	  	       <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-      	  	       <transaction> UPDATE ad_system_info SET system_status='RB41' ;
-                     DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-      	</sql>
-  </target>
 
   <target name="wad.quick" depends="init">
-    <antcall target="update.wad.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB41"/>
     <java classname="org.openbravo.wad.Wad" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
       <arg line="'${base.config}' '${tab}' '${build.AD}/org/openbravo/erpWindows' '${build.AD}/org/openbravo/erpCommon' '${build.sqlc}/src' '${webTab}' '${build.AD}/org/openbravo/erpCommon/ad_actionButton' '${base.design}' '${base.translate.structure}' '${client.web.xml}' '..' '${attach.path}' '${web.url}' '${base.src}' '${complete}' '${module}' 'quick' '${stopOnWadError}'" />
       <classpath refid="project.class.path" />
@@ -388,7 +375,8 @@
   </target>
 
   <target name="postsrc" depends="postsrc.modules">
-    <antcall target="update.postsrc.status" inheritall="true" inheritrefs="true"/>
+
+    <updatesystemstatus v="RB44"/>
     <copy todir="${build}">
       <fileset dir="${basedir}" includes="**/*.properties" />
     </copy>
@@ -421,13 +409,6 @@
     </copy>
     <antcall target="build.local.context" inheritAll="true" inheritrefs="true" />
   </target>
-  <target name="update.postsrc.status" >
-      	<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-      	  	       <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-      	  	       <transaction> UPDATE ad_system_info SET system_status='RB44' ;
-                     DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-      	</sql>
-  </target>
 
   <target name="postsrc.modules">
     <copy todir="${base.design}/design">
@@ -663,6 +644,7 @@
       <classpath refid="project.class.path" />
     </taskdef>
     <updateWADmd5 obDir="${basedir}/.." />
+    <updatesystemstatus v="RB51"/>
   </target>
 
   <target name="smartbuild.no.new.wad" unless="new.wad">
@@ -745,7 +727,7 @@
   </target>
 
   <target name="copy.files">
-	<antcall target="update.copyfiles.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB45"/>
     <mkdir dir="${jakarta.base}/webapps/${context.name}" />
     <copy todir="${jakarta.base}/webapps/${context.name}" encoding="UTF-8">
       <fileset dir="${base.context}" />
@@ -756,14 +738,6 @@
     </copy>
   </target>
 
-  <target name="update.copyfiles.status" >
-      	<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-      	  	       <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-      	  	       <transaction> UPDATE ad_system_info SET system_status='RB45' ;
-                     DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-      	</sql>
-  </target>
-
   <target name="compile.development" depends="generate.entities, compile, copy.files">
     <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" />
     <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8">
@@ -774,16 +748,9 @@
     <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" />
     <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8">
     </copy>
-	<antcall target="update.finalcompile.status" inheritall="true" inheritrefs="true"/>
+    <updatesystemstatus v="RB51"/>
   </target>
 
-  <target name="update.finalcompile.status" >
-      	<sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
-      	  	       <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
-      	  	       <transaction> UPDATE ad_system_info SET system_status='RB51' ;
-                     DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)</transaction>
-      	</sql>
-  </target>
   <target name="compile.web" depends="build.web.folder">
   </target>