src/build.xml
author Asier Lostalé <asier.lostale@openbravo.com>
Mon, 10 Sep 2018 12:40:04 +0200
changeset 34765 3e0f540c5540
parent 34763 701d003b887b
child 34817 9718d881aa97
child 35011 4099d7b5ceca
permissions -rw-r--r--
related to issue 39229: make it work in Windows

Using file.separator in Windows was interpreted as regexp escape character.

Using common slash works fine also in Windows.
carlos@0
     1
<?xml version="1.0" encoding="UTF-8" ?>
carlos@0
     2
<!--
carlos@0
     3
 *************************************************************************
carlos@0
     4
 * The contents of this file are subject to the Openbravo Public License 
carlos@0
     5
 * Version 1.1 (the "License"), being the Mozilla Public License 
carlos@0
     6
 * version 1.1  with a permitted attribution clause ; you may not use 
carlos@0
     7
 * this file except in compliance with the License. 
carlos@0
     8
 * You may obtain a copy of the License at  
carlos@0
     9
 * http://www.openbravo.com/legal/license.txt 
carlos@0
    10
 * Software distributed under the License is distributed on an 
carlos@0
    11
 * "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or 
carlos@0
    12
 * implied. See the License for the specific language governing rights 
carlos@0
    13
 * and  limitations under the License. 
carlos@0
    14
 * The Original Code is Openbravo ERP. 
ggi@6702
    15
 * The Initial Developer of the Original Code is Openbravo SLU 
carlos@33710
    16
 * All portions are Copyright (C) 2005-2018 Openbravo SLU 
carlos@0
    17
 * All Rights Reserved. 
ggi@6702
    18
 * Contributor(s): Openbravo S.L.U.
carlos@0
    19
 ************************************************************************
carlos@0
    20
-->
juanpablo@213
    21
juanpablo@213
    22
<!--
ivan@1738
    23
List of methods infside:
juanpablo@213
    24
juanpablo@213
    25
init: creates all the folders.
juanpablo@213
    26
trl.clean: clean the AD_TEXTINTERFACES table
juanpablo@213
    27
clean: delete all folders.
juanpablo@213
    28
sqlc: generates the java from the xsql files.
juanpablo@213
    29
compileSqlc: compiles all the java generated from the xsqls.
juanpablo@213
    30
wad: generates all the files from the mda.
juanpablo@213
    31
postwad: copies the generated files to the base design folder.
juanpablo@213
    32
postsrc: copies the src files to the base design folder and the 
juanpablo@213
    33
         xml and jasper files to the translated designs folders
asier@1929
    34
postsrc.modules: it does the same as postsrc but for module files
juanpablo@213
    35
build.local.context: copies all files to the eclipse base context 
juanpablo@213
    36
                     (WebContent...).
juanpablo@213
    37
compile.src: comiles only the src files.
juanpablo@213
    38
compile: compiles specified WAD window and src and also translates.
juanpablo@213
    39
compile.complete: compiles all WAD windows and src and also translates.
juanpablo@213
    40
translate: Translate the modified files.
juanpablo@213
    41
installWebService: install the web services configuration file.
juanpablo@213
    42
uninstallWebService: uninstall the web services configuration file.
juanpablo@213
    43
copy.files: copy the local files to the context.
juanpablo@213
    44
compile.development: like compile, but also copies the files to the context.
juanpablo@213
    45
compile.complete.development: like compile.complete, but also copies the files 
juanpablo@213
    46
                              to the context.
asier@1929
    47
compile.web: re-builds the web folder.
asier@1929
    48
compile.web.development: like compile.web, but also copies the files to the context.
juanpablo@213
    49
build.war: build a war file in the lib directory.
juanpablo@213
    50
-->
juanpablo@213
    51
carlos@0
    52
<project name="openbravo sources" default="compile" basedir=".">
stefan@2143
    53
martin@2868
    54
  <taskdef name="yuicompress" classname="com.yahoo.platform.yui.compressor.YUICompressTask">
ivan@6262
    55
    <classpath>
ivan@6262
    56
      <pathelement location="${base.lib}/build/yuicompressor-2.4.2.jar" />
ivan@6262
    57
      <pathelement location="${base.lib}/build/ob-rhino-1.6R7.jar" />
ivan@6262
    58
      <pathelement location="${base.lib}/build/YUIAnt.jar" />
ivan@6262
    59
    </classpath>
martin@2868
    60
  </taskdef>
stefan@2143
    61
martin@2868
    62
  <condition property="minimizeJSandCSSbool">
martin@2868
    63
    <istrue value="${minimizeJSandCSS}" />
martin@2868
    64
  </condition>
stefan@2143
    65
martin@2868
    66
  <property name="webTab" value="all" />
martin@2868
    67
  <property name="tab" value="%" />
asier@1929
    68
martin@2868
    69
  <property name="base.translate.structure" value="org/openbravo/erpWindows" />
martin@2868
    70
  <property name="src" value="." />
martin@2868
    71
  <property name="tr" value="yes" />
asier@30503
    72
asier@30503
    73
  <condition property="exclude.cdi">
asier@30503
    74
    <equals arg1="wildfly" arg2="${application.server}" />
asier@30503
    75
  </condition>
asier@30503
    76
martin@2868
    77
  <condition property="translation">
martin@2868
    78
    <not>
martin@2868
    79
      <equals arg1="no" arg2="${tr}" />
martin@2868
    80
    </not>
martin@2868
    81
  </condition>
martin@2868
    82
  <target name="init">
martin@2868
    83
    <mkdir dir="${build}" />
martin@2868
    84
    <mkdir dir="${base.design}/design" />
martin@2868
    85
    <mkdir dir="${build.sqlc}/src" />
martin@2868
    86
    <mkdir dir="${build.sqlc}/srcAD" />
martin@2868
    87
    <mkdir dir="${build.AD}/org/openbravo/erpWindows" />
martin@2868
    88
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/ad_actionButton" />
martin@2868
    89
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/ad_callouts" />
martin@2868
    90
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/reference" />
martin@2868
    91
  </target>
antonio@5620
    92
  <macrodef name="updatesystemstatus">
antonio@5620
    93
     <attribute name="v" default="NOT SET"/>
antonio@5620
    94
     <sequential>
antonio@5620
    95
       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
antonio@5621
    96
         <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
antonio@5621
    97
         <transaction> UPDATE ad_system_info SET system_status='@{v}' ;
antonio@5621
    98
                       DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)
antonio@5621
    99
         </transaction>
antonio@5620
   100
       </sql>
antonio@5620
   101
     </sequential>
antonio@5620
   102
  </macrodef>
carlos@0
   103
martin@2868
   104
  <target name="validate.database">
martin@2868
   105
    <taskdef name="validateDatabase" classname="org.openbravo.service.system.SystemValidationTask">
martin@2868
   106
      <classpath refid="project.class.path" />
martin@2868
   107
    </taskdef>
martin@5458
   108
    <validateDatabase userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="database" />
martin@2868
   109
  </target>
carlos@0
   110
martin@2868
   111
  <target name="validate.modules">
martin@2868
   112
    <taskdef name="validateModules" classname="org.openbravo.service.system.SystemValidationTask">
martin@2868
   113
      <classpath refid="project.class.path" />
martin@2868
   114
    </taskdef>
asier@5709
   115
    <validateModules userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" moduleJavaPackage="${module}"/>
martin@2868
   116
  </target>
antonio@18802
   117
martin@2868
   118
  <target name="trl.clean" if="translation">
martin@2868
   119
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@32644
   120
      <arg line="'${base.config}/Openbravo.properties' clean" />
martin@2868
   121
      <classpath refid="project.class.path" />
antonio@7592
   122
      <syspropertyset>
antonio@7592
   123
         <propertyref name="java.security.egd" />
antonio@7592
   124
      </syspropertyset>
martin@2868
   125
    </java>
martin@2868
   126
  </target>
asier@5937
   127
  
asier@5937
   128
  <target name="trl.remove.unused" if="translation">
asier@5937
   129
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@32644
   130
      <arg line="'${base.config}/Openbravo.properties' remove" />
asier@5937
   131
      <classpath refid="project.class.path" />
antonio@7592
   132
      <syspropertyset>
antonio@7592
   133
         <propertyref name="java.security.egd" />
antonio@7592
   134
      </syspropertyset>
asier@5937
   135
    </java>
asier@5937
   136
  </target>
martin@2346
   137
martin@2868
   138
  <target name="clean" depends="trl.clean">
martin@2868
   139
    <property name="complete" value="true" />
martin@2868
   140
    <delete includeEmptyDirs="true" failonerror="false">
martin@2868
   141
      <fileset dir="${base.design}" />
martin@2868
   142
      <fileset dir="${build}" />
martin@2868
   143
      <fileset dir="${build.docs}" />
martin@2868
   144
      <fileset dir="${build.AD}" />
martin@2868
   145
      <fileset dir="${build.sqlc}" />
martin@2868
   146
      <fileset dir="${base.context}">
martin@2868
   147
        <exclude name=".svn" />
martin@2868
   148
        <exclude name="META-INF/MANIFEST.MF" />
juanpablo@3236
   149
        <exclude name="**/.keep" />
martin@2868
   150
      </fileset>
martin@2868
   151
    </delete>
martin@2868
   152
  </target>
carlos@0
   153
antonio@7539
   154
  <target name="compile.apply.module" depends="init">
antonio@7545
   155
    <mkdir dir="${build.apply.module}" />
antonio@7539
   156
    <java classname="org.openbravo.data.Sqlc" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" failonerror="true">
antonio@7539
   157
      <arg line="'${base.config}'/Openbravo.properties .xsql . '${build.sqlc}'/src" />
stefan@15451
   158
      <jvmarg value="-Dsqlc.listOfFiles=ApplyModule_data.xsql,PInstanceProcess_data.xsql,Translation_data.xsql,MessageBD_data.xsql"/>
antonio@7539
   159
      <classpath refid="project.class.path" />
antonio@7592
   160
      <syspropertyset>
antonio@7592
   161
         <propertyref name="java.security.egd" />
antonio@7592
   162
      </syspropertyset>
antonio@7539
   163
    </java>
stefan@11995
   164
    <javac includes="org/openbravo/erpCommon/modules/ApplyModuleTask.java" destdir="${build.apply.module}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on" verbose="false" nowarn="${friendlyWarnings}" includeantruntime="false" >
antonio@7539
   165
      <src path="${base.src}"/>
antonio@7539
   166
      <src path="../build/javasqlc/src"/>
antonio@7545
   167
      <src path="../src-gen"/>
carlos@33983
   168
      <src path="../modules/org.openbravo.base.weld/src/"/>
antonio@7547
   169
      <classpath refid="apply.module.compile.classpath" />
antonio@7539
   170
    </javac>
antonio@7539
   171
  </target>
antonio@7539
   172
  
stefan@12082
   173
  <target name="sqlc">
asier@3189
   174
    <java classname="org.openbravo.data.Sqlc" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" failonerror="true">
martin@2868
   175
      <arg line="'${base.config}'/Openbravo.properties .xsql . '${build.sqlc}'/src" />
martin@2868
   176
      <classpath refid="project.class.path" />
antonio@7592
   177
      <syspropertyset>
antonio@7592
   178
         <propertyref name="java.security.egd" />
antonio@7592
   179
      </syspropertyset>
martin@2868
   180
    </java>
asier@3189
   181
    <java classname="org.openbravo.data.Sqlc" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" failonerror="true">
martin@2868
   182
      <arg line="'${base.config}'/Openbravo.properties .xsql '${base.modules}' '${build.sqlc}'/src */src" />
stefan@5227
   183
      <jvmarg value="-Dsqlc.queryExecutionStrategy=traditional"/>
martin@2868
   184
      <classpath refid="project.class.path" />
antonio@7592
   185
      <syspropertyset>
antonio@7592
   186
         <propertyref name="java.security.egd" />
antonio@7592
   187
      </syspropertyset>
martin@2868
   188
    </java>
martin@2868
   189
    <copy file="${base.src}/buildAD.xml" tofile="${build.AD}/build.xml" />
martin@2868
   190
    <copy file="${base.src}/log4j.lcf" tofile="${build.AD}/log4j.lcf" />
martin@2868
   191
    <ant dir="${build.AD}" target="buildAD" inheritAll="true" inheritRefs="true" />
martin@2868
   192
  </target>
carlos@0
   193
martin@2868
   194
  <target name="clean.src.gen">
martin@2868
   195
    <delete includeEmptyDirs="true" failonerror="false">
juanpablo@3236
   196
      <fileset dir="${base.src.gen}" >
juanpablo@3236
   197
        <exclude name="**/.keep" />
juanpablo@3236
   198
      </fileset>
martin@2868
   199
    </delete>
martin@2868
   200
  </target>
martin@2868
   201
stefan@11851
   202
  <!-- full generate.entities -> clean + .quick -->
stefan@11851
   203
  <target name="generate.entities" depends="clean.src.gen,generate.entities.quick" />
martin@2830
   204
martin@2868
   205
  <!-- 
martin@2830
   206
		Generates entities only when the application dictionary has changed.
martin@2830
   207
		Difference with the generate.entities is that it does not clean the src-gen directory. The standard
martin@2830
   208
		GenerateEntitiesTask always checks if the AD was changed before regenerating. The check is to compare
martin@2830
   209
		the modified time of the generated sources with the updated time of the Application Dictionary. If there
martin@2830
   210
		is a source older than the last updated time of the Application Dictionary then the sources need to be regenerated.		
martin@2830
   211
	-->
martin@2868
   212
  <target name="generate.entities.quick" depends="compile.src.gen">
stefan@11851
   213
    <java classname="org.openbravo.base.gen.GenerateEntitiesTask" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" failonerror="true">
stefan@11851
   214
      <arg line="'${base.src}' '${friendlyWarnings}'" />
stefan@11851
   215
      <classpath refid="project.class.path" />
antonio@7592
   216
      <syspropertyset>
antonio@7592
   217
         <propertyref name="java.security.egd" />
antonio@7592
   218
      </syspropertyset>
stefan@11851
   219
    </java>
stefan@11851
   220
      <!--
stefan@11851
   221
        see issue: https://issues.openbravo.com/view.php?id=9331
stefan@11851
   222
        Custom columns in standard tables should support a reference to a table in the module
stefan@11851
   223
        if this occurs then possible the following javac has to be enabled instead of the two javacs below
stefan@11851
   224
      <javac srcdir="${base.src}:${base.src.gen}" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on">
stefan@11851
   225
        <classpath refid="project.class.path" />      
stefan@11851
   226
      </javac>
stefan@11851
   227
      -->
carlos@33979
   228
      <javac srcdir="${base.src}:${base.src.gen}:${base.modules}" includes="org/openbravo/model/**,org/openbravo/base/structure/**,org/openbravo/dal/**,org/openbravo/service/dataset/**,*/src/**/base/weld/**" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" deprecation="on" includeantruntime="false">
stefan@11851
   229
        <classpath refid="project.class.path" />      
stefan@11851
   230
      </javac>
stefan@11995
   231
      <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" includeantruntime="false">
stefan@11851
   232
        <classpath refid="project.class.path" />
stefan@11851
   233
      </javac>
stefan@11851
   234
  </target>
martin@4106
   235
stefan@11851
   236
  <!-- build-internal forking helper -->
stefan@11851
   237
  <target name="generate.entities.quick.forked" depends="compile.src.gen">
stefan@11852
   238
    <taskdef name="workflow" classpathref="project.class.path" classname="org.openbravo.base.gen.GenerateEntitiesTask" />
stefan@11851
   239
    <workflow friendlyWarnings="${friendlyWarnings}" srcGenPath="${base.src.gen}" propertiesFile="${base.config}/Openbravo.properties" />
asier@24247
   240
  </target> 
priya@6948
   241
antonio@16458
   242
  <path id="my-src-dirs">
antonio@16458
   243
    <pathelement path="${basedir}" />
antonio@16458
   244
    <pathelement path="${build.sqlc}/src" />
antonio@16458
   245
    <pathelement path="${build.sqlc}/srcAD" />
antonio@16458
   246
    <dirset dir="${base.modules}">
stefan@17945
   247
      <include name="*/src" />
antonio@16458
   248
    </dirset>
antonio@16458
   249
  </path>
antonio@16458
   250
 
martin@2868
   251
  <target name="compileSqlc" depends="sqlc">
antonio@16458
   252
    <javac excludes="*/src-wad/**,*/src-util/**,**/org/openbravo/erpWindows/**" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" nowarn="${friendlyWarnings}" includeantruntime="false">
antonio@16458
   253
      <src refid="my-src-dirs"/>
antonio@16458
   254
      <classpath refid="project.class.path" />
antonio@16458
   255
    </javac>
antonio@16458
   256
antonio@16458
   257
    <javac srcdir="${build.sqlc}/srcAD" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" nowarn="${friendlyWarnings}" includeantruntime="false">
asier@2967
   258
      <classpath refid="project.class.path" />
asier@2967
   259
    </javac>
antonio@6986
   260
stefan@11995
   261
    <javac srcdir="${build.AD}" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="true" debuglevel="lines,vars,source" nowarn="${friendlyWarnings}" includeantruntime="false">
martin@2868
   262
      <classpath refid="project.class.path" />
martin@2868
   263
    </javac>
martin@2868
   264
  </target>
antonio@5595
   265
martin@2868
   266
  <target name="compile.src.gen" depends="init">
stefan@11995
   267
    <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" includeantruntime="false">
martin@2868
   268
      <classpath refid="project.class.path" />
martin@2868
   269
    </javac>
martin@2868
   270
    <copy todir="${build}">
stefan@32772
   271
      <fileset dir="${basedir}">
stefan@32772
   272
        <include name="**/*.hbm.xml" />
stefan@32772
   273
        <include name="**/*.properties" />
stefan@32772
   274
      </fileset>
martin@2868
   275
    </copy>
martin@6163
   276
    
martin@6163
   277
    <!-- also compile the domaintypes in modules -->
stefan@11995
   278
    <javac srcdir="${basedir}/../" includes="modules/*/src/**/model/domaintype/**/*.java" destdir="${build}"  fork="true" deprecation="on" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" includeantruntime="false">
martin@6163
   279
      <classpath refid="project.class.path" />
martin@6163
   280
    </javac>
martin@6163
   281
    
martin@6163
   282
    <!-- copy all configuration files in modules to the output path also -->
martin@6163
   283
    <copy todir="${build}" encoding="UTF-8">
martin@6163
   284
      <fileset dir="${base.modules}">
martin@6163
   285
          <include name="*/src/**/*" />
martin@6163
   286
          <exclude name="*/src/**/*.java" />
martin@6163
   287
          <exclude name="*/src/**/*.xsql" />
martin@6163
   288
      </fileset>
martin@6163
   289
      <mapper type="regexp" from="(.*\${file.separator}src)(.*)" to="\2" />
martin@6163
   290
    </copy>
martin@2868
   291
  </target>
martin@2346
   292
asier@5532
   293
  <target name="wadvalidation">
asier@5535
   294
    <taskdef name="WADValidation" classname="org.openbravo.wad.validation.WADValidatorTask">
asier@5532
   295
            <classpath refid="project.class.path" />
asier@5532
   296
          </taskdef>
asier@5532
   297
        
asier@5532
   298
        <WADValidation propertiesFile="${base.config}/Openbravo.properties"
asier@5532
   299
                       modules="${module}"
antonio@5700
   300
                       stoponerror="${stopOnWadError}"
antonio@5700
   301
                       friendlyWarnings="${friendlyWarnings}"/>
asier@5532
   302
  </target>
asier@5532
   303
  
asier@5532
   304
  <target name="wad" depends="init, wadvalidation">
asier@5265
   305
    <java classname="org.openbravo.wad.Wad" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}" failonerror="true">
asier@30507
   306
      <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}' 'dummyValueUnused' '..' '${attach.path}' '${web.url}' '${base.src}' '${complete}' '${module}' 'noquick' '${wad.generateAllClassic250Windows}' '${exclude.cdi}'" />
stefan@9230
   307
      <classpath refid="wad.class.path" />
antonio@7592
   308
      <syspropertyset>
antonio@7592
   309
         <propertyref name="java.security.egd" />
antonio@7592
   310
      </syspropertyset>
martin@2868
   311
    </java>
martin@2868
   312
    <antcall target="postwad" inheritall="true" inheritrefs="true" />
martin@2868
   313
  </target>
martin@2346
   314
asier@5532
   315
  <target name="wad.quick" depends="init, wadvalidation">
martin@2868
   316
    <java classname="org.openbravo.wad.Wad" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@30507
   317
      <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}' 'dummyValueUnused' '..' '${attach.path}' '${web.url}' '${base.src}' '${complete}' '${module}' 'quick' '${wad.generateAllClassic250Windows}' '${exclude.cdi}'" />
stefan@9230
   318
      <classpath refid="wad.class.path" />
antonio@7592
   319
      <syspropertyset>
antonio@7592
   320
         <propertyref name="java.security.egd" />
antonio@7592
   321
      </syspropertyset>
martin@2868
   322
    </java>
martin@2868
   323
    <antcall target="postwad" inheritall="true" inheritrefs="true" />
martin@2868
   324
  </target>
asier@1929
   325
martin@2868
   326
  <target name="postsrc" depends="postsrc.modules">
antonio@5620
   327
martin@2868
   328
    <copy todir="${build}">
stefan@32772
   329
      <fileset dir="${basedir}">
stefan@32772
   330
        <include name="**/*.properties" />
stefan@32772
   331
        <include name="**/*.xslt" />
stefan@32772
   332
        <include name="**/*.hbm.xml" />
stefan@32772
   333
        <include name="**/*.ftl" />
stefan@32772
   334
      </fileset>
asier@19912
   335
    </copy>
martin@2868
   336
    <copy todir="${base.design}/design">
stefan@32772
   337
      <fileset dir="${basedir}">
stefan@32772
   338
        <include name="**/*.xml" />
stefan@32772
   339
        <include name="**/*.fo" />
stefan@32772
   340
        <include name="**/*.html" />
stefan@32772
   341
        <include name="**/*.srpt" />
stefan@32772
   342
        <include name="**/*.jrxml" />
stefan@32772
   343
        <include name="**/*.jasper" />
stefan@32772
   344
      </fileset>
martin@2868
   345
    </copy>
martin@2868
   346
    <copy todir="${build}">
martin@2868
   347
      <fileset file="${base.config}/quartz.properties" />
martin@2868
   348
    </copy>
asier@8385
   349
    <copy todir="${base.design}/design/org/openbravo/erpCommon/obps" file="${basedir}/org/openbravo/erpCommon/obps/licenseRestrictions"/>
martin@2868
   350
    <antcall target="build.local.context" inheritAll="true" inheritrefs="true" />
martin@2868
   351
  </target>
asier@1929
   352
martin@2868
   353
  <target name="postsrc.modules">
martin@2868
   354
    <copy todir="${base.design}/design">
martin@2868
   355
      <fileset dir="${base.modules}">
martin@2868
   356
        <include name="*/src/**/*.xml" />
martin@2868
   357
        <include name="*/src/**/*.fo" />
martin@2868
   358
        <include name="*/src/**/*.html" />
martin@2868
   359
        <include name="*/src/**/*.srpt" />
martin@2868
   360
        <include name="*/src/**/*.jrxml" />
martin@2868
   361
        <include name="*/src/**/*.jasper" />
martin@2868
   362
      </fileset>
martin@2868
   363
      <mapper type="regexp" from="(.*\${file.separator}src)(.*)" to="\2" />
martin@2868
   364
    </copy>
martin@6160
   365
    <copy todir="${build}">
martin@6160
   366
      <fileset dir="${base.modules}">
martin@6160
   367
        <include name="*/src/**" />
martin@6160
   368
        <exclude name="*/src/**/*.java" />
martin@6160
   369
      </fileset>
martin@6160
   370
      <mapper type="regexp" from="(.*\${file.separator}src)(.*)" to="\2" />
martin@6160
   371
    </copy>
martin@2868
   372
  </target>
asier@1929
   373
martin@2868
   374
  <!-- end of auxiliar tasks-->
martin@2346
   375
martin@2868
   376
  <target name="build.local.context">
martin@2868
   377
    <copy todir="${base.context}" encoding="UTF-8">
ivan@10243
   378
      <fileset file="${basedir}/index.jsp" />
martin@2868
   379
    </copy>
martin@2868
   380
    <copy todir="${base.context}/WEB-INF" encoding="UTF-8">
martin@2868
   381
      <fileset file="${build.sqlc}/src/web.xml" />
martin@2868
   382
      <fileset dir="${base.config}">
martin@2868
   383
        <exclude name="**/eclipse/**" />
martin@2868
   384
        <exclude name="**/setup-properties**" />
martin@2868
   385
        <exclude name="*.template" />
asier@2974
   386
        <exclude name="checksums"/>
martin@2868
   387
      </fileset>
martin@2868
   388
    </copy>
martin@2868
   389
    <copy todir="${base.context}/WEB-INF" encoding="UTF-8">
martin@2868
   390
      <fileset dir="${base.modules}">
martin@2868
   391
        <include name="*/config/**" />
martin@2868
   392
        <exclude name="*.template" />
martin@2868
   393
      </fileset>
martin@2868
   394
      <mapper type="regexp" from="(.*\${file.separator}config)(.*)" to="\2" />
martin@2868
   395
    </copy>
martin@2868
   396
    <copy todir="${base.context}/WEB-INF/lib" encoding="UTF-8">
martin@2868
   397
      <fileset dir="${base.lib}/runtime">
martin@2868
   398
        <exclude name="openbravo-wad.jar" />
martin@2868
   399
        <exclude name="openbravo-trl.jar" />
martin@2868
   400
        <exclude name="*.war" />
martin@2868
   401
      </fileset>
martin@2868
   402
      <fileset dir="${base.db}/lib">
martin@2868
   403
        <include name="*" />
martin@2868
   404
      </fileset>
martin@2868
   405
    </copy>
martin@2346
   406
martin@2868
   407
    <copy todir="${base.context}/WEB-INF/lib" encoding="UTF-8">
martin@2868
   408
      <fileset dir="${base.modules}">
martin@2868
   409
        <include name="*/lib/runtime/**" />
asier@30503
   410
        <exclude if="exclude.cdi" name="org.openbravo.base.weld/lib/runtime/weld*"/>
asier@30503
   411
        <exclude if="exclude.cdi" name="org.openbravo.base.weld/lib/runtime/*api*"/>
asier@30503
   412
        <exclude if="exclude.cdi" name="org.openbravo.base.weld/lib/runtime/javax*"/>
martin@2868
   413
      </fileset>
martin@2868
   414
      <mapper type="regexp" from="(.*\${file.separator}lib\${file.separator}runtime)(.*)" to="\2" />
martin@2868
   415
    </copy>
asier@34761
   416
asier@34763
   417
    <copy todir="${base.context}/WEB-INF/referencedata/standard/org.openbravo">
asier@34761
   418
      <fileset dir="${basedir}/../referencedata/standard">
asier@34761
   419
        <include name="*.xml" />
asier@34761
   420
      </fileset>
asier@34761
   421
    </copy>
asier@34761
   422
asier@34763
   423
    <copy todir="${base.context}/WEB-INF/referencedata">
asier@34761
   424
      <fileset dir="${base.modules}">
asier@34761
   425
        <include name="*/referencedata/standard/*.xml" />
asier@34762
   426
        <include name="*/referencedata/accounts/COA.csv" />
asier@34761
   427
      </fileset>
asier@34765
   428
      <mapper type="regexp" from="(.*\${file.separator})referencedata\${file.separator}(standard|accounts)\${file.separator}(.*)" to="\2/\1\3" />
asier@34761
   429
    </copy>
asier@34761
   430
martin@2868
   431
    <antcall target="build.web.folder" inheritAll="true" inheritrefs="true" />
martin@2868
   432
  </target>
martin@2346
   433
martin@2868
   434
  <target name="build.web.folder">
martin@2868
   435
    <copy todir="${base.context}/web" encoding="UTF-8">
martin@2868
   436
      <fileset dir="${base.web}">
martin@2868
   437
        <include name="*/**" />
martin@2868
   438
        <exclude name="skins/**" />
martin@2868
   439
      </fileset>
martin@2868
   440
    </copy>
asier@2994
   441
    
asier@2994
   442
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
asier@2994
   443
        <classpath refid="project.class.path" />
asier@2994
   444
      </taskdef>
asier@2994
   445
    
asier@2994
   446
    <CheckSumCondition obDir="${basedir}/.."
asier@2994
   447
                       type="md5.skins"
asier@2994
   448
                       property="changes.in.md5.skins"/>
asier@2994
   449
    <condition property="do.skins">
asier@2994
   450
      <or>
asier@2994
   451
        <istrue value="${changes.in.md5.skins}" />
asier@2994
   452
        <not>
asier@3013
   453
          <istrue value="${smart.mode}"/>
asier@2994
   454
        </not>
augusto@15962
   455
        <not>
augusto@15962
   456
          <available file="${base.context}/web/skins/rtl" type="dir"/>
augusto@15962
   457
        </not>
augusto@15962
   458
        <not>
augusto@15962
   459
          <available file="${base.context}/web/skins/ltr" type="dir"/>
augusto@15962
   460
        </not>
asier@2994
   461
      </or>
asier@2994
   462
    </condition>
asier@2994
   463
    
asier@2994
   464
    <antcall target="build.web.folder.skins"  inheritAll="true" inheritrefs="true" />
asier@2994
   465
    
asier@2994
   466
    <antcall target="minimizeJSandCSS" inheritAll="true" inheritrefs="true" />
asier@2994
   467
  </target>
asier@2994
   468
    
asier@9013
   469
  
asier@9013
   470
  <target name="build.web.folder.base">
asier@9013
   471
    <mkdir dir="${base.context}/web" />
asier@9013
   472
    <copy todir="${base.context}/web" encoding="UTF-8">
asier@9013
   473
      <fileset dir="${base.modules}">
asier@9013
   474
        <include name="*/web/*/**" />
asier@9013
   475
        <exclude name="*/web/*/skins/**" />
asier@9013
   476
      </fileset>
augusto@16403
   477
      <mapper type="regexp" from="(.*)(\${file.separator}web)(\${file.separator}.*)" to="\3" />
asier@9013
   478
    </copy>
asier@9013
   479
  </target>
martin@2346
   480
asier@2994
   481
  <target name="build.web.folder.skins" if="do.skins">
asier@2994
   482
asier@2994
   483
    <delete includeEmptyDirs="true" dir="${base.context}/web/skins" quiet="yes" />
martin@2868
   484
    <mkdir dir="${base.context}/web/skins/ltr" />
martin@2868
   485
    <copy todir="${base.context}/web/skins/ltr" encoding="UTF-8">
martin@2868
   486
      <fileset dir="${base.web}/skins" />
martin@2868
   487
    </copy>
martin@2868
   488
    <mkdir dir="${base.context}/web/skins/rtl" />
martin@2868
   489
    <copy todir="${base.context}/web/skins/rtl" encoding="UTF-8">
martin@2868
   490
      <fileset dir="${base.web}/skins" />
martin@2868
   491
    </copy>
martin@2346
   492
asier@9013
   493
    <antcall target="build.web.folder.base" />
martin@2346
   494
martin@2868
   495
    <copy todir="${base.context}/web/skins/ltr" encoding="UTF-8">
martin@2868
   496
      <fileset dir="${base.modules}">
david@5270
   497
        <include name="*/web/*/skins/**" />
martin@2868
   498
      </fileset>
asier@3604
   499
      <mapper type="regexp" from="(.*)(\${file.separator}web)(.*\${file.separator})(skins\${file.separator})(.*)" to="\3\5" />
martin@2868
   500
    </copy>
carlos@0
   501
martin@2868
   502
    <copy todir="${base.context}/web/skins/rtl" encoding="UTF-8">
martin@2868
   503
      <fileset dir="${base.modules}">
david@5270
   504
        <include name="*/web/*/skins/**" />
martin@2868
   505
      </fileset>
asier@3604
   506
      <mapper type="regexp" from="(.*)(\${file.separator}web)(.*\${file.separator})(skins\${file.separator})(.*)" to="\3\5" />
martin@2868
   507
    </copy>
stefan@2143
   508
martin@2868
   509
    <java classname="org.openbravo.translate.RTLSkin" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
david@3771
   510
      <arg line="${base.context}/web/skins/rtl ${base.context}/web/skins/ltr" />
martin@2868
   511
      <classpath refid="project.class.path" />
martin@2868
   512
    </java>
asier@2994
   513
    
martin@2868
   514
  </target>
juanpablo@131
   515
martin@2868
   516
  <target name="minimizeJSandCSS" description="minimize JS and CSS files" if="minimizeJSandCSSbool">
martin@2868
   517
    <yuicompress linebreak="300" warn="false" munge="yes" preserveallsemicolons="true" outputfolder="${base.context}/web" charset="UTF-8">
martin@2868
   518
      <fileset dir="${base.web}">
martin@2868
   519
        <include name="**/*.js" />
martin@2868
   520
        <include name="**/*.css" />
martin@2868
   521
        <!-- The following scripts break in minification process -->
martin@2868
   522
        <exclude name="**/js/dojo/src/docs.js" />
martin@2868
   523
        <exclude name="**/js/dojo/src/hostenv_jsc.js" />
martin@2868
   524
        <exclude name="**/js/jscalendar/lang/calendar-al.js" />
martin@2868
   525
        <exclude name="**/js/jscalendar/lang/calendar-he-utf8.js" />
martin@2868
   526
        <exclude name="**/js/jscalendar/lang/calendar-hr.js" />
martin@2868
   527
        <!-- dojotoolkit files are already compressd -->
martin@2868
   528
        <exclude name="**/dojotoolkit/**" />
martin@2868
   529
        <!-- from old dojo, only compress main file -->
martin@2868
   530
        <exclude name="**/dojo/**" />
martin@2868
   531
        <include name="js/dojo/dojo.js" />
martin@2868
   532
      </fileset>
martin@2868
   533
    </yuicompress>
martin@2868
   534
  </target>
david@1883
   535
martin@2868
   536
  <target name="postwad">
martin@2868
   537
    <copy todir="${base.design}/design">
stefan@32772
   538
      <fileset dir="${build.AD}">
stefan@32772
   539
        <include name="**/*.xml" />
stefan@32772
   540
        <include name="**/*.fo" />
stefan@32772
   541
        <include name="**/*.html" />
stefan@32772
   542
        <include name="**/*.srpt" />
stefan@32772
   543
        <include name="**/*.jrxml" />
stefan@32772
   544
        <include name="**/*.jasper" />
stefan@32772
   545
      </fileset>
martin@2868
   546
    </copy>
martin@2868
   547
  </target>
martin@2346
   548
martin@2868
   549
  <target name="compile.src" depends="compileSqlc, postsrc, copy.files">
martin@2868
   550
  </target>
martin@2868
   551
asier@5937
   552
  <target name="compile.complete" depends="clean,generate.entities,wad,compileSqlc,postsrc,translate, trl.remove.unused">
martin@2868
   553
    <antcall target="update.build.timestamp" />
martin@2868
   554
  </target>
martin@2868
   555
martin@2868
   556
asier@3013
   557
  <target name="smartbuild.new.wad" if="new.wad">
martin@2868
   558
    <antcall inheritall="true" inheritrefs="true" target="wad" />
asier@2854
   559
    <taskdef name="updateWADmd5" classname="org.openbravo.utils.WADCheckSumTask">
asier@2854
   560
      <classpath refid="project.class.path" />
asier@2854
   561
    </taskdef>
martin@2868
   562
    <updateWADmd5 obDir="${basedir}/.." />
martin@2868
   563
  </target>
asier@2854
   564
asier@3013
   565
  <target name="smartbuild.no.new.wad" unless="new.wad">
martin@2868
   566
    <antcall inheritall="true" inheritrefs="true" target="wad.quick" />
asier@2974
   567
  </target>
asier@2974
   568
asier@3013
   569
  <target name="smartbuild">
asier@3013
   570
    <antcall inheritall="true" inheritrefs="true" target="smartbuild.new.wad" />
asier@3013
   571
    <antcall inheritall="true" inheritrefs="true" target="smartbuild.no.new.wad" />
martin@2868
   572
    <antcall inheritall="true" inheritrefs="true" target="compileSqlc" />
martin@2868
   573
    <antcall inheritall="true" inheritrefs="true" target="postsrc" />
asier@9013
   574
    <antcall inheritall="true" inheritrefs="true" target="build.web.folder.base" />
martin@2868
   575
    <antcall inheritall="true" inheritrefs="true" target="translate" />
martin@2868
   576
    <antcall inheritall="true" inheritrefs="true" target="update.build.timestamp" />
martin@2868
   577
  </target>
carlos@0
   578
martin@2868
   579
  <target name="translate" if="translation">
martin@2868
   580
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@32644
   581
      <arg line="'${base.config}/Openbravo.properties' '${basedir}/..'" />
martin@2868
   582
      <classpath refid="project.class.path" />
antonio@7592
   583
      <syspropertyset>
antonio@7592
   584
         <propertyref name="java.security.egd" />
antonio@7592
   585
      </syspropertyset>
martin@2868
   586
    </java>
martin@2868
   587
  </target>
carlos@0
   588
asier@32644
   589
  <target name="compile" depends="wad,compileSqlc, postsrc, translate">
asier@32644
   590
  </target>
asier@32644
   591
martin@2868
   592
  <target name="installWebService" depends="init" if="wsdd">
asier@4307
   593
    <taskdef name="wsAdmin" classname="org.openbravo.erpCommon.utility.WebServiceAdmin">
martin@2868
   594
      <classpath refid="project.class.path" />
asier@4307
   595
    </taskdef>
asier@4307
   596
    <wsAdmin axisServlet="${context.url}/servlet/AxisServlet"
asier@4307
   597
             baseDir="${source.path}"
asier@4307
   598
             action="deploy"/>
martin@2868
   599
  </target>
carlos@0
   600
asier@4307
   601
  <target name="uninstallWebService" depends="init">
asier@4307
   602
    <taskdef name="wsAdmin" classname="org.openbravo.erpCommon.utility.WebServiceAdmin">
asier@4307
   603
      <classpath refid="project.class.path" />
asier@4307
   604
    </taskdef>
asier@4307
   605
    <wsAdmin axisServlet="${context.url}/servlet/AxisServlet"
asier@4307
   606
             baseDir="${source.path}"
asier@4307
   607
             action="undeploy"/>
asier@4307
   608
  </target>
carlos@0
   609
stefan@9978
   610
  <!-- Note (see issue 15709 for details):
stefan@9978
   611
       orphan jarfiles are not deleted from the webapp as deployed in tomcat when
stefan@9978
   612
       this rebuild is running inside the rebuild UI (started from MMC). See also the related
stefan@9978
   613
       copy.files.jarsync(.do) task which does this deletion between tomcat stop & start
stefan@9978
   614
   -->
stefan@9978
   615
  <target name="copy.files" depends="copy.files.jarsync.notinrebuildui" if="mode.class">
martin@2868
   616
    <mkdir dir="${jakarta.base}/webapps/${context.name}" />
antonio@7595
   617
    <sync todir="${jakarta.base}/webapps/${context.name}">
antonio@7595
   618
      <preserveintarget>
antonio@7595
   619
        <include name="**/WEB-INF/classes/**"/>
stefan@9052
   620
        <include name="**/WEB-INF/lib/**"/>
antonio@7595
   621
      </preserveintarget>
martin@2868
   622
      <fileset dir="${base.context}" />
antonio@7595
   623
    </sync>
martin@2868
   624
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/classes" />
antonio@7595
   625
    <sync todir="${jakarta.base}/webapps/${context.name}/WEB-INF/classes">
martin@2868
   626
      <fileset dir="${build}" />
antonio@7595
   627
    </sync>
asier@7208
   628
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" />
asier@7208
   629
      <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8">
asier@7208
   630
    </copy>
martin@2868
   631
  </target>
ivan@1738
   632
stefan@9978
   633
  <target name="copy.files.jarsync.notinrebuildui" unless="runningInRebuildUI">
stefan@9978
   634
    <antcall target="copy.files.jarsync.do"/>
stefan@9978
   635
  </target>
stefan@9978
   636
stefan@9978
   637
  <!-- sync jar files from WebContent -> deployed webapp & delete orphan jars from webapp
stefan@9978
   638
       as delete orphan is excluded from normal copy.files task -->
stefan@9978
   639
  <target name="copy.files.jarsync.do" if="mode.class">
stefan@9978
   640
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib"/>
stefan@9978
   641
    <sync todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib">
stefan@9978
   642
      <fileset dir="${base.context}/WEB-INF/lib" />
stefan@9978
   643
    </sync>
stefan@9978
   644
  </target>
stefan@9978
   645
martin@2868
   646
  <target name="compile.development" depends="generate.entities, compile, copy.files">
martin@2868
   647
  </target>
asier@1929
   648
martin@2868
   649
  <target name="compile.complete.development" depends="compile.complete, copy.files">
antonio@8136
   650
    <updatesystemstatus v="RB51"/>
martin@2868
   651
  </target>
asier@1929
   652
martin@2868
   653
  <target name="compile.web" depends="build.web.folder">
martin@2868
   654
  </target>
asier@1929
   655
martin@2868
   656
  <target name="compile.web.development" depends="build.web.folder, copy.files">
martin@2868
   657
  </target>
asier@1929
   658
martin@2868
   659
  <target name="build.war">
martin@2868
   660
    <delete failonerror="false" file="${base.lib}/${context.name}.war" />
martin@2868
   661
    <war compress="true" destfile="${base.lib}/${context.name}.war" encoding="UTF-8" webxml="${base.context}/WEB-INF/web.xml">
martin@2868
   662
      <zipfileset dir="${base.context}">
martin@2868
   663
        <exclude name="**/WEB-INF/web.xml" />
martin@2868
   664
      </zipfileset>
martin@2868
   665
      <classes dir="${build}" />
martin@2868
   666
    </war>
antonio@8136
   667
    <updatesystemstatus v="RB51"/>
martin@2868
   668
  </target>
martin@2868
   669
martin@2868
   670
  <target name="generate-wsdd">
martin@2868
   671
    <delete failonerror="false">
martin@2868
   672
      <fileset dir="${base.src}/org/openbravo/services/webservice" includes="**/*" />
martin@2868
   673
    </delete>
martin@2868
   674
martin@2868
   675
    <mkdir dir="${build}" />
asier@7861
   676
     <axis-wsdl2java output="${base.src}" verbose="false" url="http://centralrepository.openbravo.com/openbravo/services/WebService3?wsdl" serverside="true" debug="false">
asier@7861
   677
      <mapping namespace="http://centralrepository.openbravo.com/openbravo/services/WebService3" package="org.openbravo.services.webservice" />
asier@7861
   678
      <mapping namespace="/services/WebService3" package="org.openbravo.services.webservice" />
martin@2868
   679
    </axis-wsdl2java>
martin@2868
   680
  </target>
martin@2868
   681
antonio@3372
   682
  <target name="update.build.timestamp" unless="timestamp">
martin@2868
   683
    <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" delimiter="/">
martin@2868
   684
      <classpath>
martin@2868
   685
        <fileset dir="${base.lib}">
martin@2868
   686
          <include name="**/*.jar">
martin@2868
   687
          </include>
martin@2868
   688
        </fileset>
martin@2868
   689
      </classpath>
martin@2868
   690
      <transaction>
asier@2819
   691
	        UPDATE AD_SYSTEM_INFO SET LAST_BUILD=NOW()
asier@2819
   692
	      </transaction>
martin@2868
   693
    </sql>
martin@2868
   694
  </target>
asier@1929
   695
carlos@0
   696
</project>