build.xml
author Alvaro Ferraz <alvaro.ferraz@openbravo.com>
Mon, 01 Dec 2014 16:49:43 +0100
changeset 25493 1f26de8763c0
parent 25254 899242f8a5c7
child 25519 a8bd0fc47456
permissions -rw-r--r--
Fixes bug 28286 LandedCostLineAmt should always be created in the same order

In order to help JUnit tests assert landed cost, an orderBy clause has been added when creating Landed Cost Receipt Line Amount lines, to be always created in the same order.
asier@43
     1
<?xml version="1.0" encoding="UTF-8" ?>
asier@43
     2
<!--
juanpablo@1548
     3
*************************************************************************
juanpablo@1548
     4
* The contents of this file are subject to the Openbravo  Public  License
priya@9072
     5
* Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
juanpablo@1548
     6
* Version 1.1  with a permitted attribution clause; you may not  use this
juanpablo@1548
     7
* file except in compliance with the License. You  may  obtain  a copy of
juanpablo@1548
     8
* the License at http://www.openbravo.com/legal/license.html
juanpablo@1548
     9
* Software distributed under the License  is  distributed  on  an "AS IS"
juanpablo@1548
    10
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
juanpablo@1548
    11
* License for the specific  language  governing  rights  and  limitations
juanpablo@1548
    12
* under the License.
juanpablo@1548
    13
* The Original Code is Openbravo ERP.
ggi@6701
    14
* The Initial Developer of the Original Code is Openbravo SLU
asier@24247
    15
* All portions are Copyright (C) 2001-2014 Openbravo SLU
juanpablo@1548
    16
* All Rights Reserved.
juanpablo@1548
    17
* Contributor(s):  ______________________________________.
juanpablo@1548
    18
************************************************************************
asier@43
    19
-->
juanpablo@213
    20
<!--
juanpablo@213
    21
List of targets:
juanpablo@213
    22
juanpablo@213
    23
init: checks if exists the JAVA_HOME var.
juanpablo@213
    24
compile.complete: refer to compile.complete target of src.
juanpablo@213
    25
compile: refer to compile target of src.
juanpablo@213
    26
compile.complete.development: refer to compile.complete.development target of src.
juanpablo@213
    27
compile.development: refer to compile.development target of src.
asier@1929
    28
compile.web: refer to compile.web: target of src.
asier@1929
    29
compile.web.development: refer to compile.web.development: target of src.
juanpablo@213
    30
eclipse.compile: refer to eclipse.compile target of src.
juanpablo@213
    31
eclipse.compile.complete: refer to eclipse.compile.complete target of src.
juanpablo@213
    32
compile.src: refer to compile.src target of src.
juanpablo@213
    33
war: refer to build.war target of src.
juanpablo@213
    34
core.docs: refer to doc target of src-core.
juanpablo@213
    35
core.lib: refer to build target of src-core.
juanpablo@213
    36
eclipse.wad.lib: refer to sqlc target of src-wad.
juanpablo@213
    37
wad.docs: refer to doc target of src-wad.
juanpablo@213
    38
wad.lib: refer to build target of src-wad.
juanpablo@213
    39
eclipse.trl.lib: refer to sqlc target of src-trl.
juanpablo@213
    40
trl.docs: refer to doc target of src-trl.
juanpablo@213
    41
trl.lib: refer to build target of src-trl.
juanpablo@213
    42
database.lib: refer to jar target of src-db.
juanpablo@213
    43
clean: refer to clean target of src.
juanpablo@213
    44
trl.clean: refer to trl.clean target of src.
juanpablo@213
    45
translate: refer to translate target of src.
juanpablo@213
    46
installWebService: refer to installWebService target of src.
juanpablo@213
    47
uninstallWebService: refer to uninstallWebService target of src.
juanpablo@2061
    48
deploy.context: deploy the context into Tomcat using the manager
juanpablo@213
    49
install.source: install the ERP from sources (from subversion).
rafael@3544
    50
eclipse.install.source: install the ERP from sources for eclipse (from Mercurial).
juanpablo@213
    51
create.database: refer to create.database target of database.
juanpablo@213
    52
update.database: refer to update.database target of database.
juanpablo@213
    53
create.database.script: refer to create.database.script target of database.
juanpablo@213
    54
update.database.script: refer to update.database.script target of database.
juanpablo@213
    55
export.database: exports database structure and data to xml files.
fernando@202
    56
-->
asier@43
    57
<project name="openbravo" default="compile.complete" basedir=".">
martin@2871
    58
  <property environment="env" />
martin@2871
    59
  <property name="base.config" location="config" />
martin@2871
    60
  <property file="${base.config}/Openbravo.properties" />
martin@2871
    61
  <property file="${base.config}/checksums" />
juanpablo@131
    62
martin@2871
    63
  <property name="base.config" location="config" />
martin@2871
    64
  <property name="base.src" location="src" />
martin@3794
    65
  <property name="base.src.test" location="src-test" />
martin@2871
    66
  <property name="base.src.core" location="src-core" />
martin@2871
    67
  <property name="base.src.db" location="src-db" />
martin@2871
    68
  <property name="base.src.trl" location="src-trl" />
martin@2871
    69
  <property name="base.src.wad" location="src-wad" />
martin@2871
    70
  <property name="base.src.gen" location="src-gen" />
martin@2871
    71
  <property name="base.db" location="src-db/database" />
martin@2871
    72
  <property name="base.web" location="web" />
martin@2871
    73
  <property name="base.context" location="WebContent" />
martin@2871
    74
  <property name="base.design" location="${base.context}/src-loc" />
martin@2871
    75
  <property name="base.lib" location="lib" />
martin@2871
    76
  <property name="base.modules" location="modules" />
martin@2871
    77
  <property name="build" location="build/classes" />
antonio@7541
    78
  <property name="build.apply.module" location="build.apply/classes" />
martin@2871
    79
  <property name="build.AD" location="srcAD" />
martin@2871
    80
  <property name="build.sqlc" location="build/javasqlc" />
martin@2871
    81
  <property name="build.core.lib" location="src-core/lib" />
martin@2871
    82
  <property name="build.trl.lib" location="src-trl/lib" />
martin@2871
    83
  <property name="build.wad.lib" location="src-wad/lib" />
martin@2871
    84
  <property name="build.docs" location="docs/api" />
martin@2871
    85
  <property name="jakarta.home" location="${env.CATALINA_HOME}" />
martin@2871
    86
  <property name="module" value="%" />
antonio@6107
    87
  <property name="apply.on.create" value="false" />
antonio@6108
    88
  <property name="apply.on.update" value="true" />
martin@2871
    89
  <property name="obx.export.RD" value="false" />
martin@2871
    90
  <property name="obx.export.DB" value="false" />
martin@2871
    91
  <property name="obx.export.CS" value="false" />
asier@19231
    92
  <property name="obx.export.validate" value="true" />
asier@19231
    93
  <property name="obx.export.allDeps" value="false" />
martin@2871
    94
  <property name="chekPerms" value="false" />
antonio@2896
    95
  <property name="force" value="false" />
antonio@7709
    96
  <property name="strict.template.application" value="false" />
antonio@4937
    97
  <property name="rd" value="false" />
asier@3008
    98
  <property name="local" value="true" />
asier@3995
    99
  <property name="apply.modules.complete.compilation" value="false" />
martin@14869
   100
  <property name="calculate.core.revision" value="true"/>
martin@14869
   101
  <property name="stopOnWadError" value="false"/>
martin@14869
   102
  <property name="friendlyWarnings" value="false"/>
martin@14869
   103
  <property name="checkTranslationConsistency" value="true"/>
martin@14869
   104
  <property name="buildValidation" value="true"/>
martin@14870
   105
  <property name="disableCheckReferencedOrganizations" value="false"/>
asier@2057
   106
juanpablo@3841
   107
  <available file=".hg" property="is.hg" />
martin@3038
   108
asier@4279
   109
  <condition property="calculate.core.rev">
martin@14869
   110
   <istrue value="${calculate.core.revision}"/>
asier@4279
   111
  </condition>
martin@14869
   112
  
asier@4279
   113
  <condition property="xml.core.rev">
martin@14869
   114
     <isfalse value="${calculate.core.revision}"/>
asier@4279
   115
  </condition>
martin@14869
   116
  
juanpablo@2522
   117
  <condition property="deploy.mode" value="class">
juanpablo@2522
   118
    <not>
juanpablo@2522
   119
      <isset property="${deploy.mode}" />
juanpablo@2522
   120
    </not>
juanpablo@2522
   121
  </condition>
martin@2345
   122
martin@2871
   123
  <condition property="mode.war">
martin@2871
   124
    <equals arg1="war" arg2="${deploy.mode}" />
martin@2871
   125
  </condition>
martin@2345
   126
martin@2871
   127
  <condition property="mode.class">
martin@2871
   128
    <equals arg1="class" arg2="${deploy.mode}" />
martin@2871
   129
  </condition>
martin@2345
   130
martin@2871
   131
  <condition property="apply.modules.on.create">
martin@2871
   132
    <or>
martin@2871
   133
      <equals arg1="yes" arg2="${apply.on.create}" />
martin@2871
   134
      <equals arg1="true" arg2="${apply.on.create}" />
martin@2871
   135
    </or>
martin@2871
   136
  </condition>
martin@2345
   137
antonio@6108
   138
  <condition property="apply.modules.on.update">
antonio@6108
   139
    <or>
antonio@6108
   140
      <equals arg1="yes" arg2="${apply.on.update}" />
antonio@6108
   141
      <equals arg1="true" arg2="${apply.on.update}" />
antonio@6108
   142
    </or>
antonio@6108
   143
  </condition>
antonio@6108
   144
martin@2871
   145
  <condition property="obx.exp.DB">
martin@2871
   146
    <or>
martin@2871
   147
      <equals arg1="yes" arg2="${obx.export.DB}" />
martin@2871
   148
      <equals arg1="true" arg2="${obx.export.DB}" />
martin@2871
   149
    </or>
martin@2871
   150
  </condition>
martin@2345
   151
martin@2871
   152
  <condition property="obx.exp.CS">
martin@2871
   153
    <or>
martin@2871
   154
      <equals arg1="yes" arg2="${obx.export.CS}" />
martin@2871
   155
      <equals arg1="true" arg2="${obx.export.CS}" />
martin@2871
   156
    </or>
martin@2871
   157
  </condition>
asier@19231
   158
  
asier@19231
   159
  <condition property="obx.exp.validate">
asier@19231
   160
    <or>
asier@19231
   161
      <equals arg1="yes" arg2="${obx.export.validate}" />
asier@19231
   162
      <equals arg1="true" arg2="${obx.export.validate}" />
asier@19231
   163
    </or>
asier@19231
   164
  </condition>
asier@43
   165
antonio@3337
   166
  <condition property="timestamp">
antonio@3337
   167
    <or>
antonio@3337
   168
      <equals arg1="no" arg2="${execute.update.build.timestamp}" />
antonio@3337
   169
      <equals arg1="false" arg2="${execute.update.build.timestamp}" />
antonio@3337
   170
    </or>
antonio@3337
   171
  </condition>
antonio@3337
   172
martin@2871
   173
  <condition property="jakarta.base" value="${env.CATALINA_BASE}" else="${jakarta.home}">
martin@2871
   174
    <and>
martin@2871
   175
      <isset property="env.CATALINA_BASE" />
martin@2871
   176
    </and>
martin@2871
   177
  </condition>
martin@2871
   178
  <property name="log.path" location="${jakarta.base}/logs" />
martin@2871
   179
  <property name="lib" location="${jakarta.home}/common" />
martin@2871
   180
  <property name="jakarta.context" location="${jakarta.base}/webapps/${context.name}" />
asier@6240
   181
juanpablo@6241
   182
  <condition property="build.maxmemory" value="1024M" else="512M">
juanpablo@6241
   183
    <or>
juanpablo@6241
   184
      <equals arg1="${os.arch}" arg2="amd64" />
juanpablo@6241
   185
      <equals arg1="${os.arch}" arg2="x86_64" />
juanpablo@6241
   186
      <equals arg1="${os.arch}" arg2="ia64" />
juanpablo@6241
   187
    </or>
asier@6240
   188
  </condition>
stefan@124
   189
juanpablo@7924
   190
  <condition property="allow.root.user" value="true" else="false">
juanpablo@7924
   191
    <or>
juanpablo@7924
   192
      <equals arg1="yes" arg2="${allow.root}" />
juanpablo@7924
   193
      <equals arg1="true" arg2="${allow.root}" />
juanpablo@7924
   194
    </or>
juanpablo@7924
   195
  </condition>
juanpablo@7924
   196
martin@2871
   197
  <condition property="no.java.home" value="true">
martin@2871
   198
    <not>
martin@2871
   199
      <isset property="env.JAVA_HOME" />
martin@2871
   200
    </not>
martin@2871
   201
  </condition>
juanpablo@1548
   202
antonio@2838
   203
  <condition property="bbdd.owner.url" value="${bbdd.url}/${bbdd.sid}" else="${bbdd.url}">
antonio@2838
   204
    <and>
martin@2871
   205
      <equals arg1="${bbdd.rdbms}" arg2="POSTGRE" />
antonio@2838
   206
    </and>
antonio@2838
   207
  </condition>
juanpablo@7924
   208
juanpablo@7924
   209
  <condition property="root.user">
juanpablo@7924
   210
    <and>
juanpablo@7924
   211
      <equals arg1="${user.name}" arg2="root" />
juanpablo@7924
   212
      <not>
juanpablo@7924
   213
        <contains string="${os.name}" substring="Windows" />
juanpablo@7924
   214
      </not>
juanpablo@7924
   215
      <equals arg1="false" arg2="${allow.root.user}" />
juanpablo@7924
   216
    </and>
juanpablo@7924
   217
  </condition>
juanpablo@7924
   218
stefan@9215
   219
  <!-- Minimal classpath used for executing Wad at compile time -->
stefan@9215
   220
  <path id="wad.class.path">
stefan@9215
   221
    <fileset dir="${base.lib}">
stefan@9215
   222
      <include name="**/*.jar" />
stefan@9215
   223
    </fileset>
stefan@9215
   224
    <fileset dir="${build.core.lib}">
stefan@9215
   225
      <include name="openbravo-core.jar" />
stefan@9215
   226
    </fileset>
stefan@9215
   227
    <fileset dir="${build.wad.lib}">
stefan@9215
   228
      <include name="openbravo-wad.jar" />
stefan@9215
   229
    </fileset>
stefan@9215
   230
  </path>
stefan@9215
   231
martin@2871
   232
  <path id="project.class.path">
antonio@7894
   233
    <dirset dir="${base.modules}">
antonio@7894
   234
      <include name="*/build/classes/" />
antonio@7894
   235
    </dirset>
antonio@10098
   236
    <pathelement path="${basedir}/src-util/modulescript/build/classes/" />
martin@2871
   237
    <pathelement path="${build}" />
martin@2871
   238
    <pathelement path="${base.src}" />
martin@2871
   239
    <fileset dir="${base.lib}">
martin@2871
   240
      <include name="**/*.jar" />
martin@2871
   241
    </fileset>
martin@2871
   242
    <fileset dir="${build.core.lib}">
martin@2871
   243
      <include name="openbravo-core.jar" />
martin@2871
   244
    </fileset>
martin@2871
   245
    <fileset dir="${build.trl.lib}">
martin@2871
   246
      <include name="openbravo-trl.jar" />
martin@2871
   247
    </fileset>
martin@2871
   248
    <fileset dir="${build.wad.lib}">
martin@2871
   249
      <include name="openbravo-wad.jar" />
martin@2871
   250
    </fileset>
martin@2871
   251
    <fileset dir="${base.lib}">
martin@2871
   252
      <include name="**/*.jar" />
asier@24247
   253
      <exclude name="**/test/*.jar" />
martin@2871
   254
    </fileset>
martin@2871
   255
    <fileset dir="${base.db}/lib/">
martin@2871
   256
      <include name="**/*.jar" />
martin@2871
   257
    </fileset>
martin@2871
   258
    <fileset dir="${base.modules}">
martin@2871
   259
      <include name="*/lib/**" />
asier@24247
   260
       <exclude name="**/test/*.jar" />
martin@2871
   261
    </fileset>
antonio@7894
   262
  </path>
antonio@7894
   263
antonio@7894
   264
  <!-- This classpath is needed only for the compile.apply.module task-->
antonio@7894
   265
  <path id="apply.module.compile.classpath">
antonio@6886
   266
    <dirset dir="${base.modules}">
antonio@6886
   267
      <include name="*/build/classes/" />
antonio@6886
   268
    </dirset>
antonio@6886
   269
    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
antonio@7543
   270
    <pathelement path="${build.apply.module}" />
antonio@7543
   271
    <pathelement path="${base.src}" />
antonio@7543
   272
    <fileset dir="${base.lib}">
antonio@7543
   273
      <include name="**/*.jar" />
antonio@7543
   274
    </fileset>
antonio@7543
   275
    <fileset dir="${build.core.lib}">
antonio@7543
   276
      <include name="openbravo-core.jar" />
antonio@7543
   277
    </fileset>
antonio@7543
   278
    <fileset dir="${build.trl.lib}">
antonio@7543
   279
      <include name="openbravo-trl.jar" />
antonio@7543
   280
    </fileset>
antonio@7543
   281
    <fileset dir="${build.wad.lib}">
antonio@7543
   282
      <include name="openbravo-wad.jar" />
antonio@7543
   283
    </fileset>
antonio@7543
   284
    <fileset dir="${base.lib}">
antonio@7543
   285
      <include name="**/*.jar" />
antonio@7543
   286
    </fileset>
antonio@7543
   287
    <fileset dir="${base.db}/lib/">
antonio@7543
   288
      <include name="**/*.jar" />
antonio@7543
   289
    </fileset>
antonio@7543
   290
    <fileset dir="${base.modules}">
antonio@7543
   291
      <include name="*/lib/**" />
antonio@7543
   292
    </fileset>
antonio@7894
   293
  </path>
martin@14869
   294
  
antonio@7894
   295
  <!-- This classpath is needed only for the apply.module task-->
antonio@7894
   296
  <path id="apply.module.runtime.classpath">
antonio@7543
   297
    <dirset dir="${base.modules}">
antonio@7543
   298
      <include name="*/build/classes/" />
antonio@7543
   299
    </dirset>
antonio@7543
   300
    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
antonio@7541
   301
    <pathelement path="${build.apply.module}" />
antonio@7543
   302
    <pathelement path="${build}" />
antonio@7541
   303
    <pathelement path="${base.src}" />
antonio@7541
   304
    <fileset dir="${base.lib}">
antonio@7541
   305
      <include name="**/*.jar" />
antonio@7541
   306
    </fileset>
antonio@7541
   307
    <fileset dir="${build.core.lib}">
antonio@7541
   308
      <include name="openbravo-core.jar" />
antonio@7541
   309
    </fileset>
antonio@7541
   310
    <fileset dir="${build.trl.lib}">
antonio@7541
   311
      <include name="openbravo-trl.jar" />
antonio@7541
   312
    </fileset>
antonio@7541
   313
    <fileset dir="${build.wad.lib}">
antonio@7541
   314
      <include name="openbravo-wad.jar" />
antonio@7541
   315
    </fileset>
antonio@7541
   316
    <fileset dir="${base.lib}">
antonio@7541
   317
      <include name="**/*.jar" />
antonio@7541
   318
    </fileset>
antonio@7541
   319
    <fileset dir="${base.db}/lib/">
antonio@7541
   320
      <include name="**/*.jar" />
antonio@7541
   321
    </fileset>
antonio@7541
   322
    <fileset dir="${base.modules}">
antonio@7541
   323
      <include name="*/lib/**" />
antonio@7541
   324
    </fileset>
antonio@7541
   325
  </path>
martin@14869
   326
  
antonio@5617
   327
  <macrodef name="updatesystemstatus">
martin@14869
   328
     <attribute name="v" default="NOT SET"/>
martin@14869
   329
     <sequential>
martin@14869
   330
       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
martin@14869
   331
         <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
martin@14869
   332
         <transaction> UPDATE ad_system_info SET system_status='@{v}' ;
antonio@5618
   333
                       DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)
antonio@5618
   334
         </transaction>
martin@14869
   335
       </sql>
martin@14869
   336
     </sequential>
antonio@5617
   337
  </macrodef>
martin@14869
   338
  
antonio@16688
   339
  <macrodef name="updatesystemstatuswhennot">
antonio@16688
   340
    <attribute name="v" default="NOT SET"/>
antonio@16688
   341
    <attribute name="previous" default="NOT SET"/>
antonio@16688
   342
     <sequential>
antonio@16688
   343
       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
antonio@16688
   344
         <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
antonio@16688
   345
         <transaction> UPDATE ad_system_info SET system_status='@{v}' where system_status!='@{previous}' ;
antonio@16688
   346
                       DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)
antonio@16688
   347
         </transaction>
antonio@16688
   348
       </sql>
antonio@16688
   349
     </sequential>
antonio@16688
   350
  </macrodef>
antonio@16688
   351
  
martin@2871
   352
  <taskdef resource="axis-tasks.properties" classpathref="project.class.path" />
martin@14869
   353
  
asier@4277
   354
  <target name="init" depends="code.rev">
juanpablo@11541
   355
    <fail if="root.user" message="Don't run ant tasks with the root user" />
martin@2871
   356
    <fail if="no.java.home" message="The environment variable JAVA_HOME is not set." />
martin@2871
   357
  </target>
stefan@124
   358
martin@2871
   359
  <target name="code.rev" depends="set.code.rev">
juanpablo@3841
   360
    <condition property="code.revision" value="${hg.id}" else="0">
juanpablo@3841
   361
      <isset property="hg.id" />
martin@2871
   362
    </condition>
martin@2871
   363
  </target>
ivan@812
   364
juanpablo@3841
   365
  <target name="set.code.rev" if="is.hg">
juanpablo@3841
   366
    <exec executable="hg" outputproperty="hg.id" failifexecutionfails="false">
martin@14869
   367
      <arg value="id"/>
martin@14869
   368
      <arg value="-i"/>
juanpablo@3841
   369
    </exec>
martin@2871
   370
  </target>
asier@43
   371
miguel@16422
   372
  <target name="compile.complete" depends="init, core.lib, wad.lib, trl.lib">
martin@2871
   373
    <ant dir="${base.src}" target="compile.complete" inheritAll="true" inheritRefs="true" />
martin@2871
   374
  </target>
asier@2853
   375
shankar@20726
   376
  <target name="migrate.attachments" depends="init">
shankar@20765
   377
    <taskdef name="MigrateAttachments" classname="org.openbravo.erpCommon.utility.MigrateAttachments" >
shankar@20726
   378
      <classpath refid="project.class.path" />
shankar@20765
   379
    </taskdef>
shankar@20765
   380
    <MigrateAttachments/>
shankar@20726
   381
  </target>
shankar@20726
   382
asier@3013
   383
  <target name="smartbuild" depends="init">
martin@3038
   384
    <property name="smart.mode" value="true" />
antonio@2996
   385
    <property name="onlyIfModified" value="true" />
martin@3038
   386
    <antcall target="core.lib" />
martin@14869
   387
    
asier@4288
   388
    <condition property="no.local">
asier@4288
   389
      <not>
asier@4288
   390
        <istrue value="${local}" />
asier@4288
   391
      </not>
asier@4288
   392
    </condition>
asier@4288
   393
    <antcall target="update.database.if.no.local" />
martin@14869
   394
    
martin@3038
   395
    <antcall target="wad.lib" />
martin@14869
   396
    
asier@5219
   397
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
asier@5219
   398
      <classpath refid="project.class.path" />
asier@5219
   399
    </taskdef>
martin@14869
   400
    
martin@14869
   401
    <CheckSumCondition obDir="${basedir}"
martin@14869
   402
                       type="md5.wad"
martin@14869
   403
                       property="test.md5.wad"/>
martin@3038
   404
martin@3038
   405
    <condition property="new.wad">
martin@14869
   406
        <istrue value="${test.md5.wad}"/>
martin@3038
   407
    </condition>
martin@3038
   408
martin@3038
   409
    <antcall target="trl.lib" />
martin@14869
   410
    
asier@3660
   411
    <antcall inheritall="true" inheritrefs="true" target="generate.entities.quick" />
martin@2917
   412
asier@3013
   413
    <ant dir="${base.src}" target="smartbuild" inheritAll="true" inheritRefs="true" />
martin@3038
   414
antonio@5615
   415
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
antonio@4933
   416
    <antcall target="build.deploy" />
antonio@16688
   417
    <updatesystemstatuswhennot v="RB51" previous="RB12"/>
martin@2917
   418
    <!-- only restart tomcat if the restart prop was set to true -->
martin@2917
   419
    <condition property="dorestart">
martin@2917
   420
      <istrue value="${restart}" />
martin@2917
   421
    </condition>
martin@2917
   422
    <antcall target="if.restart.tomcat" />
martin@2871
   423
  </target>
martin@3038
   424
asier@3008
   425
  <target name="update.database.if.no.local" if="no.local">
asier@3008
   426
    <antcall target="update.database" />
asier@3008
   427
  </target>
antonio@2996
   428
asier@2982
   429
  <target name="build.deploy">
martin@3038
   430
    <antcall target="build.deploy.war" />
martin@3038
   431
    <antcall target="build.deploy.class" />
asier@2982
   432
  </target>
martin@3038
   433
asier@2982
   434
  <target name="build.deploy.class" if="mode.class">
asier@2982
   435
    <ant dir="${base.src}" target="copy.files" inheritAll="true" inheritRefs="true" />
asier@2982
   436
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" />
martin@3038
   437
    <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8" />
asier@2982
   438
  </target>
martin@3038
   439
stefan@9978
   440
  <!-- Only needed in special cases. See issue 15709 for details.
stefan@9978
   441
       This task (if deploy.mode=class) does sync jar-files from WebContent -> deployed webapp (& delete orphan jars)
stefan@9978
   442
  -->
stefan@9978
   443
  <target name="copy.files.jarsync" depends="init" if="mode.class">
stefan@9978
   444
    <ant dir="${base.src}" target="copy.files.jarsync.do" inheritAll="true" inheritRefs="true" />
stefan@9978
   445
  </target>
stefan@9978
   446
asier@2982
   447
  <target name="build.deploy.war" if="mode.war">
martin@3038
   448
    <antcall target="war" />
asier@2982
   449
  </target>
martin@2345
   450
martin@2917
   451
  <target name="if.restart.tomcat" if="dorestart">
martin@2917
   452
    <antcall target="tomcat.restart" />
martin@2917
   453
  </target>
martin@2345
   454
miguel@16422
   455
  <target name="compile" depends="init,core.lib, wad.lib, trl.lib">
martin@2871
   456
    <ant dir="${base.src}" target="compile" inheritAll="true" inheritRefs="true" />
martin@2871
   457
  </target>
martin@2345
   458
antonio@6897
   459
  <target name="buildvalidation" depends="init, core.lib">
martin@14869
   460
    <updatesystemstatus v="RB11"/> 
antonio@7925
   461
    <condition property="buildValidation.var">
martin@14869
   462
      <istrue value="${buildValidation}"  />
antonio@7925
   463
    </condition>
antonio@6897
   464
    <ant dir="src-util/buildvalidation" target="buildvalidation" inheritAll="true" inheritRefs="true" />
antonio@6886
   465
  </target>
martin@14869
   466
  
antonio@6886
   467
  <target name="compile.buildvalidation" depends="init, core.lib">
antonio@6886
   468
    <ant dir="src-util/buildvalidation" target="compile" inheritAll="true" inheritRefs="true" />
antonio@6886
   469
  </target>
martin@14869
   470
  
antonio@6886
   471
  <target name="compile.modulescript" depends="init, core.lib">
antonio@6886
   472
    <ant dir="src-util/modulescript" target="compile" inheritAll="true" inheritRefs="true" />
antonio@6886
   473
  </target>
antonio@6886
   474
antonio@7535
   475
  <target name="compile.complete.deploy" depends="compile.complete.development, compile.complete.war">
antonio@7512
   476
asier@5216
   477
    <!-- Calculate wad checksum to enable smartbuild-->
asier@5219
   478
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
asier@5219
   479
      <classpath refid="project.class.path" />
asier@5219
   480
    </taskdef>
martin@14869
   481
    
martin@14869
   482
    <CheckSumCondition obDir="${basedir}"
martin@14869
   483
                           type="md5.wad"
martin@14869
   484
                           property="test.md5.wad"/>
martin@2871
   485
  </target>
asier@43
   486
asier@7164
   487
  <target name="compile.complete.development" depends="init" unless="mode.war">
martin@14869
   488
    <updatesystemstatus v="RB43"/>
martin@2871
   489
    <ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
martin@2871
   490
  </target>
asier@43
   491
martin@2871
   492
  <target name="compile.complete.war" depends="init" if="mode.war">
martin@14869
   493
    <updatesystemstatus v="RB43"/>
martin@2871
   494
    <antcall target="compile.complete" />
martin@2871
   495
    <antcall target="war" />
martin@2871
   496
  </target>
asier@1929
   497
stefan@5405
   498
  <target name="compile.deploy" depends="compile.war, compile.development">
martin@14869
   499
    <updatesystemstatus v="RB51"/>
martin@2871
   500
  </target>
martin@2686
   501
asier@7164
   502
  <target name="compile.development" depends="init" unless="mode.war">
martin@2871
   503
    <ant dir="${base.src}" target="compile.development" inheritAll="true" inheritRefs="true" />
martin@2871
   504
  </target>
martin@2686
   505
martin@2871
   506
  <target name="validate.database">
martin@2871
   507
    <ant dir="${base.src}" target="validate.database" inheritAll="true" inheritRefs="true" />
martin@2871
   508
  </target>
asier@1929
   509
martin@2871
   510
  <target name="validate.modules">
martin@2871
   511
    <ant dir="${base.src}" target="validate.modules" inheritAll="true" inheritRefs="true" />
martin@2871
   512
  </target>
asier@43
   513
martin@2871
   514
  <target name="compile.war" if="mode.war">
asier@7165
   515
    <antcall target="generate.entities" />
martin@2871
   516
    <antcall target="compile" />
martin@2871
   517
    <antcall target="war" />
martin@2871
   518
  </target>
ivan@1738
   519
martin@2871
   520
  <target name="compile.web" depends="init">
martin@2871
   521
    <ant dir="${base.src}" target="compile.web" inheritAll="true" inheritRefs="true" />
martin@2871
   522
  </target>
asier@43
   523
martin@2871
   524
  <target name="compile.web.development" depends="init">
martin@2871
   525
    <ant dir="${base.src}" target="compile.web.development" inheritAll="true" inheritRefs="true" />
martin@2871
   526
  </target>
martin@2245
   527
martin@2871
   528
  <target name="eclipse.compile" depends="init">
ivan@5987
   529
    <fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
martin@2871
   530
    <ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   531
    <ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   532
    <ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   533
    <ant dir="${base.src}" target="eclipse.compile" inheritAll="true" inheritRefs="true" />
ivan@5987
   534
    <echo message="Refreshing project..." level="info" />
martin@2871
   535
    <eclipse.refreshLocal resource="openbravo" depth="infinite" />
ivan@5987
   536
    <echo message="Building project..." level="info" />
martin@2871
   537
    <eclipse.incrementalBuild project="openbravo" kind="incremental" />
martin@2871
   538
  </target>
martin@2284
   539
martin@2871
   540
  <target name="eclipse.compile.complete" depends="init">
ivan@5987
   541
    <fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
martin@2871
   542
    <ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   543
    <ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   544
    <ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   545
    <ant dir="${base.src}" target="eclipse.compile.complete" inheritAll="true" inheritRefs="true" />
ivan@5987
   546
    <echo message="Refreshing project..." level="info" />
martin@2871
   547
    <eclipse.refreshLocal resource="openbravo" depth="infinite" />
ivan@5987
   548
    <echo message="Building project..." level="info" />
martin@2871
   549
    <eclipse.incrementalBuild project="openbravo" kind="full" />
martin@2871
   550
  </target>
asier@43
   551
martin@2871
   552
  <target name="compile.src.gen" depends="init">
martin@2871
   553
    <ant dir="${base.src}" target="compile.src.gen" inheritAll="true" inheritRefs="true" />
martin@2871
   554
  </target>
martin@2830
   555
martin@3794
   556
  <target name="generate.java.doc">
martin@5179
   557
    <javadoc sourcepath="${base.src}:${base.src.test}:${build.AD}:${base.src.core}/src:${base.src.gen}:build/javasqlc/src/:build/javasqlc/srcAD" Windowtitle="${title}" access="protected" Header="${header}" Footer="${footer}" destdir="${build.docs}" linksource="no" maxmemory="1024M">
martin@14869
   558
      <excludepackage name="org.openbravo.erpWindows.*"/>
martin@3794
   559
      <classpath>
martin@14869
   560
        <path refid="project.class.path"/>
martin@3794
   561
        <pathelement path="lib/build/js.jar" />
martin@3794
   562
      </classpath>
martin@14869
   563
      <link href="http://java.sun.com/javase/6/docs/api/"/>
martin@3794
   564
    </javadoc>
martin@3794
   565
  </target>
martin@3794
   566
martin@2871
   567
  <target name="generate.entities">
martin@2871
   568
    <ant dir="${base.src}" target="generate.entities" inheritAll="true" inheritRefs="true" />
martin@2871
   569
  </target>
asier@43
   570
martin@2871
   571
  <target name="generate.entities.quick">
martin@2871
   572
    <ant dir="${base.src}" target="generate.entities.quick" inheritAll="true" inheritRefs="true" />
martin@2871
   573
  </target>
juanpablo@131
   574
stefan@11851
   575
  <!-- build-internal forking helper -->
stefan@11851
   576
  <target name="generate.entities.quick.forked">
stefan@11851
   577
    <ant dir="${base.src}" target="generate.entities.quick.forked" inheritAll="true" inheritRefs="true" />
stefan@11851
   578
  </target>
stefan@11851
   579
asier@24247
   580
  <target name="compile.test" depends="init">
asier@24247
   581
    <ant dir="${base.src.test}" target="compile.test" inheritAll="true" inheritRefs="true" />
asier@24247
   582
  </target>
asier@24247
   583
  
stefan@5674
   584
  <target name="run.tests" depends="init">
asier@24247
   585
    <ant dir="${base.src.test}" target="run.tests" inheritAll="true" inheritRefs="true" />
martin@3625
   586
  </target>
martin@3625
   587
stefan@5674
   588
  <target name="run.all.tests" depends="init">
asier@24247
   589
    <ant dir="${base.src.test}" target="run.all.tests" inheritAll="true" inheritRefs="true" />
martin@3656
   590
  </target>
martin@3656
   591
priya@6927
   592
  <target name="run.webservice.tests" depends="init">
asier@24247
   593
      <ant dir="${base.src.test}" target="run.webservice.tests" inheritAll="true" inheritRefs="true" />
priya@6927
   594
  </target>
priya@6927
   595
stefan@5674
   596
  <target name="run.quick.tests" depends="init">
asier@24247
   597
    <ant dir="${base.src.test}" target="run.quick.tests" inheritAll="true" inheritRefs="true" />
martin@3625
   598
  </target>
martin@3625
   599
stefan@3810
   600
  <target name="run.api.test.javascript">
asier@24993
   601
    <ant dir="${base.src.test}" target="run.api.test.javascript" inheritAll="true" inheritRefs="true" />
ivan@3752
   602
  </target>
martin@14869
   603
  
martin@14869
   604
  <target name="run.api.test.model" 
martin@14869
   605
          description="Checks current xml db model and dictionary API for not-allowed changes. Requires stableDBdir parameter">
stefan@9371
   606
    <taskdef name="checkAPI" classname="org.openbravo.ddlutils.task.CheckAPIDistribution">
asier@3808
   607
      <classpath refid="project.class.path" />
asier@3808
   608
    </taskdef>
martin@14869
   609
    <checkAPI driver="${bbdd.driver}" 
martin@14869
   610
                  url="${bbdd.owner.url}" 
martin@14869
   611
                  user="${bbdd.user}" 
martin@14869
   612
                  password="${bbdd.password}" 
martin@14869
   613
                  stableDBdir="${stableDBdir}"
martin@14869
   614
                  testDBdir="${basedir}"
martin@14869
   615
                  verbosity="${bbdd.verbosity}"
martin@14869
   616
    />    
asier@3808
   617
  </target>
ivan@3752
   618
stefan@20707
   619
  <target name="export.sample.data.old" depends="code.rev">
stefan@20707
   620
    <ant dir="${base.src}" target="export.sample.data.old" inheritAll="true" inheritRefs="true" />
martin@2871
   621
  </target>
juanpablo@131
   622
stefan@20707
   623
  <target name="import.sample.data.old" depends="code.rev">
stefan@20707
   624
    <ant dir="${base.src}" target="import.sample.data.old" inheritAll="true" inheritRefs="true" />
martin@2871
   625
  </target>
juanpablo@131
   626
martin@2871
   627
  <target name="compile.src" depends="init">
martin@2871
   628
    <ant dir="${base.src}" target="compile.src" inheritAll="true" inheritRefs="true" />
martin@2871
   629
  </target>
juanpablo@131
   630
martin@2871
   631
  <target name="war" depends="init">
martin@2871
   632
    <ant dir="${base.src}" target="build.war" inheritAll="true" inheritRefs="true" />
martin@2871
   633
  </target>
juanpablo@131
   634
martin@2871
   635
  <target name="core.docs" depends="init">
martin@2871
   636
    <ant dir="${base.src.core}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2871
   637
  </target>
juanpablo@131
   638
martin@2871
   639
  <target name="core.lib" depends="init">
martin@2871
   640
    <ant dir="${base.src.core}" target="build" inheritAll="true" inheritRefs="true" />
martin@2871
   641
    <antcall target="copy.core.lib" />
martin@2871
   642
  </target>
juanpablo@131
   643
martin@2871
   644
  <target name="copy.core.lib">
asier@2994
   645
    <copy file="${base.src.core}/lib/openbravo-core.jar" todir="${base.lib}/runtime" failonerror="false" />
martin@2871
   646
  </target>
juanpablo@131
   647
martin@2871
   648
  <target name="eclipse.wad.lib" depends="init">
martin@2871
   649
    <ant dir="${base.src.wad}" target="sqlc" inheritAll="true" inheritRefs="true" />
martin@2871
   650
    <eclipse.refreshLocal resource="OpenbravoWAD" depth="infinite" />
martin@2871
   651
    <eclipse.incrementalBuild project="OpenbravoWAD" kind="full" />
martin@2871
   652
  </target>
asier@43
   653
martin@2871
   654
  <target name="wad.docs" depends="init">
martin@2871
   655
    <ant dir="${base.src.wad}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2871
   656
  </target>
juanpablo@179
   657
martin@2871
   658
  <target name="wad.lib" depends="init">
martin@2871
   659
    <ant dir="${base.src.wad}" target="build" inheritAll="true" inheritRefs="true" />
martin@2871
   660
  </target>
juanpablo@179
   661
martin@2871
   662
  <target name="eclipse.trl.lib" depends="init">
martin@2871
   663
    <ant dir="${base.src.trl}" target="sqlc" inheritAll="true" inheritRefs="true" />
martin@2871
   664
    <eclipse.refreshLocal resource="OpenbravoTrl" depth="infinite" />
martin@2871
   665
    <eclipse.incrementalBuild project="OpenbravoTrl" kind="full" />
martin@2871
   666
  </target>
juanpablo@179
   667
martin@2871
   668
  <target name="trl.docs" depends="init">
martin@2871
   669
    <ant dir="${base.src.trl}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2871
   670
  </target>
asier@43
   671
martin@2871
   672
  <target name="trl.lib" depends="init">
martin@2871
   673
    <ant dir="${base.src.trl}" target="build" inheritAll="true" inheritRefs="true" />
martin@2871
   674
  </target>
asier@43
   675
martin@2871
   676
  <target name="database.lib" depends="init">
martin@2871
   677
    <ant dir="${base.src.db}" target="jar" inheritAll="true" inheritRefs="true" />
asier@2995
   678
    <copy file="${base.src.db}/build/lib/dbmanager.jar" todir="${base.db}/lib" failonerror="false" />
martin@2871
   679
  </target>
martin@2345
   680
martin@2871
   681
  <target name="clean" depends="init">
martin@2871
   682
    <ant dir="${base.src}" target="clean" inheritAll="true" inheritRefs="true" />
martin@2871
   683
  </target>
martin@2345
   684
martin@2871
   685
  <target name="trl.clean" depends="init">
martin@2871
   686
    <ant dir="${base.src}" target="trl.clean" inheritAll="true" inheritRefs="true" />
martin@2871
   687
  </target>
martin@2345
   688
stefan@11820
   689
  <target name="trl.remove.unused" depends="init">
stefan@11820
   690
    <ant dir="${base.src}" target="trl.remove.unused" inheritAll="true" inheritRefs="true" />
stefan@11820
   691
  </target>
stefan@11820
   692
martin@2871
   693
  <target name="translate" depends="init">
martin@2871
   694
    <ant dir="${base.src}" target="translate" inheritAll="true" inheritRefs="true" />
martin@2871
   695
  </target>
martin@2686
   696
martin@2871
   697
  <target name="translate.modules" depends="init">
martin@2871
   698
    <ant dir="${base.src}" target="translate.modules" inheritAll="true" inheritRefs="true" />
martin@2871
   699
  </target>
martin@2871
   700
martin@2871
   701
  <target name="installWebService" depends="init">
martin@2871
   702
    <ant dir="${base.src}" target="installWebService" inheritAll="true" inheritRefs="true">
martin@2871
   703
      <property name="wsdd" value="1" />
martin@2871
   704
    </ant>
martin@2871
   705
  </target>
martin@2871
   706
martin@2871
   707
  <target name="uninstallWebService" depends="init">
martin@2871
   708
    <ant dir="${base.src}" target="uninstallWebService" inheritAll="true" inheritRefs="true" />
martin@2871
   709
  </target>
martin@2871
   710
miguel@16113
   711
  <target name="install.source" depends="init, cleanSubfolders, create.database, wad.lib, trl.lib, compile.complete.deploy">
martin@14869
   712
    <echo message="applying modules" />    
antonio@7535
   713
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
antonio@5615
   714
martin@2871
   715
    <antcall target="import.sample.data" />
martin@14869
   716
    <updatesystemstatus v="RB51"/> 
antonio@5626
   717
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
martin@2871
   718
martin@2871
   719
    <!--
martin@2686
   720
		<antcall target="validate.database" />
martin@2686
   721
		<antcall target="validate.modules" />
martin@2704
   722
		-->
martin@2871
   723
  </target>
juanpablo@131
   724
miguel@16113
   725
  <target name="eclipse.install.source" depends="init, cleanSubfolders, create.database">
ivan@5987
   726
    <fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
ivan@5987
   727
    <echo message="Building OpenbravoCore project..." level="info" />
martin@14869
   728
    <eclipse.incrementalBuild project="OpenbravoCore" kind="full"/>
martin@14869
   729
    <antcall target="eclipse.wad.lib"/>
martin@14869
   730
    <antcall target="eclipse.trl.lib"/>
martin@14869
   731
    <antcall target="eclipse.compile.complete"/>
martin@14869
   732
    <echo message="applying modules" />    
martin@4287
   733
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
rafael@3544
   734
    <antcall target="import.sample.data" />
martin@14869
   735
    <updatesystemstatus v="RB51"/>
antonio@6472
   736
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
martin@2871
   737
  </target>
asier@43
   738
stefan@5405
   739
  <target name="create.database" depends="init, core.lib, database.lib">
martin@2871
   740
    <ant dir="${base.db}" antfile="build-create.xml" target="create.database" inheritAll="true" inheritRefs="true" />
martin@2871
   741
    <antcall target="db.apply.modules.sampledata" />
martin@2871
   742
  </target>
antonio@1335
   743
antonio@6897
   744
  <target name="update.database" depends="init, core.lib, database.lib, buildvalidation">
martin@14869
   745
    <updatesystemstatus v="RB12"/>
antonio@4870
   746
    <ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
martin@4287
   747
    <antcall target="generate.entities.quick" />
antonio@7535
   748
    <antcall target="apply.module" />
martin@2871
   749
  </target>
asier@1929
   750
antonio@6897
   751
  <target name="update.database.mod" depends="init, core.lib, database.lib, buildvalidation">
martin@14869
   752
    <updatesystemstatus v="RB12"/>
antonio@7545
   753
    <ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />
antonio@7535
   754
    <antcall target="generate.entities.quick" />
antonio@7535
   755
    <antcall target="apply.module" />
martin@2871
   756
  </target>
asier@43
   757
stefan@5405
   758
  <target name="create.database.script" depends="init, core.lib">
martin@2871
   759
    <ant dir="${base.db}" target="create.database.script" inheritAll="true" inheritRefs="true" />
martin@2871
   760
  </target>
asier@43
   761
stefan@5405
   762
  <target name="update.database.script" depends="init, core.lib">
martin@2871
   763
    <ant dir="${base.db}" target="update.database.script" inheritAll="true" inheritRefs="true" />
martin@2871
   764
  </target>
adrian@97
   765
antonio@5420
   766
  <target name="export.database" depends="init, core.lib, database.lib, generate.entities.quick">
martin@2871
   767
    <ant dir="${base.db}" target="export.database.structure" inheritAll="true" inheritRefs="true" />
martin@2871
   768
  </target>
adrian@164
   769
stefan@5405
   770
  <target name="export.config.script" depends="init, core.lib">
martin@2871
   771
    <ant dir="${base.db}" target="export.config.script" inheritAll="true" inheritRefs="true" />
martin@2871
   772
  </target>
asier@1929
   773
stefan@20707
   774
  <target name="export.sample.data" depends="init, core.lib">
stefan@20707
   775
    <ant dir="${base.db}" target="export.sample.data" inheritAll="true" inheritRefs="true" />
stefan@20707
   776
  </target>
stefan@20707
   777
stefan@20707
   778
  <target name="import.sample.data" depends="init, core.lib">
stefan@20707
   779
    <ant dir="${base.db}" target="import.sample.data" inheritAll="true" inheritRefs="true" />
stefan@20707
   780
  </target>
stefan@20707
   781
antonio@6108
   782
  <target name="db.apply.modules" if="apply.modules.on.update">
antonio@6074
   783
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
antonio@6074
   784
  </target>
antonio@6074
   785
martin@2871
   786
  <target name="db.apply.modules.sampledata" if="apply.modules.on.create">
antonio@5077
   787
    <antcall target="generate.entities" />
martin@4287
   788
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
martin@2871
   789
    <antcall target="import.sample.data" />
martin@2871
   790
  </target>
martin@2345
   791
martin@4287
   792
antonio@8501
   793
  <target name="apply.modules">
martin@4287
   794
asier@3995
   795
    <condition property="apply.modules.complete.compilation.var">
martin@14869
   796
      <istrue value="${apply.modules.complete.compilation}"  />
asier@3995
   797
    </condition>
martin@14869
   798
    
asier@3995
   799
    <condition property="apply.modules.simple.compilation.var">
asier@3995
   800
      <isfalse value="${apply.modules.complete.compilation.var}" />
asier@3995
   801
    </condition>
antonio@7516
   802
martin@14869
   803
    <updatesystemstatus v="RB43"/>
martin@14869
   804
    <antcall target="apply.modules.compile"/>
antonio@7516
   805
antonio@5611
   806
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
antonio@7516
   807
asier@3995
   808
  </target>
martin@14869
   809
  
martin@4287
   810
  <target name="apply.module.forked">
martin@4287
   811
    <!-- 
martin@4287
   812
    Note: set reinitializeModel to false because otherwise the dal is re-initialized with classes and a model
martin@4287
   813
    which are not in sync (see issue: https://issues.openbravo.com/view.php?id=9376)
martin@4287
   814
    Note: applyModule can also be moved to a java task to fork it (to prevent this from occuring)
martin@4287
   815
    but then no output is visible for the user.
martin@4287
   816
    -->
martin@4287
   817
    <taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
martin@4287
   818
      <classpath refid="project.class.path" />
martin@4287
   819
    </taskdef>
antonio@15503
   820
    <applyModule userId="0" adminMode="true" forceRefData="${forceRefData}" propertiesFile="${base.config}/Openbravo.properties"/>
martin@4287
   821
  </target>
martin@14869
   822
  
antonio@7535
   823
  <target name="compile.apply.module" depends="init">
martin@14869
   824
    <updatesystemstatus v="RB31"/>
antonio@7535
   825
    <ant dir="${base.src}" target="compile.apply.module" inheritAll="true" inheritRefs="true" />
antonio@7535
   826
  </target>
martin@14869
   827
  
antonio@7541
   828
  <!--
antonio@7541
   829
  This task uses a special classpath.
antonio@7541
   830
  This classpath is equivalent to the normal project.class.path, except for the fact that that the normal build folder
antonio@7541
   831
  is replaced by the apply.module.build folder, in which the ApplyModule task related classes will be compiled.
antonio@7541
   832
  This is done to workaround the fact that the javac task needs to compile all the related classes when upgrading openbravo
antonio@7541
   833
  and if the normal build folder is included, none of them are recompiled by default unless the whole build directory is specified.
antonio@7541
   834
  -->
antonio@7535
   835
  <target name="apply.module" depends="compile.apply.module">
antonio@6492
   836
    <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
antonio@15503
   837
      <arg line="'${base.src}' '${friendlyWarnings}' '${forceRefData}'" />
antonio@7543
   838
      <classpath refid="apply.module.runtime.classpath" />
martin@4287
   839
    </java>
martin@14869
   840
   <delete includeEmptyDirs="true"  dir="${build.apply.module}" />
martin@4287
   841
  </target>
martin@14869
   842
  
asier@6221
   843
  <target name="apply.modules.compile" depends="wad.lib">
martin@14869
   844
    <antcall target="apply.modules.compile.simple"/>
martin@14869
   845
    <antcall target="apply.modules.compile.complete"/>
asier@3995
   846
  </target>
martin@14869
   847
  
asier@3995
   848
  <target name="apply.modules.compile.simple" if="apply.modules.simple.compilation.var">
martin@2871
   849
    <antcall target="compile.deploy" />
asier@3995
   850
  </target>
martin@14869
   851
  
asier@3995
   852
  <target name="apply.modules.compile.complete" if="apply.modules.complete.compilation.var">
martin@14869
   853
     <antcall target="compile.complete.deploy" />
martin@2871
   854
  </target>
martin@14869
   855
  
martin@2871
   856
  <!-- 
martin@2345
   857
		apparently this does not overwrite the default catalina_opts, only
martin@2345
   858
		if it is not set will it be set to the value below 
martin@2345
   859
	-->
martin@2871
   860
  <property name="env.CATALINA_OPTS" value="-XX:MaxPermSize=128M" />
martin@2345
   861
martin@2871
   862
  <!-- 
martin@2345
   863
		This task is called from the Openbravo ui, it spawns a java call which again
martin@2345
   864
		calls the restart.tomcat.do task as a spawned task.
martin@2345
   865
	-->
martin@2871
   866
  <target name="tomcat.restart" description="Restart the tomcat server process">
martin@2917
   867
    <echo message="Restarting tomcat..." />
martin@2871
   868
    <java classname="org.openbravo.service.system.RestartTomcat" spawn="true" fork="true" maxmemory="${build.maxmemory}">
martin@2871
   869
      <arg line="${base.src}" />
martin@2871
   870
      <classpath refid="project.class.path" />
martin@2871
   871
    </java>
martin@2871
   872
  </target>
martin@2345
   873
martin@2871
   874
  <!--
martin@2345
   875
		Is called by the org.openbravo.service.system.RestartTomcat class.
martin@2345
   876
	-->
martin@2871
   877
  <target name="tomcat.restart.do" description="Restart the tomcat server process">
martin@2871
   878
    <echo message="Restarting Tomcat at ${env.CATALINA_HOME}" />
martin@2871
   879
    <java classname="org.apache.catalina.startup.Bootstrap" fork="true">
asier@25200
   880
      <classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar:${env.CATALINA_HOME}/bin/tomcat-juli.jar" />
martin@2871
   881
      <jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
martin@2871
   882
      <jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
martin@2871
   883
      <arg line="stop" />
martin@2871
   884
    </java>
martin@2871
   885
    <sleep description="Wait to give tomcat time to stop" seconds="20" />
stefan@9978
   886
stefan@9978
   887
    <!-- if deploy.mode=class this will sync (& delete orphan) jarfiles from WebContent -> tomcat-->
martin@14869
   888
    <antcall target="copy.files.jarsync"/>
stefan@9978
   889
stefan@9978
   890
    <java classname="org.apache.catalina.startup.Bootstrap" fork="true" spawn="true">
asier@25200
   891
      <classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar:${env.CATALINA_HOME}/bin/tomcat-juli.jar" />
martin@2871
   892
      <!-- note because CATALINA_OPTS can be multi argument the line attribute has to be used! -->
martin@2871
   893
      <jvmarg line="${env.CATALINA_OPTS}" />
martin@2871
   894
      <jvmarg value="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" />
martin@2871
   895
      <jvmarg value="-Djava.util.logging.config.file=${env.CATALINA_BASE}/conf/logging.properties" />
martin@2871
   896
      <jvmarg value="-Djava.endorsed.dirs=${env.CATALINA_HOME}/endorsed" />
martin@2871
   897
      <jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
martin@2871
   898
      <jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
martin@2871
   899
      <jvmarg value="-Djava.io.tmpdir=${env.CATALINA_BASE}/temp" />
martin@2871
   900
      <arg line="start" />
martin@2871
   901
    </java>
martin@2871
   902
  </target>
martin@2345
   903
martin@2871
   904
  <!-- 
martin@2345
   905
		This task is called from the Openbravo ui, it spawns a java call which again
martin@2345
   906
		calls the tomcat.reload.do task as a spawned task.
martin@2345
   907
	-->
martin@2871
   908
  <target name="tomcat.reload" description="Reload the Openbravo context">
martin@2917
   909
    <echo message="Reloading webapp..." />
martin@2871
   910
    <java classname="org.openbravo.service.system.ReloadContext" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" spawn="true" fork="true">
martin@2871
   911
      <arg line="${base.src}" />
martin@2871
   912
      <classpath refid="project.class.path" />
martin@2871
   913
    </java>
martin@2871
   914
  </target>
martin@2345
   915
martin@2871
   916
  <target name="tomcat.reload.do">
martin@2871
   917
    <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
martin@2871
   918
      <classpath refid="project.class.path" />
martin@2871
   919
    </taskdef>
martin@2871
   920
    <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
martin@2871
   921
  </target>
adrian@171
   922
martin@2871
   923
  <target name="tomcat.list">
martin@2871
   924
    <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
martin@2871
   925
      <classpath refid="project.class.path" />
martin@2871
   926
    </taskdef>
martin@2871
   927
    <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
martin@2871
   928
  </target>
martin@2345
   929
martin@2871
   930
  <target name="deploy.context">
martin@2871
   931
    <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
martin@2871
   932
      <classpath refid="project.class.path" />
martin@2871
   933
    </taskdef>
martin@2871
   934
    <taskdef name="deploy.tomcat" classname="org.apache.catalina.ant.DeployTask">
martin@2871
   935
      <classpath refid="project.class.path" />
martin@2871
   936
    </taskdef>
martin@2871
   937
    <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
martin@2871
   938
      <classpath refid="project.class.path" />
martin@2871
   939
    </taskdef>
martin@2345
   940
martin@2871
   941
    <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" failonerror="false" />
martin@2871
   942
    <deploy.tomcat url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" war="file:${base.lib}/${context.name}.war" />
martin@2871
   943
    <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
martin@2871
   944
  </target>
martin@2345
   945
martin@2871
   946
  <target name="generate-wsdd">
martin@2871
   947
    <ant dir="${base.src}" target="generate-wsdd" inheritAll="true" inheritRefs="true" />
martin@2871
   948
  </target>
martin@2345
   949
martin@2871
   950
  <target name="obx.export.database" if="obx.exp.DB">
martin@2871
   951
    <antcall target="export.database" />
martin@2871
   952
  </target>
martin@2345
   953
martin@2871
   954
  <target name="obx.export.config.script" if="obx.exp.CS">
martin@2871
   955
    <antcall target="export.config.script" />
martin@2871
   956
  </target>
martin@2345
   957
asier@19231
   958
  <target name="obx.export.validateModules" if="obx.exp.validate">
asier@19231
   959
    <taskdef name="validateModules" classname="org.openbravo.service.system.SystemValidationTask">
martin@2871
   960
      <classpath refid="project.class.path" />
martin@2871
   961
    </taskdef>
martin@2345
   962
asier@5560
   963
    <taskdef name="WADValidation" classname="org.openbravo.wad.validation.WADValidatorTask">
asier@5533
   964
      <classpath refid="project.class.path" />
asier@5533
   965
    </taskdef>
asier@19231
   966
asier@5533
   967
    <echo message="Validating Module..." />
asier@19231
   968
martin@14869
   969
    <WADValidation propertiesFile="${base.config}/Openbravo.properties"
martin@14869
   970
                   modules="${module}"
martin@14869
   971
                   stoponerror="true"/>
martin@3038
   972
asier@11044
   973
    <validateModules moduleJavaPackage="${module}" failOnError="true" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" />
asier@19231
   974
  </target>
asier@19231
   975
  
asier@19231
   976
  <target name="package.module">
asier@19231
   977
    <taskdef name="extractModule" classname="org.openbravo.erpCommon.modules.ExtractModuleTask">
asier@19231
   978
      <classpath refid="project.class.path" />
asier@19231
   979
    </taskdef>
asier@19231
   980
    
asier@19231
   981
    <antcall target="obx.export.validateModules" />
martin@2871
   982
    <antcall target="obx.export.database" />
martin@2871
   983
    <antcall target="obx.export.config.script" />
juanpablo@2691
   984
asier@19231
   985
    <extractModule moduleName="${module}" 
asier@19231
   986
                   userId="0" 
asier@19231
   987
                   adminMode="true" 
asier@19231
   988
                   propertiesFile="${base.config}/Openbravo.properties" 
asier@19231
   989
                   exportRD="${obx.export.RD}" 
asier@19231
   990
                   addAllDependencies="${obx.export.allDeps}"/>
martin@2871
   991
  </target>
juanpablo@2691
   992
martin@2871
   993
  <target name="diagnostic">
antonio@6886
   994
    <ant dir="src-util/diagnostic" antfile="build-create.xml" target="build" />
antonio@6886
   995
    <ant dir="src-util/diagnostic" target="check.all" />
martin@2871
   996
  </target>
inigo@25249
   997
  
inigo@25249
   998
  <target name="setup.compile">
inigo@25249
   999
          <echo message="Compiling application configuration classes..." />
inigo@25253
  1000
	   <mkdir dir="build/classes" />
inigo@25249
  1001
          <javac srcdir="src/org/openbravo/configuration" destdir="build/classes" includeantruntime="false">
inigo@25249
  1002
             <classpath refid="project.class.path"/>  
inigo@25249
  1003
          </javac>
martin@2871
  1004
  </target>
juanpablo@2706
  1005
inigo@25249
  1006
  <target name="setup" depends="setup.compile">    
inigo@25249
  1007
      <echo message="Launching configuration application..."/>
inigo@25249
  1008
      <taskdef name="configurationApp" classname="org.openbravo.configuration.ConfigurationApp">
inigo@25249
  1009
        <classpath refid="project.class.path" />
inigo@25249
  1010
      </taskdef>
inigo@25249
  1011
      <configurationApp/>
inigo@25249
  1012
    </target>
inigo@25249
  1013
  
asier@4280
  1014
  <target name="package.core" depends="init, set.version.number">
martin@14869
  1015
	<property name="tmpdir" value="${java.io.tmpdir}/ob.core${core.rev}" />
martin@14869
  1016
   
martin@14869
  1017
  	<exec executable="hg" >
martin@14869
  1018
  		<arg value="archive"/>
martin@14869
  1019
  		<arg value="${tmpdir}"/>
martin@14869
  1020
  	</exec>
martin@14869
  1021
  	
martin@14869
  1022
  	<replaceregexp file="${tmpdir}/src-db/database/sourcedata/AD_MODULE.xml"
martin@14869
  1023
                   match="(VERSION.*\[CDATA\[).*\..*\.(.*)(\]\])"
martin@14869
  1024
                   replace="\1${core.rev}\3"
martin@14869
  1025
                   byline="true"/>
martin@14869
  1026
    
martin@14869
  1027
    <echo message="${hg.id}" file="${tmpdir}/config/instance.revision"/>
martin@14869
  1028
	
martin@14869
  1029
    <delete includeEmptyDirs="true">
martin@14869
  1030
      <fileset dir="${tmpdir}/modules" includes="**/*" defaultexcludes="no"/>
martin@14869
  1031
    </delete>
martin@14869
  1032
    
martin@14869
  1033
    <zip destfile="${basedir}/core-${core.rev}.obx" basedir="${tmpdir}"/>
martin@14869
  1034
    
martin@14869
  1035
    <delete dir="${tmpdir}"/>
martin@14868
  1036
martin@14869
  1037
   </target>
martin@14869
  1038
 
martin@14869
  1039
  <target name="set.version.number" depends="set.version.from.file, set.version.calculated"/>
martin@14869
  1040
  
asier@4279
  1041
  <target name="set.version.calculated" if="calculate.core.rev">
martin@14869
  1042
    <echo message="calculating core revision..."/>
asier@4279
  1043
    <exec executable="hg" outputproperty="hg.idno" failifexecutionfails="false">
martin@14869
  1044
      <arg value="id"/>
martin@14869
  1045
      <arg value="-n"/>
asier@4279
  1046
    </exec>
guillermo@15690
  1047
        <propertyfile file="currentRevision.tmp">
guillermo@15690
  1048
          <entry key="core.rev" value="3.0.${hg.idno}"/>
guillermo@15690
  1049
        </propertyfile>
guillermo@15690
  1050
        <replaceregexp file="currentRevision.tmp"
guillermo@15690
  1051
                       match="\+"
guillermo@15690
  1052
                       replace=""
guillermo@15690
  1053
                       byline="true"
guillermo@15690
  1054
        />
guillermo@15690
  1055
        <loadproperties> 
guillermo@15690
  1056
          <file file="currentRevision.tmp"/> 
guillermo@15690
  1057
        </loadproperties>
guillermo@15690
  1058
        <delete file="currentRevision.tmp"/>
asier@4279
  1059
  </target>
martin@14869
  1060
  
asier@4279
  1061
  <target name="set.version.from.file" if="xml.core.rev">
martin@14869
  1062
    <echo message="reading core revision from xml file..."/>
asier@4279
  1063
    <loadfile property="core.rev" srcfile="${basedir}/src-db/database/sourcedata/AD_MODULE.xml">
asier@4279
  1064
      <filterchain>
asier@4279
  1065
        <linecontains>
martin@14869
  1066
          <contains value="VERSION>"/>
asier@4279
  1067
        </linecontains>
asier@4279
  1068
        <tokenfilter>
martin@14869
  1069
            <replaceregex pattern="(.*VERSION.*\[CDATA\[)(.*\..*\..*)(\]\].*)" replace="\2"/>
asier@4279
  1070
        </tokenfilter>
martin@14869
  1071
        <striplinebreaks/>
asier@4279
  1072
      </filterchain>
asier@4279
  1073
    </loadfile>
asier@4279
  1074
  </target>
martin@14869
  1075
  
asier@5536
  1076
  <target name="validate.wad">
asier@5536
  1077
    <ant dir="${base.src}" target="wadvalidation" inheritAll="true" inheritRefs="true" />
asier@5536
  1078
  </target>
martin@14869
  1079
  
antonio@7476
  1080
  <target name="UIrebuild" depends="core.lib">
antonio@7476
  1081
    <java classname="org.openbravo.base.BuildTask" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
antonio@7476
  1082
      <arg line="'${base.config}/Openbravo.properties' ${logFileName}" />
antonio@7476
  1083
      <classpath>
antonio@7476
  1084
        <pathelement path="${build.core.lib}/openbravo-core.jar" />
stefan@11940
  1085
        <pathelement path="${base.lib}/runtime/log4j-1.2.16.jar" />
stefan@11940
  1086
        <pathelement path="${base.lib}/runtime/commons-pool-1.5.6.jar" />
stefan@11940
  1087
        <pathelement path="${base.lib}/runtime/commons-dbcp-1.4.jar" />
stefan@11940
  1088
        <pathelement path="${base.lib}/runtime/postgresql-9.0-801.jdbc4.jar" />
antonio@7476
  1089
        <pathelement path="${base.lib}/runtime/ojdbc6.jar" />
stefan@11940
  1090
        <pathelement path="${base.lib}/runtime/commons-collectionsi-3.2.1.jar" />
augusto@24383
  1091
        <pathelement path="${base.lib}/runtime/ant-1.9.2.jar" />
augusto@24383
  1092
        <pathelement path="${base.lib}/runtime/ant-launcher-1.9.2.jar" />
augusto@24383
  1093
        <pathelement path="${base.lib}/runtime/ant-apache-log4j-1.9.2.jar" />
antonio@7476
  1094
        <pathelement path="${base.lib}/runtime/ant-nodeps.jar" />
antonio@7476
  1095
      </classpath>
antonio@7476
  1096
    </java>
antonio@7476
  1097
  </target>
martin@14869
  1098
  
asier@8876
  1099
  <target name="check.module.consistency">
asier@8876
  1100
    <taskdef name="checkConsistency" classname="org.openbravo.erpCommon.modules.CheckLocalConsistency">
asier@8876
  1101
      <classpath refid="project.class.path" />
asier@8876
  1102
    </taskdef>
martin@14869
  1103
    <checkConsistency userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties"/>
asier@8876
  1104
  </target>
martin@14869
  1105
  
antonio@11114
  1106
  <target name="check.window.compatibility">
antonio@11114
  1107
    <taskdef name="showclassicwindows" classname="org.openbravo.client.application.WindowsInClassicModeTask">
antonio@11114
  1108
      <classpath refid="project.class.path" />
antonio@11114
  1109
    </taskdef>
martin@14869
  1110
    <showclassicwindows userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties"/>
antonio@11114
  1111
  </target>
miguel@16113
  1112
  
miguel@16113
  1113
  <target name="cleanSubfolders" depends="init">
miguel@16113
  1114
      <ant dir="${base.src.core}" target="clean" inheritAll="true" inheritRefs="true" />
miguel@16113
  1115
      <ant dir="${base.src.trl}" target="clean" inheritAll="true" inheritRefs="true" />
miguel@16113
  1116
      <ant dir="${base.src.wad}" target="clean" inheritAll="true" inheritRefs="true" />
asier@16641
  1117
  </target>
asier@16641
  1118
  
asier@16641
  1119
  <target name="activate.instance" depends="init"
asier@16641
  1120
          description="Activates the instance with the provided public key">
asier@16641
  1121
   <taskdef name="activateInstace" classname="org.openbravo.erpCommon.obps.ActivationTask">
asier@16641
  1122
     <classpath refid="project.class.path" />
asier@16641
  1123
   </taskdef>
asier@16641
  1124
   <property name="purpose" value="" />
asier@16641
  1125
   <property name="publicKey" value="" />
asier@16641
  1126
   <property name="publicKeyFile" value="" />
asier@16641
  1127
    
asier@16641
  1128
   <activateInstace purpose="${purpose}"
asier@16641
  1129
                    publicKey="${publicKey}"
asier@16641
  1130
                    publicKeyFile="${publicKeyFile}"
asier@16641
  1131
                    userId="0" 
asier@16641
  1132
                    adminMode="true" 
asier@16641
  1133
                    propertiesFile="${base.config}/Openbravo.properties"/>
asier@16641
  1134
  </target>
miguel@16113
  1135
  
asier@43
  1136
</project>