[validation]
authorStefan Hühner <stefan.huehner@openbravo.com>
Tue, 30 Mar 2010 20:05:29 +0200
changeset 6902 d8e5536b1186
parent 6901 43a7191bdeb6
child 6903 ffc2d0f3cec7
[validation]
- fix execution of build validations
- log.info each executed build validation
- log exception or validation + scripts if happened
- log.info each executed module script
- simplify and fix indentation in build.xml
src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java
src-core/src/org/openbravo/modulescript/ModuleScriptHandler.java
src-util/buildvalidation/build.xml
src-util/diagnostic/.classpath
src-util/diagnostic/.project
src-util/diagnostic/.settings/.jsdtscope
src-util/diagnostic/.settings/org.eclipse.jdt.core.prefs
src-util/diagnostic/.settings/org.eclipse.jst.common.project.facet.core.prefs
src-util/diagnostic/.settings/org.eclipse.wst.common.component
src-util/diagnostic/.settings/org.eclipse.wst.common.project.facet.core.xml
src-util/diagnostic/.settings/org.eclipse.wst.jsdt.ui.superType.container
src-util/diagnostic/.settings/org.eclipse.wst.jsdt.ui.superType.name
src-util/diagnostic/WebContent/META-INF/MANIFEST.MF
src-util/diagnostic/WebContent/WEB-INF/web.xml
src-util/diagnostic/build-create.xml
src-util/diagnostic/build.xml
src-util/diagnostic/build/.keep
src-util/diagnostic/check-ob-perms.sh
src-util/diagnostic/config/diagnostics.properties
src-util/diagnostic/config/log4j.properties
src-util/diagnostic/src/Test.java
src-util/diagnostic/src/org/openbravo/check/Check.java
src-util/diagnostic/src/org/openbravo/task/CheckDB.java
src-util/diagnostic/src/org/openbravo/task/CheckEnvironmentVariables.java
src-util/diagnostic/src/org/openbravo/task/CheckJVMVersion.java
src-util/diagnostic/src/org/openbravo/task/CheckMemory.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatAntExecution.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatFilePermissions.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatMemory.java
src-util/diagnostic/src/org/openbravo/task/CheckTomcatVersion.java
src-util/diagnostic/src/org/openbravo/task/CheckX.java
src-util/diagnostic/src/org/openbravo/task/CompareVersion.java
src-util/diagnostic/src/org/openbravo/utils/PropertiesManager.java
src-util/diagnostic/src/org/openbravo/utils/ServerConnection.java
src-util/diagnostic/src/org/openbravo/utils/Version.java
src-util/modulescript/build.xml
--- a/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java	Tue Mar 30 19:20:38 2010 +0200
+++ b/src-core/src/org/openbravo/buildvalidation/BuildValidationHandler.java	Tue Mar 30 20:05:29 2010 +0200
@@ -5,10 +5,12 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 
 public class BuildValidationHandler extends Task {
+  private static final Logger log4j = Logger.getLogger(BuildValidationHandler.class);
 
   private File basedir;
   private String module;
@@ -42,15 +44,17 @@
       try {
         Class<?> myClass = Class.forName(s);
         if (myClass.getGenericSuperclass().equals(
-            Class.forName("org.openbravo.buildvalidation.Validation"))) {
+            Class.forName("org.openbravo.buildvalidation.BuildValidation"))) {
           Object instance = myClass.newInstance();
+          log4j.info("Executing build validation: " + s);
           errors = callExecute(myClass, instance);
           for (String error : errors) {
             errorMessage += error + "\n";
           }
         }
       } catch (Exception e) {
-        throw new BuildException("The validation " + s + " couldn't be properly executed");
+        log4j.info("Error executing build-validation: " + s, e);
+        throw new BuildException("The build validation " + s + " couldn't be properly executed");
       }
       if (errors.size() > 0) {
         throw new BuildException(
--- a/src-core/src/org/openbravo/modulescript/ModuleScriptHandler.java	Tue Mar 30 19:20:38 2010 +0200
+++ b/src-core/src/org/openbravo/modulescript/ModuleScriptHandler.java	Tue Mar 30 20:05:29 2010 +0200
@@ -5,10 +5,12 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.log4j.Logger;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Task;
 
 public class ModuleScriptHandler extends Task {
+  private static final Logger log4j = Logger.getLogger(ModuleScriptHandler.class);
 
   private File basedir;
   private String moduleJavaPackage;
@@ -40,9 +42,11 @@
         if (myClass.getGenericSuperclass().equals(
             Class.forName("org.openbravo.modulescript.ModuleScript"))) {
           Object instance = myClass.newInstance();
+          log4j.info("Executing moduleScript: " + s);
           callExecute(myClass, instance);
         }
       } catch (Exception e) {
+        log4j.info("Error executing moduleScript: " + s, e);
         throw new BuildException("Execution of moduleScript " + s + "failed.");
       }
     }
--- a/src-util/buildvalidation/build.xml	Tue Mar 30 19:20:38 2010 +0200
+++ b/src-util/buildvalidation/build.xml	Tue Mar 30 20:05:29 2010 +0200
@@ -61,27 +61,19 @@
       <arg line="'${base.config}'/Openbravo.properties .xsql ./src/org '${build.pre.sqlc}'" />
       <classpath refid="pre.class.path" />
     </java>
-      <javac srcdir="${build.pre.sqlc}/src" includes="**/*.java" destdir="${build.pre}" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
-        <classpath refid="pre.class.path" />
-      </javac>
+    <javac srcdir="${build.pre.sqlc}/src" includes="**/*.java" destdir="${build.pre}" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
+      <classpath refid="pre.class.path" />
+    </javac>
   </target>
 
   <target name="sqlcModules" depends="init" unless="checkCore">
-  	
-      <java classname="org.openbravo.data.Sqlc" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
-        <arg line="'${base.config}'/Openbravo.properties .xsql '${base.modules}' '${base.modules}'/'${module}'/src-util/buildvalidation/src */src-util/buildvalidation" />
-        <classpath refid="pre.class.path" />
-      </java>
-      <javac srcdir="${base.modules}/${module}/src-util/buildvalidation/src" includes="**/*.java" destdir="${base.modules}/${module}/build/classes" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
-        <classpath refid="pre.class.path" />
-      </javac>
-  </target>
-
-  <target name="sqlc" depends="init, sqlcCore, sqlcModules">
-  	
-  </target>
-
-  <target name="compileSqlc" depends="sqlc">
+    <java classname="org.openbravo.data.Sqlc" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
+      <arg line="'${base.config}'/Openbravo.properties .xsql '${base.modules}' '${base.modules}'/'${module}'/src-util/buildvalidation/src */src-util/buildvalidation" />
+      <classpath refid="pre.class.path" />
+    </java>
+    <javac srcdir="${base.modules}/${module}/src-util/buildvalidation/src" includes="**/*.java" destdir="${base.modules}/${module}/build/classes" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
+      <classpath refid="pre.class.path" />
+    </javac>
   </target>
 
   <target name="javacCore" if="checkCore">
@@ -96,11 +88,11 @@
     </javac>
   </target>
   
-  <target name="compile" depends="checkmodule,compileSqlc,javacCore,javacModule">
+  <target name="compile" depends="checkmodule, sqlcCore, sqlcModules, javacCore, javacModule">
   </target>
 
   <target name="buildvalidation" >
-    <taskdef name="ValidationHandler" classname="org.openbravo.buildvalidation.ValidationHandler" onerror="failall">
+    <taskdef name="ValidationHandler" classname="org.openbravo.buildvalidation.BuildValidationHandler" onerror="failall">
       <classpath refid="pre.class.path" />
     </taskdef>
     <ValidationHandler basedir="${base.src}/../" module="${module}" />
--- a/src-util/modulescript/build.xml	Tue Mar 30 19:20:38 2010 +0200
+++ b/src-util/modulescript/build.xml	Tue Mar 30 20:05:29 2010 +0200
@@ -61,27 +61,19 @@
       <arg line="'${base.config}'/Openbravo.properties .xsql ./src/org '${build.pre.sqlc}'" />
       <classpath refid="pre.class.path" />
     </java>
-      <javac srcdir="${build.pre.sqlc}/src" includes="**/*.java" destdir="${build.pre}" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
-        <classpath refid="pre.class.path" />
-      </javac>
+    <javac srcdir="${build.pre.sqlc}/src" includes="**/*.java" destdir="${build.pre}" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
+      <classpath refid="pre.class.path" />
+    </javac>
   </target>
 
   <target name="sqlcModules" depends="init" unless="checkCore">
-  	
-      <java classname="org.openbravo.data.Sqlc" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
-        <arg line="'${base.config}'/Openbravo.properties .xsql '${base.modules}' '${base.modules}'/'${module}'/src-util/modulescript/src */src-util/modulescript" />
-        <classpath refid="pre.class.path" />
-      </java>
-      <javac srcdir="${base.modules}/${module}/src-util/modulescript/src" includes="**/*.java" destdir="${base.modules}/${module}/build/classes" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
-        <classpath refid="pre.class.path" />
-      </javac>
-  </target>
-
-  <target name="sqlc" depends="init, sqlcCore, sqlcModules" >
-  	
-  </target>
-
-  <target name="compileSqlc" depends="sqlc">
+    <java classname="org.openbravo.data.Sqlc" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
+      <arg line="'${base.config}'/Openbravo.properties .xsql '${base.modules}' '${base.modules}'/'${module}'/src-util/modulescript/src */src-util/modulescript" />
+      <classpath refid="pre.class.path" />
+    </java>
+    <javac srcdir="${base.modules}/${module}/src-util/modulescript/src" includes="**/*.java" destdir="${base.modules}/${module}/build/classes" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
+      <classpath refid="pre.class.path" />
+    </javac>
   </target>
 
   <target name="javacCore" if="checkCore">
@@ -89,43 +81,16 @@
       <classpath refid="pre.class.path" />
     </javac>
   </target>
+
   <target name="javacModule" unless="checkCore">
     <javac srcdir="${main.dir}" includes="modules/${module}/src-util/modulescript/**/*.java" destdir="${main.dir}/modules/${module}/build/classes" deprecation="on" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
       <classpath refid="pre.class.path" />
     </javac>
   </target>
   
-  <target name="compile" depends="checkmodule,compileSqlc,javacCore,javacModule">
-    <copy todir="${build.pre}" encoding="UTF-8">
-      <fileset dir="${build.pre.src}" includes="**/*xml" />
-      <fileset dir="${build.pre.src}" includes="**/*html" />
-    </copy>
-    <copy todir="${build.pre}" encoding="UTF-8">
-      <fileset dir="${base.modules}">
-          <include name="*/src-modulescript/**/*" />
-          <exclude name="*/src-modulescript/**/*.java" />
-          <exclude name="*/src-modulescript/**/*.xsql" />
-      </fileset>
-      <mapper type="regexp" from="(.*\${file.separator}src-modulescript/)(.*)" to="\2" />
-    </copy>
+  <target name="compile" depends="checkmodule, sqlcCore, sqlcModules, javacCore, javacModule">
   </target>
 
-  <target name="build.jar">
-    <jar destfile="${build.pre.lib}/openbravo-pre.jar">
-      <fileset dir="${build.pre}" />
-      <manifest>
-        <attribute name="Built-By" value="Openbravo S.L." />
-        <!--section name="common/class1.class">
-        <attribute name="Sealed" value="false"/>
-      </section-->
-      </manifest>
-    </jar>
-  </target>
-
-  <target name="build" depends="compile, build.jar">
-  </target>
-
-  
   <target name="checkmodule"  if="module.not.provided">
     <fail>You need to specify a module</fail>
   </target>