src-util/buildvalidation/build.xml
author Antonio Moreno <antonio.moreno@openbravo.com>
Tue, 30 Mar 2010 13:18:54 +0200
changeset 6907 60a98816806d
child 6916 a4d9cecda6bb
permissions -rw-r--r--
[validations] First version of the validations project
antonio@6907
     1
<?xml version="1.0" encoding="UTF-8" ?>
antonio@6907
     2
<!--
antonio@6907
     3
 *************************************************************************
antonio@6907
     4
 * The contents of this file are subject to the Openbravo Public License 
antonio@6907
     5
 * Version 1.1 (the "License"), being the Mozilla Public License 
antonio@6907
     6
 * version 1.1  with a permitted attribution clause ; you may not use 
antonio@6907
     7
 * this file except in compliance with the License. 
antonio@6907
     8
 * You may obtain a copy of the License at  
antonio@6907
     9
 * http://www.openbravo.com/legal/license.txt 
antonio@6907
    10
 * Software distributed under the License is distributed on an 
antonio@6907
    11
 * "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or 
antonio@6907
    12
 * implied. See the License for the specific language governing rights 
antonio@6907
    13
 * and  limitations under the License. 
antonio@6907
    14
 * The Original Code is Openbravo ERP. 
antonio@6907
    15
 * The Initial Developer of the Original Code is Openbravo SL 
antonio@6907
    16
 * All portions are Copyright (C) 2005-2009 Openbravo SL 
antonio@6907
    17
 * All Rights Reserved. 
antonio@6907
    18
 * Contributor(s): Openbravo S.L.
antonio@6907
    19
 ************************************************************************
antonio@6907
    20
-->
antonio@6907
    21
<!--
antonio@6907
    22
List of targets:
antonio@6907
    23
antonio@6907
    24
init: creates the needed folders.
antonio@6907
    25
clean: removes all the created files and folders.
antonio@6907
    26
sqlc: generates java files from xsql's files.
antonio@6907
    27
compileSqlc: compile the java files generated from xsql's files.
antonio@6907
    28
compile: compile the java files of the project.
antonio@6907
    29
build.jar: generates the jar file in the lib folder.
antonio@6907
    30
build: compile the project, including the xsql's files and generates the jar and doc.
antonio@6907
    31
doc: generates the api for the project.
antonio@6907
    32
-->
antonio@6907
    33
<project name="openbravo-pre-install" default="compile" basedir=".">
antonio@6907
    34
  <property name="build.pre" value="${basedir}/build/classes" />
antonio@6907
    35
  <property name="build.pre.sqlc" value="${basedir}/build/javasqlc" />
antonio@6907
    36
  <property name="build.pre.src" value="${basedir}/src/" />
antonio@6907
    37
  <property name="main.dir" value="${basedir}/../.." />
antonio@6907
    38
antonio@6907
    39
  <path id="pre.class.path">
antonio@6907
    40
    <pathelement path="../src-core/build/classes" />
antonio@6907
    41
    <pathelement path="build/classes" />
antonio@6907
    42
    <dirset dir="${base.modules}">
antonio@6907
    43
      <include name="*/build/classes/" />
antonio@6907
    44
    </dirset>
antonio@6907
    45
    <pathelement path="config"/>
antonio@6907
    46
    <fileset dir="${base.lib}">
antonio@6907
    47
      <include name="**/*.jar" />
antonio@6907
    48
    </fileset>
antonio@6907
    49
  </path>
antonio@6907
    50
antonio@6907
    51
  <condition property="module.not.provided">
antonio@6907
    52
    <equals arg1="${module}" arg2="%" />
antonio@6907
    53
  </condition>
antonio@6907
    54
  <condition property="checkCore">
antonio@6907
    55
    <equals arg1="${module}" arg2="org.openbravo" />
antonio@6907
    56
  </condition>
antonio@6907
    57
  <target name="init">
antonio@6907
    58
    <mkdir dir="${build.pre}" />
antonio@6907
    59
    <mkdir dir="${build.pre.sqlc}" />
antonio@6907
    60
    <mkdir dir="${build.pre.sqlc}/src" />
antonio@6907
    61
    <mkdir dir="${main.dir}/modules/${module}/build/" />
antonio@6907
    62
    <mkdir dir="${main.dir}/modules/${module}/build/javasqlc" />
antonio@6907
    63
    <mkdir dir="${main.dir}/modules/${module}/build/classes" />
antonio@6907
    64
  </target>
antonio@6907
    65
antonio@6907
    66
  <target name="clean">
antonio@6907
    67
    <delete dir="${build.pre}" failonerror="false" includeemptydirs="true" />
antonio@6907
    68
    <delete dir="${build.pre.sqlc}" failonerror="false" includeemptydirs="true" />
antonio@6907
    69
  </target>
antonio@6907
    70
antonio@6907
    71
  <target name="sqlc" depends="init">
antonio@6907
    72
    <java classname="org.openbravo.data.Sqlc" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
antonio@6907
    73
      <arg line="'${base.config}'/Openbravo.properties .xsql ./src/org '${build.pre.sqlc}'" />
antonio@6907
    74
      <classpath refid="pre.class.path" />
antonio@6907
    75
    </java>
antonio@6907
    76
  	
antonio@6907
    77
  	<java classname="org.openbravo.data.Sqlc" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
antonio@6907
    78
      <arg line="'${base.config}'/Openbravo.properties .xsql '${base.modules}' '${build.pre.sqlc}'/src */src-util/buildvalidation" />
antonio@6907
    79
  	  <classpath refid="pre.class.path" />
antonio@6907
    80
  	</java>
antonio@6907
    81
  </target>
antonio@6907
    82
antonio@6907
    83
  <target name="compileSqlc" depends="sqlc">
antonio@6907
    84
    <javac srcdir="${build.pre.sqlc}/src" includes="**/*.java" destdir="${build.pre}" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
antonio@6907
    85
      <classpath refid="pre.class.path" />
antonio@6907
    86
    </javac>
antonio@6907
    87
  </target>
antonio@6907
    88
antonio@6907
    89
antonio@6907
    90
  <target name="javacCore" if="checkCore">
antonio@6907
    91
    <javac srcdir="${main.dir}" includes="src-util/buildvalidation/src/**/*.java" destdir="${build.pre}" deprecation="on" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
antonio@6907
    92
      <classpath refid="pre.class.path" />
antonio@6907
    93
    </javac>
antonio@6907
    94
  </target>
antonio@6907
    95
  <target name="javacModule" unless="checkCore">
antonio@6907
    96
    <javac srcdir="${main.dir}" includes="modules/${module}/src-util/buildvalidation/**/*.java" destdir="${main.dir}/modules/${module}/build/classes" deprecation="on" encoding="UTF-8" debug="true" debuglevel="lines,vars,source">
antonio@6907
    97
      <classpath refid="pre.class.path" />
antonio@6907
    98
    </javac>
antonio@6907
    99
  </target>
antonio@6907
   100
  
antonio@6907
   101
  <target name="compile" depends="checkmodule,compileSqlc,javacCore,javacModule">
antonio@6907
   102
    <copy todir="${build.pre}" encoding="UTF-8">
antonio@6907
   103
      <fileset dir="${build.pre.src}" includes="**/*xml" />
antonio@6907
   104
      <fileset dir="${build.pre.src}" includes="**/*html" />
antonio@6907
   105
    </copy>
antonio@6907
   106
    <copy todir="${build.pre}" encoding="UTF-8">
antonio@6907
   107
      <fileset dir="${base.modules}">
antonio@6907
   108
          <include name="*/src-buildvalidation/**/*" />
antonio@6907
   109
          <exclude name="*/src-buildvalidation/**/*.java" />
antonio@6907
   110
          <exclude name="*/src-buildvalidation/**/*.xsql" />
antonio@6907
   111
      </fileset>
antonio@6907
   112
      <mapper type="regexp" from="(.*\${file.separator}src-buildvalidation/)(.*)" to="\2" />
antonio@6907
   113
    </copy>
antonio@6907
   114
  </target>
antonio@6907
   115
antonio@6907
   116
  <target name="build.jar">
antonio@6907
   117
    <jar destfile="${build.pre.lib}/openbravo-pre.jar">
antonio@6907
   118
      <fileset dir="${build.pre}" />
antonio@6907
   119
      <manifest>
antonio@6907
   120
        <attribute name="Built-By" value="Openbravo S.L." />
antonio@6907
   121
        <!--section name="common/class1.class">
antonio@6907
   122
        <attribute name="Sealed" value="false"/>
antonio@6907
   123
      </section-->
antonio@6907
   124
      </manifest>
antonio@6907
   125
    </jar>
antonio@6907
   126
  </target>
antonio@6907
   127
antonio@6907
   128
  <target name="build" depends="compile, build.jar">
antonio@6907
   129
  </target>
antonio@6907
   130
antonio@6907
   131
  
antonio@6907
   132
  <target name="validate" >
antonio@6907
   133
    <taskdef name="ValidationHandler" classname="org.openbravo.buildvalidation.ValidationHandler" onerror="failall">
antonio@6907
   134
      <classpath refid="pre.class.path" />
antonio@6907
   135
    </taskdef>
antonio@6907
   136
    <ValidationHandler basedir="${base.src}/../" module="${module}" />
antonio@6907
   137
  </target>
antonio@6907
   138
  
antonio@6907
   139
  <target name="checkmodule"  if="module.not.provided">
antonio@6907
   140
    <fail>You need to specify a module</fail>
antonio@6907
   141
  </target>
antonio@6907
   142
  
antonio@6907
   143
</project>