build.xml
author Víctor Martínez Romanos <victor.martinez@openbravo.com>
Thu, 07 May 2015 12:11:39 +0200
changeset 26684 2311966afd7b
parent 25564 ef79806f8488
child 25808 fdd30bd81889
permissions -rw-r--r--
Fixed bug 29809: Impossible to create several calendars for the same organization

Two pieces of code were affected by this bug:
PeriodEventHandler.java: EntityPersistenceEventObserver in charge of checking overlap in manual inserts/updates (or any java process) in c_period table
C_YEARPERIODS: db function associated to the create periods process inside the Fiscal Calendar | Year tab. It also verifies the periods don't overlap other periods.

The fix consists in checking that there is no date overlap per calendar. Before this fix the calendar wasn't taken into account, so it was not possible to define several calendars for the same organization with the same periods.
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@9085
     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@6702
    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@3542
    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@3892
    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@7545
    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@6113
    87
  <property name="apply.on.create" value="false" />
antonio@6114
    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@19242
    92
  <property name="obx.export.validate" value="true" />
asier@19242
    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@7751
    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@4119
    99
  <property name="apply.modules.complete.compilation" value="false" />
martin@14874
   100
  <property name="calculate.core.revision" value="true"/>
martin@14874
   101
  <property name="stopOnWadError" value="false"/>
martin@14874
   102
  <property name="friendlyWarnings" value="false"/>
martin@14874
   103
  <property name="checkTranslationConsistency" value="true"/>
martin@14874
   104
  <property name="buildValidation" value="true"/>
martin@14875
   105
  <property name="disableCheckReferencedOrganizations" value="false"/>
asier@2057
   106
juanpablo@3965
   107
  <available file=".hg" property="is.hg" />
martin@3038
   108
asier@4279
   109
  <condition property="calculate.core.rev">
martin@14874
   110
   <istrue value="${calculate.core.revision}"/>
asier@4279
   111
  </condition>
martin@14874
   112
  
asier@4279
   113
  <condition property="xml.core.rev">
martin@14874
   114
     <isfalse value="${calculate.core.revision}"/>
asier@4279
   115
  </condition>
martin@14874
   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@6114
   138
  <condition property="apply.modules.on.update">
antonio@6114
   139
    <or>
antonio@6114
   140
      <equals arg1="yes" arg2="${apply.on.update}" />
antonio@6114
   141
      <equals arg1="true" arg2="${apply.on.update}" />
antonio@6114
   142
    </or>
antonio@6114
   143
  </condition>
antonio@6114
   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@19242
   158
  
asier@19242
   159
  <condition property="obx.exp.validate">
asier@19242
   160
    <or>
asier@19242
   161
      <equals arg1="yes" arg2="${obx.export.validate}" />
asier@19242
   162
      <equals arg1="true" arg2="${obx.export.validate}" />
asier@19242
   163
    </or>
asier@19242
   164
  </condition>
asier@43
   165
antonio@3245
   166
  <condition property="timestamp">
antonio@3245
   167
    <or>
antonio@3245
   168
      <equals arg1="no" arg2="${execute.update.build.timestamp}" />
antonio@3245
   169
      <equals arg1="false" arg2="${execute.update.build.timestamp}" />
antonio@3245
   170
    </or>
antonio@3245
   171
  </condition>
antonio@3245
   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@6246
   181
juanpablo@6247
   182
  <condition property="build.maxmemory" value="1024M" else="512M">
juanpablo@6247
   183
    <or>
juanpablo@6247
   184
      <equals arg1="${os.arch}" arg2="amd64" />
juanpablo@6247
   185
      <equals arg1="${os.arch}" arg2="x86_64" />
juanpablo@6247
   186
      <equals arg1="${os.arch}" arg2="ia64" />
juanpablo@6247
   187
    </or>
asier@6246
   188
  </condition>
stefan@124
   189
juanpablo@7973
   190
  <condition property="allow.root.user" value="true" else="false">
juanpablo@7973
   191
    <or>
juanpablo@7973
   192
      <equals arg1="yes" arg2="${allow.root}" />
juanpablo@7973
   193
      <equals arg1="true" arg2="${allow.root}" />
juanpablo@7973
   194
    </or>
juanpablo@7973
   195
  </condition>
juanpablo@7973
   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@7973
   208
juanpablo@7973
   209
  <condition property="root.user">
juanpablo@7973
   210
    <and>
juanpablo@7973
   211
      <equals arg1="${user.name}" arg2="root" />
juanpablo@7973
   212
      <not>
juanpablo@7973
   213
        <contains string="${os.name}" substring="Windows" />
juanpablo@7973
   214
      </not>
juanpablo@7973
   215
      <equals arg1="false" arg2="${allow.root.user}" />
juanpablo@7973
   216
    </and>
juanpablo@7973
   217
  </condition>
juanpablo@7973
   218
stefan@9230
   219
  <!-- Minimal classpath used for executing Wad at compile time -->
stefan@9230
   220
  <path id="wad.class.path">
stefan@9230
   221
    <fileset dir="${base.lib}">
stefan@9230
   222
      <include name="**/*.jar" />
stefan@9230
   223
    </fileset>
stefan@9230
   224
    <fileset dir="${build.core.lib}">
stefan@9230
   225
      <include name="openbravo-core.jar" />
stefan@9230
   226
    </fileset>
stefan@9230
   227
    <fileset dir="${build.wad.lib}">
stefan@9230
   228
      <include name="openbravo-wad.jar" />
stefan@9230
   229
    </fileset>
stefan@9230
   230
  </path>
stefan@9230
   231
martin@2871
   232
  <path id="project.class.path">
antonio@7933
   233
    <dirset dir="${base.modules}">
antonio@7933
   234
      <include name="*/build/classes/" />
antonio@7933
   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@7933
   262
  </path>
antonio@7933
   263
antonio@7933
   264
  <!-- This classpath is needed only for the compile.apply.module task-->
antonio@7933
   265
  <path id="apply.module.compile.classpath">
antonio@6907
   266
    <dirset dir="${base.modules}">
antonio@6907
   267
      <include name="*/build/classes/" />
antonio@6907
   268
    </dirset>
antonio@6907
   269
    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
antonio@7547
   270
    <pathelement path="${build.apply.module}" />
antonio@7547
   271
    <pathelement path="${base.src}" />
antonio@7547
   272
    <fileset dir="${base.lib}">
antonio@7547
   273
      <include name="**/*.jar" />
antonio@7547
   274
    </fileset>
antonio@7547
   275
    <fileset dir="${build.core.lib}">
antonio@7547
   276
      <include name="openbravo-core.jar" />
antonio@7547
   277
    </fileset>
antonio@7547
   278
    <fileset dir="${build.trl.lib}">
antonio@7547
   279
      <include name="openbravo-trl.jar" />
antonio@7547
   280
    </fileset>
antonio@7547
   281
    <fileset dir="${build.wad.lib}">
antonio@7547
   282
      <include name="openbravo-wad.jar" />
antonio@7547
   283
    </fileset>
antonio@7547
   284
    <fileset dir="${base.lib}">
antonio@7547
   285
      <include name="**/*.jar" />
antonio@7547
   286
    </fileset>
antonio@7547
   287
    <fileset dir="${base.db}/lib/">
antonio@7547
   288
      <include name="**/*.jar" />
antonio@7547
   289
    </fileset>
antonio@7547
   290
    <fileset dir="${base.modules}">
antonio@7547
   291
      <include name="*/lib/**" />
antonio@7547
   292
    </fileset>
antonio@7933
   293
  </path>
martin@14874
   294
  
antonio@7933
   295
  <!-- This classpath is needed only for the apply.module task-->
antonio@7933
   296
  <path id="apply.module.runtime.classpath">
antonio@7547
   297
    <dirset dir="${base.modules}">
antonio@7547
   298
      <include name="*/build/classes/" />
antonio@7547
   299
    </dirset>
antonio@7547
   300
    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
antonio@7545
   301
    <pathelement path="${build.apply.module}" />
antonio@7547
   302
    <pathelement path="${build}" />
antonio@7545
   303
    <pathelement path="${base.src}" />
antonio@7545
   304
    <fileset dir="${base.lib}">
antonio@7545
   305
      <include name="**/*.jar" />
antonio@7545
   306
    </fileset>
antonio@7545
   307
    <fileset dir="${build.core.lib}">
antonio@7545
   308
      <include name="openbravo-core.jar" />
antonio@7545
   309
    </fileset>
antonio@7545
   310
    <fileset dir="${build.trl.lib}">
antonio@7545
   311
      <include name="openbravo-trl.jar" />
antonio@7545
   312
    </fileset>
antonio@7545
   313
    <fileset dir="${build.wad.lib}">
antonio@7545
   314
      <include name="openbravo-wad.jar" />
antonio@7545
   315
    </fileset>
antonio@7545
   316
    <fileset dir="${base.lib}">
antonio@7545
   317
      <include name="**/*.jar" />
antonio@7545
   318
    </fileset>
antonio@7545
   319
    <fileset dir="${base.db}/lib/">
antonio@7545
   320
      <include name="**/*.jar" />
antonio@7545
   321
    </fileset>
antonio@7545
   322
    <fileset dir="${base.modules}">
antonio@7545
   323
      <include name="*/lib/**" />
antonio@7545
   324
    </fileset>
antonio@7545
   325
  </path>
martin@14874
   326
  
antonio@5620
   327
  <macrodef name="updatesystemstatus">
martin@14874
   328
     <attribute name="v" default="NOT SET"/>
martin@14874
   329
     <sequential>
martin@14874
   330
       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
martin@14874
   331
         <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
martin@14874
   332
         <transaction> UPDATE ad_system_info SET system_status='@{v}' ;
antonio@5621
   333
                       DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)
antonio@5621
   334
         </transaction>
martin@14874
   335
       </sql>
martin@14874
   336
     </sequential>
antonio@5620
   337
  </macrodef>
martin@14874
   338
  
antonio@16693
   339
  <macrodef name="updatesystemstatuswhennot">
antonio@16693
   340
    <attribute name="v" default="NOT SET"/>
antonio@16693
   341
    <attribute name="previous" default="NOT SET"/>
antonio@16693
   342
     <sequential>
antonio@16693
   343
       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
antonio@16693
   344
         <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
antonio@16693
   345
         <transaction> UPDATE ad_system_info SET system_status='@{v}' where system_status!='@{previous}' ;
antonio@16693
   346
                       DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)
antonio@16693
   347
         </transaction>
antonio@16693
   348
       </sql>
antonio@16693
   349
     </sequential>
antonio@16693
   350
  </macrodef>
antonio@16693
   351
  
martin@2871
   352
  <taskdef resource="axis-tasks.properties" classpathref="project.class.path" />
martin@14874
   353
  
asier@4277
   354
  <target name="init" depends="code.rev">
juanpablo@11543
   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@3965
   360
    <condition property="code.revision" value="${hg.id}" else="0">
juanpablo@3965
   361
      <isset property="hg.id" />
martin@2871
   362
    </condition>
martin@2871
   363
  </target>
ivan@812
   364
juanpablo@3965
   365
  <target name="set.code.rev" if="is.hg">
juanpablo@3965
   366
    <exec executable="hg" outputproperty="hg.id" failifexecutionfails="false">
martin@14874
   367
      <arg value="id"/>
martin@14874
   368
      <arg value="-i"/>
juanpablo@3965
   369
    </exec>
martin@2871
   370
  </target>
asier@43
   371
miguel@16460
   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@20733
   376
  <target name="migrate.attachments" depends="init">
shankar@20766
   377
    <taskdef name="MigrateAttachments" classname="org.openbravo.erpCommon.utility.MigrateAttachments" >
shankar@20733
   378
      <classpath refid="project.class.path" />
shankar@20766
   379
    </taskdef>
shankar@20766
   380
    <MigrateAttachments/>
shankar@20733
   381
  </target>
shankar@20733
   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@14874
   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@14874
   394
    
martin@3038
   395
    <antcall target="wad.lib" />
martin@14874
   396
    
asier@5228
   397
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
asier@5228
   398
      <classpath refid="project.class.path" />
asier@5228
   399
    </taskdef>
martin@14874
   400
    
martin@14874
   401
    <CheckSumCondition obDir="${basedir}"
martin@14874
   402
                       type="md5.wad"
martin@14874
   403
                       property="test.md5.wad"/>
martin@3038
   404
martin@3038
   405
    <condition property="new.wad">
martin@14874
   406
        <istrue value="${test.md5.wad}"/>
martin@3038
   407
    </condition>
martin@3038
   408
martin@3038
   409
    <antcall target="trl.lib" />
martin@14874
   410
    
asier@3758
   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@5618
   415
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
antonio@4933
   416
    <antcall target="build.deploy" />
antonio@16693
   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@16460
   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@6918
   459
  <target name="buildvalidation" depends="init, core.lib">
martin@14874
   460
    <updatesystemstatus v="RB11"/> 
antonio@7974
   461
    <condition property="buildValidation.var">
martin@14874
   462
      <istrue value="${buildValidation}"  />
antonio@7974
   463
    </condition>
antonio@6918
   464
    <ant dir="src-util/buildvalidation" target="buildvalidation" inheritAll="true" inheritRefs="true" />
antonio@6907
   465
  </target>
martin@14874
   466
  
antonio@6907
   467
  <target name="compile.buildvalidation" depends="init, core.lib">
antonio@6907
   468
    <ant dir="src-util/buildvalidation" target="compile" inheritAll="true" inheritRefs="true" />
antonio@6907
   469
  </target>
martin@14874
   470
  
antonio@6907
   471
  <target name="compile.modulescript" depends="init, core.lib">
antonio@6907
   472
    <ant dir="src-util/modulescript" target="compile" inheritAll="true" inheritRefs="true" />
antonio@6907
   473
  </target>
antonio@6907
   474
antonio@7539
   475
  <target name="compile.complete.deploy" depends="compile.complete.development, compile.complete.war">
antonio@7516
   476
asier@5225
   477
    <!-- Calculate wad checksum to enable smartbuild-->
asier@5228
   478
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
asier@5228
   479
      <classpath refid="project.class.path" />
asier@5228
   480
    </taskdef>
martin@14874
   481
    
martin@14874
   482
    <CheckSumCondition obDir="${basedir}"
martin@14874
   483
                           type="md5.wad"
martin@14874
   484
                           property="test.md5.wad"/>
martin@2871
   485
  </target>
asier@43
   486
asier@7208
   487
  <target name="compile.complete.development" depends="init" unless="mode.war">
martin@14874
   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@14874
   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@14874
   499
    <updatesystemstatus v="RB51"/>
martin@2871
   500
  </target>
martin@2686
   501
asier@7208
   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@7209
   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@6003
   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@6003
   534
    <echo message="Refreshing project..." level="info" />
martin@2871
   535
    <eclipse.refreshLocal resource="openbravo" depth="infinite" />
ivan@6003
   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@6003
   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@6003
   546
    <echo message="Refreshing project..." level="info" />
martin@2871
   547
    <eclipse.refreshLocal resource="openbravo" depth="infinite" />
ivan@6003
   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@3892
   556
  <target name="generate.java.doc">
martin@5205
   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@14874
   558
      <excludepackage name="org.openbravo.erpWindows.*"/>
martin@3892
   559
      <classpath>
martin@14874
   560
        <path refid="project.class.path"/>
martin@3892
   561
        <pathelement path="lib/build/js.jar" />
martin@3892
   562
      </classpath>
martin@14874
   563
      <link href="http://java.sun.com/javase/6/docs/api/"/>
martin@3892
   564
    </javadoc>
martin@3892
   565
  </target>
martin@3892
   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@5683
   584
  <target name="run.tests" depends="init">
asier@24247
   585
    <ant dir="${base.src.test}" target="run.tests" inheritAll="true" inheritRefs="true" />
martin@3723
   586
  </target>
martin@3723
   587
stefan@5683
   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@3754
   590
  </target>
martin@3754
   591
priya@6948
   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@6948
   594
  </target>
priya@6948
   595
stefan@5683
   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@3723
   598
  </target>
martin@3723
   599
stefan@3934
   600
  <target name="run.api.test.javascript">
asier@24988
   601
    <ant dir="${base.src.test}" target="run.api.test.javascript" inheritAll="true" inheritRefs="true" />
ivan@3850
   602
  </target>
martin@14874
   603
  
martin@14874
   604
  <target name="run.api.test.model" 
martin@14874
   605
          description="Checks current xml db model and dictionary API for not-allowed changes. Requires stableDBdir parameter">
stefan@9386
   606
    <taskdef name="checkAPI" classname="org.openbravo.ddlutils.task.CheckAPIDistribution">
asier@3932
   607
      <classpath refid="project.class.path" />
asier@3932
   608
    </taskdef>
martin@14874
   609
    <checkAPI driver="${bbdd.driver}" 
martin@14874
   610
                  url="${bbdd.owner.url}" 
martin@14874
   611
                  user="${bbdd.user}" 
martin@14874
   612
                  password="${bbdd.password}" 
martin@14874
   613
                  stableDBdir="${stableDBdir}"
martin@14874
   614
                  testDBdir="${basedir}"
martin@14874
   615
                  verbosity="${bbdd.verbosity}"
martin@14874
   616
    />    
asier@3932
   617
  </target>
ivan@3850
   618
stefan@20720
   619
  <target name="export.sample.data.old" depends="code.rev">
stefan@20720
   620
    <ant dir="${base.src}" target="export.sample.data.old" inheritAll="true" inheritRefs="true" />
martin@2871
   621
  </target>
juanpablo@131
   622
stefan@20720
   623
  <target name="import.sample.data.old" depends="code.rev">
stefan@20720
   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@16121
   711
  <target name="install.source" depends="init, cleanSubfolders, create.database, wad.lib, trl.lib, compile.complete.deploy">
martin@14874
   712
    <echo message="applying modules" />    
antonio@7539
   713
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
antonio@5618
   714
martin@2871
   715
    <antcall target="import.sample.data" />
martin@14874
   716
    <updatesystemstatus v="RB51"/> 
antonio@5629
   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@16121
   725
  <target name="eclipse.install.source" depends="init, cleanSubfolders, create.database">
ivan@6003
   726
    <fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
ivan@6003
   727
    <echo message="Building OpenbravoCore project..." level="info" />
martin@14874
   728
    <eclipse.incrementalBuild project="OpenbravoCore" kind="full"/>
martin@14874
   729
    <antcall target="eclipse.wad.lib"/>
martin@14874
   730
    <antcall target="eclipse.trl.lib"/>
martin@14874
   731
    <antcall target="eclipse.compile.complete"/>
martin@14874
   732
    <echo message="applying modules" />    
martin@4287
   733
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
rafael@3542
   734
    <antcall target="import.sample.data" />
martin@14874
   735
    <updatesystemstatus v="RB51"/>
antonio@6506
   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@6918
   744
  <target name="update.database" depends="init, core.lib, database.lib, buildvalidation">
martin@14874
   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@7539
   748
    <antcall target="apply.module" />
martin@2871
   749
  </target>
asier@1929
   750
antonio@6918
   751
  <target name="update.database.mod" depends="init, core.lib, database.lib, buildvalidation">
martin@14874
   752
    <updatesystemstatus v="RB12"/>
antonio@7549
   753
    <ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />
antonio@7539
   754
    <antcall target="generate.entities.quick" />
antonio@7539
   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@20720
   774
  <target name="export.sample.data" depends="init, core.lib">
stefan@20720
   775
    <ant dir="${base.db}" target="export.sample.data" inheritAll="true" inheritRefs="true" />
stefan@20720
   776
  </target>
stefan@20720
   777
stefan@20720
   778
  <target name="import.sample.data" depends="init, core.lib">
stefan@20720
   779
    <ant dir="${base.db}" target="import.sample.data" inheritAll="true" inheritRefs="true" />
stefan@20720
   780
  </target>
stefan@20720
   781
antonio@6114
   782
  <target name="db.apply.modules" if="apply.modules.on.update">
antonio@6080
   783
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
antonio@6080
   784
  </target>
antonio@6080
   785
martin@2871
   786
  <target name="db.apply.modules.sampledata" if="apply.modules.on.create">
antonio@5103
   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@8505
   793
  <target name="apply.modules">
martin@4287
   794
asier@4119
   795
    <condition property="apply.modules.complete.compilation.var">
martin@14874
   796
      <istrue value="${apply.modules.complete.compilation}"  />
asier@4119
   797
    </condition>
martin@14874
   798
    
asier@4119
   799
    <condition property="apply.modules.simple.compilation.var">
asier@4119
   800
      <isfalse value="${apply.modules.complete.compilation.var}" />
asier@4119
   801
    </condition>
antonio@7520
   802
martin@14874
   803
    <updatesystemstatus v="RB43"/>
martin@14874
   804
    <antcall target="apply.modules.compile"/>
antonio@7520
   805
antonio@5614
   806
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
antonio@7520
   807
asier@4119
   808
  </target>
martin@14874
   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@15522
   820
    <applyModule userId="0" adminMode="true" forceRefData="${forceRefData}" propertiesFile="${base.config}/Openbravo.properties"/>
martin@4287
   821
  </target>
martin@14874
   822
  
antonio@7539
   823
  <target name="compile.apply.module" depends="init">
martin@14874
   824
    <updatesystemstatus v="RB31"/>
antonio@7539
   825
    <ant dir="${base.src}" target="compile.apply.module" inheritAll="true" inheritRefs="true" />
antonio@7539
   826
  </target>
martin@14874
   827
  
antonio@7545
   828
  <!--
antonio@7545
   829
  This task uses a special classpath.
antonio@7545
   830
  This classpath is equivalent to the normal project.class.path, except for the fact that that the normal build folder
antonio@7545
   831
  is replaced by the apply.module.build folder, in which the ApplyModule task related classes will be compiled.
antonio@7545
   832
  This is done to workaround the fact that the javac task needs to compile all the related classes when upgrading openbravo
antonio@7545
   833
  and if the normal build folder is included, none of them are recompiled by default unless the whole build directory is specified.
antonio@7545
   834
  -->
antonio@7539
   835
  <target name="apply.module" depends="compile.apply.module">
antonio@6533
   836
    <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
antonio@15522
   837
      <arg line="'${base.src}' '${friendlyWarnings}' '${forceRefData}'" />
antonio@7547
   838
      <classpath refid="apply.module.runtime.classpath" />
martin@4287
   839
    </java>
martin@14874
   840
   <delete includeEmptyDirs="true"  dir="${build.apply.module}" />
martin@4287
   841
  </target>
martin@14874
   842
  
asier@6227
   843
  <target name="apply.modules.compile" depends="wad.lib">
martin@14874
   844
    <antcall target="apply.modules.compile.simple"/>
martin@14874
   845
    <antcall target="apply.modules.compile.complete"/>
asier@4119
   846
  </target>
martin@14874
   847
  
asier@4119
   848
  <target name="apply.modules.compile.simple" if="apply.modules.simple.compilation.var">
martin@2871
   849
    <antcall target="compile.deploy" />
asier@4119
   850
  </target>
martin@14874
   851
  
asier@4119
   852
  <target name="apply.modules.compile.complete" if="apply.modules.complete.compilation.var">
martin@14874
   853
     <antcall target="compile.complete.deploy" />
martin@2871
   854
  </target>
martin@14874
   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@25334
   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@14874
   888
    <antcall target="copy.files.jarsync"/>
stefan@9978
   889
stefan@9978
   890
    <java classname="org.apache.catalina.startup.Bootstrap" fork="true" spawn="true">
asier@25334
   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@19242
   958
  <target name="obx.export.validateModules" if="obx.exp.validate">
asier@19242
   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@19242
   966
asier@5533
   967
    <echo message="Validating Module..." />
asier@19242
   968
martin@14874
   969
    <WADValidation propertiesFile="${base.config}/Openbravo.properties"
martin@14874
   970
                   modules="${module}"
martin@14874
   971
                   stoponerror="true"/>
martin@3038
   972
asier@11064
   973
    <validateModules moduleJavaPackage="${module}" failOnError="true" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" />
asier@19242
   974
  </target>
asier@19242
   975
  
asier@19242
   976
  <target name="package.module">
asier@19242
   977
    <taskdef name="extractModule" classname="org.openbravo.erpCommon.modules.ExtractModuleTask">
asier@19242
   978
      <classpath refid="project.class.path" />
asier@19242
   979
    </taskdef>
asier@19242
   980
    
asier@19242
   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@19242
   985
    <extractModule moduleName="${module}" 
asier@19242
   986
                   userId="0" 
asier@19242
   987
                   adminMode="true" 
asier@19242
   988
                   propertiesFile="${base.config}/Openbravo.properties" 
asier@19242
   989
                   exportRD="${obx.export.RD}" 
asier@19242
   990
                   addAllDependencies="${obx.export.allDeps}"/>
martin@2871
   991
  </target>
juanpablo@2691
   992
martin@2871
   993
  <target name="diagnostic">
antonio@6907
   994
    <ant dir="src-util/diagnostic" antfile="build-create.xml" target="build" />
antonio@6907
   995
    <ant dir="src-util/diagnostic" target="check.all" />
martin@2871
   996
  </target>
inigo@25383
   997
  
inigo@25383
   998
  <target name="setup.compile">
inigo@25558
   999
	<mkdir dir="build/classes" />
inigo@25564
  1000
    <javac srcdir="src/org/openbravo/configuration" destdir="build/classes" fork="true" deprecation="off" encoding="UTF-8" debug="true" debuglevel="lines,vars,source" includeantruntime="false">
inigo@25558
  1001
      <classpath refid="project.class.path"/>  
inigo@25558
  1002
    </javac>
martin@2871
  1003
  </target>
juanpablo@2706
  1004
inigo@25564
  1005
  <target name="setup" depends="init, setup.compile">
inigo@25558
  1006
    <echo message="Launching configuration application..."/>
inigo@25558
  1007
    <taskdef name="configurationApp" classname="org.openbravo.configuration.ConfigurationApp">
inigo@25558
  1008
      <classpath refid="project.class.path" />
inigo@25558
  1009
    </taskdef>
inigo@25558
  1010
    <configurationApp/>
inigo@25383
  1011
    </target>
inigo@25383
  1012
  
asier@4280
  1013
  <target name="package.core" depends="init, set.version.number">
martin@14874
  1014
	<property name="tmpdir" value="${java.io.tmpdir}/ob.core${core.rev}" />
martin@14874
  1015
   
martin@14874
  1016
  	<exec executable="hg" >
martin@14874
  1017
  		<arg value="archive"/>
martin@14874
  1018
  		<arg value="${tmpdir}"/>
martin@14874
  1019
  	</exec>
martin@14874
  1020
  	
martin@14874
  1021
  	<replaceregexp file="${tmpdir}/src-db/database/sourcedata/AD_MODULE.xml"
martin@14874
  1022
                   match="(VERSION.*\[CDATA\[).*\..*\.(.*)(\]\])"
martin@14874
  1023
                   replace="\1${core.rev}\3"
martin@14874
  1024
                   byline="true"/>
martin@14874
  1025
    
martin@14874
  1026
    <echo message="${hg.id}" file="${tmpdir}/config/instance.revision"/>
martin@14874
  1027
	
martin@14874
  1028
    <delete includeEmptyDirs="true">
martin@14874
  1029
      <fileset dir="${tmpdir}/modules" includes="**/*" defaultexcludes="no"/>
martin@14874
  1030
    </delete>
martin@14874
  1031
    
martin@14874
  1032
    <zip destfile="${basedir}/core-${core.rev}.obx" basedir="${tmpdir}"/>
martin@14874
  1033
    
martin@14874
  1034
    <delete dir="${tmpdir}"/>
martin@14873
  1035
martin@14874
  1036
   </target>
martin@14874
  1037
 
martin@14874
  1038
  <target name="set.version.number" depends="set.version.from.file, set.version.calculated"/>
martin@14874
  1039
  
asier@4279
  1040
  <target name="set.version.calculated" if="calculate.core.rev">
martin@14874
  1041
    <echo message="calculating core revision..."/>
asier@4279
  1042
    <exec executable="hg" outputproperty="hg.idno" failifexecutionfails="false">
martin@14874
  1043
      <arg value="id"/>
martin@14874
  1044
      <arg value="-n"/>
asier@4279
  1045
    </exec>
guillermo@15728
  1046
        <propertyfile file="currentRevision.tmp">
guillermo@15728
  1047
          <entry key="core.rev" value="3.0.${hg.idno}"/>
guillermo@15728
  1048
        </propertyfile>
guillermo@15728
  1049
        <replaceregexp file="currentRevision.tmp"
guillermo@15728
  1050
                       match="\+"
guillermo@15728
  1051
                       replace=""
guillermo@15728
  1052
                       byline="true"
guillermo@15728
  1053
        />
guillermo@15728
  1054
        <loadproperties> 
guillermo@15728
  1055
          <file file="currentRevision.tmp"/> 
guillermo@15728
  1056
        </loadproperties>
guillermo@15728
  1057
        <delete file="currentRevision.tmp"/>
asier@4279
  1058
  </target>
martin@14874
  1059
  
asier@4279
  1060
  <target name="set.version.from.file" if="xml.core.rev">
martin@14874
  1061
    <echo message="reading core revision from xml file..."/>
asier@4279
  1062
    <loadfile property="core.rev" srcfile="${basedir}/src-db/database/sourcedata/AD_MODULE.xml">
asier@4279
  1063
      <filterchain>
asier@4279
  1064
        <linecontains>
martin@14874
  1065
          <contains value="VERSION>"/>
asier@4279
  1066
        </linecontains>
asier@4279
  1067
        <tokenfilter>
martin@14874
  1068
            <replaceregex pattern="(.*VERSION.*\[CDATA\[)(.*\..*\..*)(\]\].*)" replace="\2"/>
asier@4279
  1069
        </tokenfilter>
martin@14874
  1070
        <striplinebreaks/>
asier@4279
  1071
      </filterchain>
asier@4279
  1072
    </loadfile>
asier@4279
  1073
  </target>
martin@14874
  1074
  
asier@5536
  1075
  <target name="validate.wad">
asier@5536
  1076
    <ant dir="${base.src}" target="wadvalidation" inheritAll="true" inheritRefs="true" />
asier@5536
  1077
  </target>
martin@14874
  1078
  
antonio@7480
  1079
  <target name="UIrebuild" depends="core.lib">
antonio@7480
  1080
    <java classname="org.openbravo.base.BuildTask" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
antonio@7480
  1081
      <arg line="'${base.config}/Openbravo.properties' ${logFileName}" />
antonio@7480
  1082
      <classpath>
antonio@7480
  1083
        <pathelement path="${build.core.lib}/openbravo-core.jar" />
stefan@11940
  1084
        <pathelement path="${base.lib}/runtime/log4j-1.2.16.jar" />
stefan@11940
  1085
        <pathelement path="${base.lib}/runtime/commons-pool-1.5.6.jar" />
stefan@11940
  1086
        <pathelement path="${base.lib}/runtime/commons-dbcp-1.4.jar" />
stefan@11940
  1087
        <pathelement path="${base.lib}/runtime/postgresql-9.0-801.jdbc4.jar" />
antonio@7480
  1088
        <pathelement path="${base.lib}/runtime/ojdbc6.jar" />
stefan@11940
  1089
        <pathelement path="${base.lib}/runtime/commons-collectionsi-3.2.1.jar" />
augusto@24401
  1090
        <pathelement path="${base.lib}/runtime/ant-1.9.2.jar" />
augusto@24401
  1091
        <pathelement path="${base.lib}/runtime/ant-launcher-1.9.2.jar" />
augusto@24401
  1092
        <pathelement path="${base.lib}/runtime/ant-apache-log4j-1.9.2.jar" />
antonio@7480
  1093
        <pathelement path="${base.lib}/runtime/ant-nodeps.jar" />
antonio@7480
  1094
      </classpath>
antonio@7480
  1095
    </java>
antonio@7480
  1096
  </target>
martin@14874
  1097
  
asier@8883
  1098
  <target name="check.module.consistency">
asier@8883
  1099
    <taskdef name="checkConsistency" classname="org.openbravo.erpCommon.modules.CheckLocalConsistency">
asier@8883
  1100
      <classpath refid="project.class.path" />
asier@8883
  1101
    </taskdef>
martin@14874
  1102
    <checkConsistency userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties"/>
asier@8883
  1103
  </target>
martin@14874
  1104
  
antonio@11118
  1105
  <target name="check.window.compatibility">
antonio@11118
  1106
    <taskdef name="showclassicwindows" classname="org.openbravo.client.application.WindowsInClassicModeTask">
antonio@11118
  1107
      <classpath refid="project.class.path" />
antonio@11118
  1108
    </taskdef>
martin@14874
  1109
    <showclassicwindows userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties"/>
antonio@11118
  1110
  </target>
miguel@16121
  1111
  
miguel@16121
  1112
  <target name="cleanSubfolders" depends="init">
miguel@16121
  1113
      <ant dir="${base.src.core}" target="clean" inheritAll="true" inheritRefs="true" />
miguel@16121
  1114
      <ant dir="${base.src.trl}" target="clean" inheritAll="true" inheritRefs="true" />
miguel@16121
  1115
      <ant dir="${base.src.wad}" target="clean" inheritAll="true" inheritRefs="true" />
asier@16641
  1116
  </target>
asier@16641
  1117
  
asier@16641
  1118
  <target name="activate.instance" depends="init"
asier@16641
  1119
          description="Activates the instance with the provided public key">
asier@16641
  1120
   <taskdef name="activateInstace" classname="org.openbravo.erpCommon.obps.ActivationTask">
asier@16641
  1121
     <classpath refid="project.class.path" />
asier@16641
  1122
   </taskdef>
asier@16641
  1123
   <property name="purpose" value="" />
asier@16641
  1124
   <property name="publicKey" value="" />
asier@16641
  1125
   <property name="publicKeyFile" value="" />
asier@16641
  1126
    
asier@16641
  1127
   <activateInstace purpose="${purpose}"
asier@16641
  1128
                    publicKey="${publicKey}"
asier@16641
  1129
                    publicKeyFile="${publicKeyFile}"
asier@16641
  1130
                    userId="0" 
asier@16641
  1131
                    adminMode="true" 
asier@16641
  1132
                    propertiesFile="${base.config}/Openbravo.properties"/>
asier@16641
  1133
  </target>
miguel@16121
  1134
  
asier@43
  1135
</project>