src/build.xml
author Iván Perdomo <ivan.perdomo@openbravo.com>
Tue, 28 Apr 2009 19:53:09 +0200
changeset 3752 99f93189fbad
parent 3673 8d59cd762a3e
child 3775 ec9a9966f353
permissions -rw-r--r--
Added license to new java classes. Added run.javascript.tests task
<?xml version="1.0" encoding="UTF-8" ?>
<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo Public License 
 * Version 1.1 (the "License"), being the Mozilla Public License 
 * version 1.1  with a permitted attribution clause ; you may not use 
 * this file except in compliance with the License. 
 * You may obtain a copy of the License at  
 * http://www.openbravo.com/legal/license.txt 
 * Software distributed under the License is distributed on an 
 * "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or 
 * implied. See the License for the specific language governing rights 
 * and  limitations under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SL 
 * All portions are Copyright (C) 2005-2009 Openbravo SL 
 * All Rights Reserved. 
 * Contributor(s): Openbravo S.L.
 ************************************************************************
-->

<!--
List of methods infside:

init: creates all the folders.
trl.clean: clean the AD_TEXTINTERFACES table
clean: delete all folders.
copy.srcClient: copy the content of the srcClient to the src folder.
sqlc: generates the java from the xsql files.
compileSqlc: compiles all the java generated from the xsqls.
wad: generates all the files from the mda.
postwad: copies the generated files to the base design folder.
postsrc: copies the src files to the base design folder and the 
         xml and jasper files to the translated designs folders
postsrc.modules: it does the same as postsrc but for module files
build.local.context: copies all files to the eclipse base context 
                     (WebContent...).
compile.src: comiles only the src files.
eclipse.compile: generates specified wad files and compiles modified xsql files.
eclipse.compile.complete: generates all wad files and compiles all xsql files
compile: compiles specified WAD window and src and also translates.
compile.complete: compiles all WAD windows and src and also translates.
translate: Translate the modified files.
compile.translate: Translate the specified extensions files.
installWebService: install the web services configuration file.
uninstallWebService: uninstall the web services configuration file.
copy.files: copy the local files to the context.
compile.development: like compile, but also copies the files to the context.
compile.complete.development: like compile.complete, but also copies the files 
                              to the context.
compile.web: re-builds the web folder.
compile.web.development: like compile.web, but also copies the files to the context.
build.war: build a war file in the lib directory.
-->

<project name="openbravo sources" default="compile" basedir=".">

  <path id="yuicompressor.classpath">
    <fileset dir="../lib/build">
      <include name="**/yuicompressor-2.4.2.jar" />
      <include name="**/YUIAnt.jar" />
    </fileset>
  </path>
  <taskdef name="yuicompress" classname="com.yahoo.platform.yui.compressor.YUICompressTask">
    <classpath refid="yuicompressor.classpath" />
  </taskdef>

  <condition property="minimizeJSandCSSbool">
    <istrue value="${minimizeJSandCSS}" />
  </condition>

  <property name="webTab" value="all" />
  <property name="tab" value="%" />

  <property name="base.translate.structure" value="org/openbravo/erpWindows" />
  <property name="client.web.xml" value="${base.client.src}/web.xml" />
  <property name="extension" value="html" />
  <property name="src" value="." />
  <property name="tr" value="yes" />
  <condition property="translation">
    <not>
      <equals arg1="no" arg2="${tr}" />
    </not>
  </condition>
  <target name="init">
    <mkdir dir="${build}" />
    <mkdir dir="${base.design}/design" />
    <mkdir dir="${build.sqlc}" />
    <mkdir dir="${build.sqlc}/src" />
    <mkdir dir="${build.sqlc}/srcAD" />
    <mkdir dir="${build.AD}" />
    <mkdir dir="${build.AD}/org/openbravo/erpWindows" />
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/ad_actionButton" />
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/ad_callouts" />
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/reference" />
    <mkdir dir="${build.docs}" />
  </target>

  <target name="validate.database">
    <taskdef name="validateDatabase" classname="org.openbravo.service.system.SystemValidationTask">
      <classpath refid="project.class.path" />
    </taskdef>
    <validateDatabase userId="0" propertiesFile="${base.config}/Openbravo.properties" type="database" />
  </target>

  <target name="validate.modules">
    <taskdef name="validateModules" classname="org.openbravo.service.system.SystemValidationTask">
      <classpath refid="project.class.path" />
    </taskdef>
    <validateModules userId="0" propertiesFile="${base.config}/Openbravo.properties" type="module" />
  </target>

  <target name="trl.clean" if="translation">
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
      <arg line="clean ${base.config}/Openbravo.properties" />
      <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="clean" depends="trl.clean">
    <property name="complete" value="true" />
    <delete includeEmptyDirs="true" failonerror="false">
      <fileset dir="${base.design}" />
      <fileset dir="${build}" />
      <fileset dir="${build.docs}" />
      <fileset dir="${build.AD}" />
      <fileset dir="${build.sqlc}" />
      <fileset dir="${base.context}">
        <exclude name=".svn" />
        <exclude name="META-INF/MANIFEST.MF" />
        <exclude name="**/.keep" />
      </fileset>
    </delete>
  </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" />
      <classpath refid="project.class.path" />
    </java>
    <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 '${base.modules}' '${build.sqlc}'/src */src" />
      <classpath refid="project.class.path" />
    </java>
    <copy file="${base.src}/buildAD.xml" tofile="${build.AD}/build.xml" />
    <copy file="${base.src}/log4j.lcf" tofile="${build.AD}/log4j.lcf" />
    <ant dir="${build.AD}" target="buildAD" inheritAll="true" inheritRefs="true" />
  </target>

  <target name="copy.srcClient">
    <mkdir dir="${base.client.src}" />
    <copy todir="${basedir}" overwrite="true" failonerror="false">
      <fileset dir="${base.client.src}">
        <exclude name="**/web.xml" />
      </fileset>
    </copy>
  </target>

  <target name="clean.src.gen">
    <delete includeEmptyDirs="true" failonerror="false">
      <fileset dir="${base.src.gen}" >
        <exclude name="**/.keep" />
      </fileset>
    </delete>
  </target>

  <target name="export.sample.data" description="Exports Sample Data">
    <taskdef name="exportsampledata" classname="org.openbravo.service.db.ExportReferenceDataTask">
      <classpath refid="project.class.path" />
    </taskdef>
    <echo message="Exporting sample reference data" />
    <exportsampledata userId="0" propertiesFile="${base.config}/Openbravo.properties" clients="SmallBazaar" />
  </target>

  <target name="import.sample.data" description="Import Sample Data" depends="generate.entities">
    <taskdef name="importsampledata" classname="org.openbravo.service.db.ImportReferenceDataTask">
      <classpath refid="project.class.path" />
    </taskdef>
    <echo message="Importing sample reference data" />
    <importsampledata userId="0" propertiesFile="${base.config}/Openbravo.properties" />
    <ant dir="${base.db}" target="database.postupdate.${bbdd.rdbms}" inheritAll="true" inheritRefs="true" />
  </target>

  <target name="generate.entities" depends="compile.src.gen,clean.src.gen">
    <taskdef name="workflow" classpathref="project.class.path" classname="org.openbravo.base.gen.GenerateEntitiesTask" />
    <!-- debug="true" will perform the in-memory model initialization before generating entities
	if an error occurs then, then a stacktrace is printed. -->
    <workflow debug="false" srcGenPath="${base.src.gen}" propertiesFile="${base.config}/Openbravo.properties" file="${base.src}/org/openbravo/base/gen/gen_entity.oaw" fork="true" maxmemory="${build.maxmemory}">
      <param name="ob.properties.location" value="${base.config}/Openbravo.properties" />
      <param name="base.src.gen" value="${base.src.gen}" />
      <classpath>
        <path refid="project.class.path" />
      </classpath>
    </workflow>
    
    <javac srcdir="${base.src}:${base.src.gen}" includes="org/openbravo/model/**,org/openbravo/base/structure/**,org/openbravo/dal/**,org/openbravo/service/dataset/**" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
      <classpath refid="project.class.path" />
    </javac>
    <javac srcdir="${base.src.gen}" excludes="org/openbravo/model/**,org/openbravo/base/structure/**,org/openbravo/dal/**,org/openbravo/service/dataset/**" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
      <classpath refid="project.class.path" />
    </javac>
  </target>

  <!-- 
		Generates entities only when the application dictionary has changed.
		Difference with the generate.entities is that it does not clean the src-gen directory. The standard
		GenerateEntitiesTask always checks if the AD was changed before regenerating. The check is to compare
		the modified time of the generated sources with the updated time of the Application Dictionary. If there
		is a source older than the last updated time of the Application Dictionary then the sources need to be regenerated.		
	-->
  <target name="generate.entities.quick" depends="compile.src.gen">

    <taskdef name="workflow" classpathref="project.class.path" classname="org.openbravo.base.gen.GenerateEntitiesTask" />
    <!-- debug="true" will perform the in-memory model initialization before generating entities
	if an error occurs then, then a stacktrace is printed. -->
    <workflow debug="false" srcGenPath="${base.src.gen}" propertiesFile="${base.config}/Openbravo.properties" file="${base.src}/org/openbravo/base/gen/gen_entity.oaw" fork="true" maxmemory="${build.maxmemory}">
      <param name="ob.properties.location" value="${base.config}/Openbravo.properties" />
      <param name="base.src.gen" value="${base.src.gen}" />
      <classpath>
        <path refid="project.class.path" />
      </classpath>
    </workflow>
    <javac srcdir="${base.src}:${base.src.gen}" includes="org/openbravo/model/**,org/openbravo/base/structure/**,org/openbravo/dal/**,org/openbravo/service/dataset/**" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
      <classpath refid="project.class.path" />      
    </javac>
    <javac srcdir="${base.src.gen}" excludes="org/openbravo/model/**,org/openbravo/base/structure/**,org/openbravo/dal/**,org/openbravo/service/dataset/**" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
      <classpath refid="project.class.path" />
    </javac>
  </target>

  <target name="run.tests" depends="compileSqlc,generate.entities.quick">
    <junit printsummary="yes" haltonfailure="yes">
      <classpath refid="project.class.path" />
      <formatter type="plain" usefile="no"/>
      <test name="org.openbravo.test.AntTaskTests" haltonfailure="no"/>
    </junit>
  </target>

  <target name="run.all.tests" depends="compileSqlc,generate.entities.quick">
    <junit printsummary="yes" haltonfailure="yes">
      <classpath refid="project.class.path" />
      <formatter type="plain" usefile="no"/>
      <test name="org.openbravo.test.AllAntTaskTests" haltonfailure="no"/>
    </junit>
  </target>

  <target name="run.quick.tests" depends="compileSqlc,generate.entities.quick">
    <junit printsummary="yes" haltonfailure="yes">
      <classpath refid="project.class.path" />
      <formatter type="plain" usefile="no"/>
      <test name="org.openbravo.test.AllQuickAntTaskTests" haltonfailure="no"/>
    </junit>
  </target>

  <target name="run.javascript.tests">
  	<taskdef name="jstest" classname="org.openbravo.test.javascript.JavaScriptAntTest" classpathref="project.class.path" />
	<jstest apiDetailsPath="${base.config}" jsPath="${base.web}/js" />
  </target>
  
  <target name="compileSqlc" depends="sqlc">
    <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>
    
    <javac srcdir="${build.AD}" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
      <classpath refid="project.class.path" />
    </javac>
  </target>

  <target name="compile.src.gen" depends="init">
    <javac srcdir="${basedir}" includes="org/openbravo/base/exception/**,org/openbravo/base/gen/**,org/openbravo/base/expression/**,org/openbravo/base/provider/**,org/openbravo/base/model/**,org/openbravo/base/session/**,org/openbravo/base/validation/**,org/openbravo/base/util/**" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
      <classpath refid="project.class.path" />
    </javac>
    <copy todir="${build}">
      <fileset dir="${basedir}" includes="**/*.hbm.xml" />
    </copy>
    <copy todir="${build}">
      <fileset dir="${basedir}" includes="**/*.properties" />
    </copy>
  </target>

  <target name="wad" depends="init">
    <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}'" />
      <classpath refid="project.class.path" />
    </java>
    <antcall target="postwad" inheritall="true" inheritrefs="true" />
  </target>

  <target name="wad.quick" depends="init">


    <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'" />
      <classpath refid="project.class.path" />
    </java>
    <antcall target="postwad" inheritall="true" inheritrefs="true" />
  </target>

  <target name="postsrc" depends="postsrc.modules">
    <copy todir="${build}">
      <fileset dir="${basedir}" includes="**/*.properties" />
    </copy>
    <copy todir="${build}">
      <fileset dir="${basedir}" includes="**/*.xslt" />
    </copy>
    <copy todir="${build}">
      <fileset dir="${basedir}" includes="**/*.hbm.xml" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${basedir}" includes="**/*.xml" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${basedir}" includes="**/*.fo" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${basedir}" includes="**/*.html" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${basedir}" includes="**/*.srpt" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${basedir}" includes="**/*.jrxml" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${basedir}" includes="**/*.jasper" />
    </copy>
    <copy todir="${build}">
      <fileset file="${base.config}/quartz.properties" />
    </copy>
    <antcall target="build.local.context" inheritAll="true" inheritrefs="true" />
  </target>

  <target name="postsrc.modules">
    <copy todir="${base.design}/design">
      <fileset dir="${base.modules}">
        <include name="*/src/**/*.xml" />
        <include name="*/src/**/*.fo" />
        <include name="*/src/**/*.html" />
        <include name="*/src/**/*.srpt" />
        <include name="*/src/**/*.jrxml" />
        <include name="*/src/**/*.jasper" />
      </fileset>
      <mapper type="regexp" from="(.*\${file.separator}src)(.*)" to="\2" />
    </copy>
  </target>

  <!-- FIXME: These tasks is only for development and testing purposes, remove it afterwards-->
  <target name="sqlcmod" 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 '${base.modules}' '${build.sqlc}'/src */src" />
      <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="compileSqlcmod" depends="sqlcmod">
    <javac srcdir="${build.sqlc}/src:${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>
  </target>
  <target name="postsrcmod">
    <copy todir="${base.design}/design">
      <fileset dir="${base.modules}" includes="*/src/**/*.html" />
      <mapper type="regexp" from="(.*\${file.separator}src)(.*)" to="\2" />
    </copy>
  </target>

  <!-- end of auxiliar tasks-->

  <target name="build.local.context">
    <copy todir="${base.context}" encoding="UTF-8">
      <fileset file="${basedir}/index.html" />
    </copy>
    <copy todir="${base.context}/WEB-INF" encoding="UTF-8">
      <fileset file="${build.sqlc}/src/web.xml" />
      <fileset dir="${base.config}">
        <exclude name="**/eclipse/**" />
        <exclude name="**/setup-properties**" />
        <exclude name="*.template" />
        <exclude name="checksums"/>
      </fileset>
    </copy>
    <copy todir="${base.context}/WEB-INF" encoding="UTF-8">
      <fileset dir="${base.modules}">
        <include name="*/config/**" />
        <exclude name="*.template" />
      </fileset>
      <mapper type="regexp" from="(.*\${file.separator}config)(.*)" to="\2" />
    </copy>
    <copy todir="${base.context}/WEB-INF/lib" encoding="UTF-8">
      <fileset dir="${base.lib}/runtime">
        <exclude name="openbravo-wad.jar" />
        <exclude name="openbravo-trl.jar" />
        <exclude name="servlet-api.jar" />
        <exclude name="*.war" />
      </fileset>
      <fileset dir="${base.db}/lib">
        <include name="*" />
      </fileset>
    </copy>

    <copy todir="${base.context}/WEB-INF/lib" encoding="UTF-8">
      <fileset dir="${base.modules}">
        <include name="*/lib/runtime/**" />
      </fileset>
      <mapper type="regexp" from="(.*\${file.separator}lib\${file.separator}runtime)(.*)" to="\2" />
    </copy>
    <antcall target="build.web.folder" inheritAll="true" inheritrefs="true" />
  </target>

  <target name="build.web.folder">
    <copy todir="${base.context}/web" encoding="UTF-8">
      <fileset dir="${base.web}">
        <include name="*/**" />
        <exclude name="skins/**" />
      </fileset>
    </copy>
    
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
        <classpath refid="project.class.path" />
      </taskdef>
    
    <CheckSumCondition obDir="${basedir}/.."
                       type="md5.skins"
                       property="changes.in.md5.skins"/>
    <condition property="do.skins">
      <or>
        <istrue value="${changes.in.md5.skins}" />
        <not>
          <istrue value="${smart.mode}"/>
        </not>
      </or>
    </condition>
    
    <antcall target="build.web.folder.skins"  inheritAll="true" inheritrefs="true" />
    
    <condition property="generateSpritesBool">
        <istrue value="${generateSprites}" />
    </condition>
    <antcall target="generate.sprites" inheritAll="true" inheritrefs="true" />
    <antcall target="minimizeJSandCSS" inheritAll="true" inheritrefs="true" />
  </target>
    

  <target name="build.web.folder.skins" if="do.skins">

    <delete includeEmptyDirs="true" dir="${base.context}/web/skins" quiet="yes" />
    <mkdir dir="${base.context}/web" />
    <mkdir dir="${base.context}/web/skins" />
    <mkdir dir="${base.context}/web/skins/ltr" />
    <copy todir="${base.context}/web/skins/ltr" encoding="UTF-8">
      <fileset dir="${base.web}/skins" />
    </copy>
    <mkdir dir="${base.context}/web/skins/rtl" />
    <copy todir="${base.context}/web/skins/rtl" encoding="UTF-8">
      <fileset dir="${base.web}/skins" />
    </copy>

    <copy todir="${base.context}/web" encoding="UTF-8">
      <fileset dir="${base.modules}">
        <include name="*/web/*/**" />
        <exclude name="*/web/**/skins/**" />
      </fileset>
      <mapper type="regexp" from="(.*)(\${file.separator}web)(.*)" to="\3" />
    </copy>

    <copy todir="${base.context}/web/skins/ltr" encoding="UTF-8">
      <fileset dir="${base.modules}">
        <include name="*/web/*/**/skins/**" />
      </fileset>
      <mapper type="regexp" from="(.*)(\${file.separator}web)(.*\${file.separator})(skins\${file.separator})(.*)" to="\3\5" />
    </copy>

    <copy todir="${base.context}/web/skins/rtl" encoding="UTF-8">
      <fileset dir="${base.modules}">
        <include name="*/web/*/**/skins/**" />
      </fileset>
      <mapper type="regexp" from="(.*)(\${file.separator}web)(.*\${file.separator})(skins\${file.separator})(.*)" to="\3\5" />
    </copy>

    <java classname="org.openbravo.translate.RTLSkin" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
      <arg line="${base.context}/web/skins/rtl ${base.context}/web/skins/ltr" />
      <classpath refid="project.class.path" />
    </java>
    
  </target>

  <target name="generate.sprites" description="Performs CSS sprite processing" if="generateSpritesBool">
    <property name="skins.location" location="${base.context}/web/skins/" />
    <taskdef name="smartsprites" classname="org.carrot2.labs.smartsprites.ant.SmartSpritesTask">
      <classpath refid="project.class.path" />
    </taskdef>
    <smartsprites rootdir="${skins.location}" documentrootdir="${skins.location}" outputdir="${skins.location}" cssfilesuffix="-sprite" csspropertyindent="  " loglevel="WARN" spritepngdepth="DIRECT" spritepngie6="false" />
    <move todir="${skins.location}">
      <fileset dir="${skins.location}">
        <include name="*/*-sprite.css" />
        <include name="*/*/*-sprite.css" />
      </fileset>
      <mapper type="glob" from="*-sprite.css" to="*.css" />
    </move>
  </target>

  <target name="minimizeJSandCSS" description="minimize JS and CSS files" if="minimizeJSandCSSbool">
    <yuicompress linebreak="300" warn="false" munge="yes" preserveallsemicolons="true" outputfolder="${base.context}/web" charset="UTF-8">
      <fileset dir="${base.web}">
        <include name="**/*.js" />
        <include name="**/*.css" />
        <!-- The following scripts break in minification process -->
        <exclude name="**/js/dojo/src/docs.js" />
        <exclude name="**/js/dojo/src/hostenv_jsc.js" />
        <exclude name="**/js/jscalendar/lang/calendar-al.js" />
        <exclude name="**/js/jscalendar/lang/calendar-he-utf8.js" />
        <exclude name="**/js/jscalendar/lang/calendar-hr.js" />
        <exclude name="**/js/xinha/lang/**" />
        <exclude name="**/js/xinha/plugins/**" />
        <!-- dojotoolkit files are already compressd -->
        <exclude name="**/dojotoolkit/**" />
        <!-- from old dojo, only compress main file -->
        <exclude name="**/dojo/**" />
        <include name="js/dojo/dojo.js" />
      </fileset>
    </yuicompress>
  </target>

  <target name="postwad">
    <copy todir="${base.design}/design">
      <fileset dir="${build.AD}" includes="**/*.xml" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${build.AD}" includes="**/*.fo" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${build.AD}" includes="**/*.html" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${build.AD}" includes="**/*.srpt" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${build.AD}" includes="**/*.jrxml" />
    </copy>
    <copy todir="${base.design}/design">
      <fileset dir="${build.AD}" includes="**/*.jasper" />
    </copy>
  </target>


  <target name="eclipse.compile.complete" depends="clean,generate.entities,wad,sqlc,postsrc,translate">
    <antcall target="update.build.timestamp" />
  </target>

  <target name="eclipse.compile" depends="wad,sqlc, postsrc, translate">
  </target>

  <target name="compile.src" depends="compileSqlc, postsrc, copy.files">
  </target>

  <target name="compile.complete" depends="clean,generate.entities,wad,compileSqlc,postsrc,translate">
    <antcall target="update.build.timestamp" />
  </target>


  <target name="smartbuild.new.wad" if="new.wad">
    <antcall inheritall="true" inheritrefs="true" target="wad" />
    <taskdef name="updateWADmd5" classname="org.openbravo.utils.WADCheckSumTask">
      <classpath refid="project.class.path" />
    </taskdef>
    <updateWADmd5 obDir="${basedir}/.." />
  </target>

  <target name="smartbuild.no.new.wad" unless="new.wad">
    <antcall inheritall="true" inheritrefs="true" target="wad.quick" />
  </target>

  <target name="smartbuild">
    <antcall inheritall="true" inheritrefs="true" target="smartbuild.new.wad" />
    <antcall inheritall="true" inheritrefs="true" target="smartbuild.no.new.wad" />
    <antcall inheritall="true" inheritrefs="true" target="compileSqlc" />
    <antcall inheritall="true" inheritrefs="true" target="postsrc" />
    <antcall inheritall="true" inheritrefs="true" target="translate" />
    <antcall inheritall="true" inheritrefs="true" target="update.build.timestamp" />
  </target>

  <target name="translate" if="translation">
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
      <param name="extension" value="html" />
    </antcall>
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
      <param name="extension" value="fo" />
    </antcall>
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
      <param name="extension" value="srpt" />
    </antcall>
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
      <param name="extension" value="jrxml" />
    </antcall>
    <antcall inheritall="true" inheritrefs="true" target="translate.modules" />
  </target>

  <target name="compile" depends="wad,compileSqlc, postsrc, translate">
  </target>

  <target name="translate.modules" if="translation">
    <antcall inheritall="true" inheritrefs="true" target="compile.translate.modules">
      <param name="extension" value="html" />
    </antcall>
    <antcall inheritall="true" inheritrefs="true" target="compile.translate.modules">
      <param name="extension" value="fo" />
    </antcall>
    <antcall inheritall="true" inheritrefs="true" target="compile.translate.modules">
      <param name="extension" value="srpt" />
    </antcall>
    <antcall inheritall="true" inheritrefs="true" target="compile.translate.modules">
      <param name="extension" value="jrxml" />
    </antcall>
  </target>

  <target name="compile.translate.modules">
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
      <arg line="'${base.config}'/Openbravo.properties ${extension} ${base.modules} '*/src'" />
      <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="installWebService" depends="init" if="wsdd">
    <java classname="org.apache.axis.client.AdminClient" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}">
      <arg line="-l${context.url}/servlet/AxisServlet ${src}/deploy.wsdd" />
      <classpath refid="project.class.path" />
    </java>
  </target>


  <target name="compile.translate">
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
      <arg line="'${base.config}'/Openbravo.properties ${extension} ${basedir}" />
      <classpath refid="project.class.path" />
    </java>
  </target>


  <target name="uninstallWebService" depends="init">
    <java classname="org.apache.axis.client.AdminClient" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}">
      <arg line="-l${context.url}/servlet/AxisServlet ${src}/undeploy.wsdd" />
      <classpath refid="project.class.path" />
    </java>
  </target>

  <target name="copy.files">
    <mkdir dir="${jakarta.base}/webapps/${context.name}" />
    <copy todir="${jakarta.base}/webapps/${context.name}" encoding="UTF-8">
      <fileset dir="${base.context}" />
    </copy>
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/classes" />
    <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/classes" encoding="UTF-8">
      <fileset dir="${build}" />
    </copy>
  </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">
    </copy>
  </target>

  <target name="compile.complete.development" depends="compile.complete, 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">
    </copy>
  </target>

  <target name="compile.web" depends="build.web.folder">
  </target>

  <target name="compile.web.development" depends="build.web.folder, copy.files">
  </target>

  <target name="build.war">
    <delete failonerror="false" file="${base.lib}/${context.name}.war" />
    <war compress="true" destfile="${base.lib}/${context.name}.war" encoding="UTF-8" webxml="${base.context}/WEB-INF/web.xml">
      <zipfileset dir="${base.context}">
        <exclude name="**/WEB-INF/web.xml" />
        <exclude name="**/WEB-INF/lib/servlet-api.jar" />
      </zipfileset>
      <classes dir="${build}" />
    </war>
  </target>

  <target name="generate-wsdd">
    <delete failonerror="false">
      <fileset dir="${base.src}/org/openbravo/services/webservice" includes="**/*" />
    </delete>

    <mkdir dir="${build}" />
     <axis-wsdl2java output="${base.src}" verbose="false" url="http://centralrepository.openbravo.com/openbravo/services/WebService?wsdl" serverside="true" debug="false">
      <mapping namespace="http://centralrepository.openbravo.com/openbravo/services/WebService" package="org.openbravo.services.webservice" />
      <mapping namespace="/services/WebService" package="org.openbravo.services.webservice" />
    </axis-wsdl2java>
  </target>

  <target name="update.build.timestamp" unless="timestamp">
    <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" delimiter="/">
      <classpath>
        <fileset dir="${base.lib}">
          <include name="**/*.jar">
          </include>
        </fileset>
      </classpath>
      <transaction>
	        UPDATE AD_SYSTEM_INFO SET LAST_BUILD=NOW()
	      </transaction>
    </sql>
  </target>

</project>