build.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Tue, 27 Jul 2010 16:39:03 +0200
changeset 7969 3cbb2e1e1ce5
parent 7948 b788095e7704
child 7970 d91bd76b1bd0
permissions -rw-r--r--
Fixes issue 13519: disallow running ant tasks as root

To override this check, two options:
1) Add the -Dallow.root=true argument to the ant command.
2) Add allow.root=true to the config/Openbravo.properties file
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
juanpablo@1548
     5
* Version  1.0  (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
antonio@7592
    15
* All portions are Copyright (C) 2001-2010 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.client.src" location="srcClient" />
martin@2871
    72
  <property name="base.db" location="src-db/database" />
martin@2871
    73
  <property name="base.web" location="web" />
martin@2871
    74
  <property name="base.context" location="WebContent" />
martin@2871
    75
  <property name="base.design" location="${base.context}/src-loc" />
martin@2871
    76
  <property name="base.lib" location="lib" />
martin@2871
    77
  <property name="base.modules" location="modules" />
martin@2871
    78
  <property name="build" location="build/classes" />
antonio@7545
    79
  <property name="build.apply.module" location="build.apply/classes" />
martin@2871
    80
  <property name="build.AD" location="srcAD" />
martin@2871
    81
  <property name="build.sqlc" location="build/javasqlc" />
martin@2871
    82
  <property name="build.core.lib" location="src-core/lib" />
martin@2871
    83
  <property name="build.trl.lib" location="src-trl/lib" />
martin@2871
    84
  <property name="build.wad.lib" location="src-wad/lib" />
martin@2871
    85
  <property name="build.docs" location="docs/api" />
martin@2871
    86
  <property name="jakarta.home" location="${env.CATALINA_HOME}" />
martin@2871
    87
  <property name="module" value="%" />
antonio@6113
    88
  <property name="apply.on.create" value="false" />
antonio@6114
    89
  <property name="apply.on.update" value="true" />
martin@2871
    90
  <property name="obx.export.RD" value="false" />
martin@2871
    91
  <property name="obx.export.DB" value="false" />
martin@2871
    92
  <property name="obx.export.CS" value="false" />
martin@2871
    93
  <property name="chekPerms" value="false" />
antonio@2896
    94
  <property name="force" value="false" />
antonio@7751
    95
  <property name="strict.template.application" value="false" />
antonio@4937
    96
  <property name="rd" value="false" />
asier@3008
    97
  <property name="local" value="true" />
asier@4119
    98
  <property name="apply.modules.complete.compilation" value="false" />
asier@4279
    99
  <property name="calculate.core.revision" value="true"/>
asier@5284
   100
  <property name="stopOnWadError" value="false"/>
antonio@5700
   101
  <property name="friendlyWarnings" value="false"/>
antonio@6807
   102
  <property name="checkTranslationConsistency" value="true"/>
asier@2057
   103
juanpablo@3965
   104
  <available file=".hg" property="is.hg" />
martin@3038
   105
asier@4279
   106
  <condition property="calculate.core.rev">
asier@4279
   107
   <istrue value="${calculate.core.revision}"/>
asier@4279
   108
  </condition>
asier@4279
   109
  
asier@4279
   110
  <condition property="xml.core.rev">
asier@4279
   111
     <isfalse value="${calculate.core.revision}"/>
asier@4279
   112
  </condition>
asier@4279
   113
  
juanpablo@2522
   114
  <condition property="deploy.mode" value="class">
juanpablo@2522
   115
    <not>
juanpablo@2522
   116
      <isset property="${deploy.mode}" />
juanpablo@2522
   117
    </not>
juanpablo@2522
   118
  </condition>
martin@2345
   119
martin@2871
   120
  <condition property="mode.war">
martin@2871
   121
    <equals arg1="war" arg2="${deploy.mode}" />
martin@2871
   122
  </condition>
martin@2345
   123
martin@2871
   124
  <condition property="mode.class">
martin@2871
   125
    <equals arg1="class" arg2="${deploy.mode}" />
martin@2871
   126
  </condition>
martin@2345
   127
martin@2871
   128
  <condition property="apply.modules.on.create">
martin@2871
   129
    <or>
martin@2871
   130
      <equals arg1="yes" arg2="${apply.on.create}" />
martin@2871
   131
      <equals arg1="true" arg2="${apply.on.create}" />
martin@2871
   132
    </or>
martin@2871
   133
  </condition>
martin@2345
   134
antonio@6114
   135
  <condition property="apply.modules.on.update">
antonio@6114
   136
    <or>
antonio@6114
   137
      <equals arg1="yes" arg2="${apply.on.update}" />
antonio@6114
   138
      <equals arg1="true" arg2="${apply.on.update}" />
antonio@6114
   139
    </or>
antonio@6114
   140
  </condition>
antonio@6114
   141
martin@2871
   142
  <condition property="obx.exp.DB">
martin@2871
   143
    <or>
martin@2871
   144
      <equals arg1="yes" arg2="${obx.export.DB}" />
martin@2871
   145
      <equals arg1="true" arg2="${obx.export.DB}" />
martin@2871
   146
    </or>
martin@2871
   147
  </condition>
martin@2345
   148
martin@2871
   149
  <condition property="obx.exp.CS">
martin@2871
   150
    <or>
martin@2871
   151
      <equals arg1="yes" arg2="${obx.export.CS}" />
martin@2871
   152
      <equals arg1="true" arg2="${obx.export.CS}" />
martin@2871
   153
    </or>
martin@2871
   154
  </condition>
asier@43
   155
antonio@3245
   156
  <condition property="timestamp">
antonio@3245
   157
    <or>
antonio@3245
   158
      <equals arg1="no" arg2="${execute.update.build.timestamp}" />
antonio@3245
   159
      <equals arg1="false" arg2="${execute.update.build.timestamp}" />
antonio@3245
   160
    </or>
antonio@3245
   161
  </condition>
antonio@3245
   162
martin@2871
   163
  <condition property="jakarta.base" value="${env.CATALINA_BASE}" else="${jakarta.home}">
martin@2871
   164
    <and>
martin@2871
   165
      <isset property="env.CATALINA_BASE" />
martin@2871
   166
    </and>
martin@2871
   167
  </condition>
martin@2871
   168
  <property name="log.path" location="${jakarta.base}/logs" />
martin@2871
   169
  <property name="lib" location="${jakarta.home}/common" />
martin@2871
   170
  <property name="jakarta.context" location="${jakarta.base}/webapps/${context.name}" />
asier@6246
   171
juanpablo@6247
   172
  <condition property="build.maxmemory" value="1024M" else="512M">
juanpablo@6247
   173
    <or>
juanpablo@6247
   174
      <equals arg1="${os.arch}" arg2="amd64" />
juanpablo@6247
   175
      <equals arg1="${os.arch}" arg2="x86_64" />
juanpablo@6247
   176
      <equals arg1="${os.arch}" arg2="ia64" />
juanpablo@6247
   177
    </or>
asier@6246
   178
  </condition>
stefan@124
   179
juanpablo@7969
   180
  <condition property="allow.root.user" value="true" else="false">
juanpablo@7969
   181
    <or>
juanpablo@7969
   182
      <equals arg1="yes" arg2="${allow.root}" />
juanpablo@7969
   183
      <equals arg1="true" arg2="${allow.root}" />
juanpablo@7969
   184
    </or>
juanpablo@7969
   185
  </condition>
juanpablo@7969
   186
martin@2871
   187
  <condition property="no.java.home" value="true">
martin@2871
   188
    <not>
martin@2871
   189
      <isset property="env.JAVA_HOME" />
martin@2871
   190
    </not>
martin@2871
   191
  </condition>
juanpablo@1548
   192
antonio@2838
   193
  <condition property="bbdd.owner.url" value="${bbdd.url}/${bbdd.sid}" else="${bbdd.url}">
antonio@2838
   194
    <and>
martin@2871
   195
      <equals arg1="${bbdd.rdbms}" arg2="POSTGRE" />
antonio@2838
   196
    </and>
antonio@2838
   197
  </condition>
juanpablo@7969
   198
juanpablo@7969
   199
  <condition property="root.user">
juanpablo@7969
   200
    <and>
juanpablo@7969
   201
      <equals arg1="${user.name}" arg2="root" />
juanpablo@7969
   202
      <not>
juanpablo@7969
   203
        <contains string="${os.name}" substring="Windows" />
juanpablo@7969
   204
      </not>
juanpablo@7969
   205
      <equals arg1="false" arg2="${allow.root.user}" />
juanpablo@7969
   206
    </and>
juanpablo@7969
   207
  </condition>
juanpablo@7969
   208
martin@2871
   209
  <path id="project.class.path">
antonio@7939
   210
    <dirset dir="${base.modules}">
antonio@7939
   211
      <include name="*/build/classes/" />
antonio@7939
   212
    </dirset>
antonio@7939
   213
    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
martin@2871
   214
    <pathelement path="${build}" />
martin@2871
   215
    <pathelement path="${base.src}" />
martin@2871
   216
    <fileset dir="${base.lib}">
martin@2871
   217
      <include name="**/*.jar" />
martin@2871
   218
    </fileset>
martin@2871
   219
    <fileset dir="${build.core.lib}">
martin@2871
   220
      <include name="openbravo-core.jar" />
martin@2871
   221
    </fileset>
martin@2871
   222
    <fileset dir="${build.trl.lib}">
martin@2871
   223
      <include name="openbravo-trl.jar" />
martin@2871
   224
    </fileset>
martin@2871
   225
    <fileset dir="${build.wad.lib}">
martin@2871
   226
      <include name="openbravo-wad.jar" />
martin@2871
   227
    </fileset>
martin@2871
   228
    <fileset dir="${base.lib}">
martin@2871
   229
      <include name="**/*.jar" />
martin@2871
   230
    </fileset>
martin@2871
   231
    <fileset dir="${base.db}/lib/">
martin@2871
   232
      <include name="**/*.jar" />
martin@2871
   233
    </fileset>
martin@2871
   234
    <fileset dir="${base.modules}">
martin@2871
   235
      <include name="*/lib/**" />
martin@2871
   236
    </fileset>
antonio@7939
   237
  </path>
antonio@7939
   238
antonio@7939
   239
  <!-- This classpath is needed only for the compile.apply.module task-->
antonio@7939
   240
  <path id="apply.module.compile.classpath">
antonio@6907
   241
    <dirset dir="${base.modules}">
antonio@6907
   242
      <include name="*/build/classes/" />
antonio@6907
   243
    </dirset>
antonio@6907
   244
    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
antonio@7547
   245
    <pathelement path="${build.apply.module}" />
antonio@7547
   246
    <pathelement path="${base.src}" />
antonio@7547
   247
    <fileset dir="${base.lib}">
antonio@7547
   248
      <include name="**/*.jar" />
antonio@7547
   249
    </fileset>
antonio@7547
   250
    <fileset dir="${build.core.lib}">
antonio@7547
   251
      <include name="openbravo-core.jar" />
antonio@7547
   252
    </fileset>
antonio@7547
   253
    <fileset dir="${build.trl.lib}">
antonio@7547
   254
      <include name="openbravo-trl.jar" />
antonio@7547
   255
    </fileset>
antonio@7547
   256
    <fileset dir="${build.wad.lib}">
antonio@7547
   257
      <include name="openbravo-wad.jar" />
antonio@7547
   258
    </fileset>
antonio@7547
   259
    <fileset dir="${base.lib}">
antonio@7547
   260
      <include name="**/*.jar" />
antonio@7547
   261
    </fileset>
antonio@7547
   262
    <fileset dir="${base.db}/lib/">
antonio@7547
   263
      <include name="**/*.jar" />
antonio@7547
   264
    </fileset>
antonio@7547
   265
    <fileset dir="${base.modules}">
antonio@7547
   266
      <include name="*/lib/**" />
antonio@7547
   267
    </fileset>
antonio@7939
   268
  </path>
antonio@7939
   269
  
antonio@7939
   270
  <!-- This classpath is needed only for the apply.module task-->
antonio@7939
   271
  <path id="apply.module.runtime.classpath">
antonio@7547
   272
    <dirset dir="${base.modules}">
antonio@7547
   273
      <include name="*/build/classes/" />
antonio@7547
   274
    </dirset>
antonio@7547
   275
    <pathelement path="${basedir}/../../src-util/modulescript/build/classes/" />
antonio@7545
   276
    <pathelement path="${build.apply.module}" />
antonio@7547
   277
    <pathelement path="${build}" />
antonio@7545
   278
    <pathelement path="${base.src}" />
antonio@7545
   279
    <fileset dir="${base.lib}">
antonio@7545
   280
      <include name="**/*.jar" />
antonio@7545
   281
    </fileset>
antonio@7545
   282
    <fileset dir="${build.core.lib}">
antonio@7545
   283
      <include name="openbravo-core.jar" />
antonio@7545
   284
    </fileset>
antonio@7545
   285
    <fileset dir="${build.trl.lib}">
antonio@7545
   286
      <include name="openbravo-trl.jar" />
antonio@7545
   287
    </fileset>
antonio@7545
   288
    <fileset dir="${build.wad.lib}">
antonio@7545
   289
      <include name="openbravo-wad.jar" />
antonio@7545
   290
    </fileset>
antonio@7545
   291
    <fileset dir="${base.lib}">
antonio@7545
   292
      <include name="**/*.jar" />
antonio@7545
   293
    </fileset>
antonio@7545
   294
    <fileset dir="${base.db}/lib/">
antonio@7545
   295
      <include name="**/*.jar" />
antonio@7545
   296
    </fileset>
antonio@7545
   297
    <fileset dir="${base.modules}">
antonio@7545
   298
      <include name="*/lib/**" />
antonio@7545
   299
    </fileset>
antonio@7545
   300
  </path>
antonio@5620
   301
  
antonio@5620
   302
  <macrodef name="updatesystemstatus">
antonio@5620
   303
     <attribute name="v" default="NOT SET"/>
antonio@5620
   304
     <sequential>
antonio@5620
   305
       <sql driver="${bbdd.driver}" url="${bbdd.owner.url}" userid="${bbdd.user}" password="${bbdd.password}" onerror="continue" autocommit="true">
antonio@5621
   306
         <classpath> <fileset dir="${base.lib}"> <include name="**/*.jar"> </include> </fileset> </classpath>
antonio@5621
   307
         <transaction> UPDATE ad_system_info SET system_status='@{v}' ;
antonio@5621
   308
                       DELETE FROM ad_error_log where system_status=(select system_status from ad_system_info)
antonio@5621
   309
         </transaction>
antonio@5620
   310
       </sql>
antonio@5620
   311
     </sequential>
antonio@5620
   312
  </macrodef>
antonio@5620
   313
  
martin@2871
   314
  <taskdef resource="axis-tasks.properties" classpathref="project.class.path" />
asier@5225
   315
  
asier@4277
   316
  <target name="init" depends="code.rev">
martin@2871
   317
    <fail if="no.java.home" message="The environment variable JAVA_HOME is not set." />
juanpablo@7969
   318
    <fail if="root.user" message="Don't run ant tasks with the root user" />
martin@2871
   319
  </target>
stefan@124
   320
martin@2871
   321
  <target name="code.rev" depends="set.code.rev">
juanpablo@3965
   322
    <condition property="code.revision" value="${hg.id}" else="0">
juanpablo@3965
   323
      <isset property="hg.id" />
martin@2871
   324
    </condition>
martin@2871
   325
  </target>
ivan@812
   326
juanpablo@3965
   327
  <target name="set.code.rev" if="is.hg">
juanpablo@3965
   328
    <exec executable="hg" outputproperty="hg.id" failifexecutionfails="false">
juanpablo@3965
   329
      <arg value="id"/>
juanpablo@3965
   330
      <arg value="-i"/>
juanpablo@3965
   331
    </exec>
martin@2871
   332
  </target>
asier@43
   333
martin@2871
   334
  <target name="compile.complete" depends="init">
martin@2871
   335
    <ant dir="${base.src}" target="compile.complete" inheritAll="true" inheritRefs="true" />
martin@2871
   336
  </target>
asier@2853
   337
asier@3013
   338
  <target name="smartbuild" depends="init">
martin@3038
   339
    <property name="smart.mode" value="true" />
antonio@2996
   340
    <property name="onlyIfModified" value="true" />
martin@3038
   341
    <antcall target="core.lib" />
asier@4288
   342
    
asier@4288
   343
    <condition property="no.local">
asier@4288
   344
      <not>
asier@4288
   345
        <istrue value="${local}" />
asier@4288
   346
      </not>
asier@4288
   347
    </condition>
asier@4288
   348
    <antcall target="update.database.if.no.local" />
asier@4288
   349
    
martin@3038
   350
    <antcall target="wad.lib" />
asier@5225
   351
    
asier@5228
   352
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
asier@5228
   353
      <classpath refid="project.class.path" />
asier@5228
   354
    </taskdef>
asier@5228
   355
    
asier@5225
   356
    <CheckSumCondition obDir="${basedir}"
asier@5225
   357
                       type="md5.wad"
asier@5225
   358
                       property="test.md5.wad"/>
martin@3038
   359
martin@3038
   360
    <condition property="new.wad">
asier@5225
   361
        <istrue value="${test.md5.wad}"/>
martin@3038
   362
    </condition>
martin@3038
   363
martin@3038
   364
    <antcall target="trl.lib" />
asier@4288
   365
    
asier@3758
   366
    <antcall inheritall="true" inheritrefs="true" target="generate.entities.quick" />
martin@2917
   367
asier@3013
   368
    <ant dir="${base.src}" target="smartbuild" inheritAll="true" inheritRefs="true" />
martin@3038
   369
antonio@7516
   370
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
antonio@5618
   371
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
antonio@4933
   372
    <antcall target="build.deploy" />
antonio@5651
   373
    <updatesystemstatus v="RB51"/>
martin@2917
   374
    <!-- only restart tomcat if the restart prop was set to true -->
martin@2917
   375
    <condition property="dorestart">
martin@2917
   376
      <istrue value="${restart}" />
martin@2917
   377
    </condition>
martin@2917
   378
    <antcall target="if.restart.tomcat" />
martin@2871
   379
  </target>
martin@3038
   380
asier@3008
   381
  <target name="update.database.if.no.local" if="no.local">
asier@3008
   382
    <antcall target="update.database" />
asier@3008
   383
  </target>
antonio@2996
   384
asier@2982
   385
  <target name="build.deploy">
martin@3038
   386
    <antcall target="build.deploy.war" />
martin@3038
   387
    <antcall target="build.deploy.class" />
asier@2982
   388
  </target>
martin@3038
   389
asier@2982
   390
  <target name="build.deploy.class" if="mode.class">
asier@2982
   391
    <ant dir="${base.src}" target="copy.files" inheritAll="true" inheritRefs="true" />
asier@2982
   392
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" />
martin@3038
   393
    <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8" />
asier@2982
   394
  </target>
martin@3038
   395
asier@2982
   396
  <target name="build.deploy.war" if="mode.war">
martin@3038
   397
    <antcall target="war" />
asier@2982
   398
  </target>
martin@2345
   399
martin@2917
   400
  <target name="if.restart.tomcat" if="dorestart">
martin@2917
   401
    <antcall target="tomcat.restart" />
martin@2917
   402
  </target>
martin@2345
   403
martin@2871
   404
  <target name="compile" depends="init">
martin@2871
   405
    <ant dir="${base.src}" target="compile" inheritAll="true" inheritRefs="true" />
martin@2871
   406
  </target>
martin@2345
   407
antonio@6918
   408
  <target name="buildvalidation" depends="init, core.lib">
antonio@7539
   409
    <updatesystemstatus v="RB11"/> 
antonio@6918
   410
    <ant dir="src-util/buildvalidation" target="buildvalidation" inheritAll="true" inheritRefs="true" />
antonio@6907
   411
  </target>
antonio@6907
   412
  
antonio@6907
   413
  <target name="compile.buildvalidation" depends="init, core.lib">
antonio@6907
   414
    <ant dir="src-util/buildvalidation" target="compile" inheritAll="true" inheritRefs="true" />
antonio@6907
   415
  </target>
antonio@6907
   416
  
antonio@6907
   417
  <target name="compile.modulescript" depends="init, core.lib">
antonio@6907
   418
    <ant dir="src-util/modulescript" target="compile" inheritAll="true" inheritRefs="true" />
antonio@6907
   419
  </target>
antonio@6907
   420
antonio@7539
   421
  <target name="compile.complete.deploy" depends="compile.complete.development, compile.complete.war">
antonio@7516
   422
asier@5225
   423
    <!-- Calculate wad checksum to enable smartbuild-->
asier@5228
   424
    <taskdef name="CheckSumCondition" classname="org.openbravo.utils.CheckSumCondition">
asier@5228
   425
      <classpath refid="project.class.path" />
asier@5228
   426
    </taskdef>
asier@5228
   427
    
asier@5225
   428
    <CheckSumCondition obDir="${basedir}"
asier@5225
   429
                           type="md5.wad"
asier@5225
   430
                           property="test.md5.wad"/>
martin@2871
   431
  </target>
asier@43
   432
asier@7208
   433
  <target name="compile.complete.development" depends="init" unless="mode.war">
antonio@7539
   434
    <updatesystemstatus v="RB43"/>
martin@2871
   435
    <ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
martin@2871
   436
  </target>
asier@43
   437
martin@2871
   438
  <target name="compile.complete.war" depends="init" if="mode.war">
antonio@7539
   439
    <updatesystemstatus v="RB43"/>
martin@2871
   440
    <antcall target="compile.complete" />
martin@2871
   441
    <antcall target="war" />
martin@2871
   442
  </target>
asier@1929
   443
stefan@5405
   444
  <target name="compile.deploy" depends="compile.war, compile.development">
martin@2871
   445
  </target>
martin@2686
   446
asier@7208
   447
  <target name="compile.development" depends="init" unless="mode.war">
martin@2871
   448
    <ant dir="${base.src}" target="compile.development" inheritAll="true" inheritRefs="true" />
martin@2871
   449
  </target>
martin@2686
   450
martin@2871
   451
  <target name="validate.database">
martin@2871
   452
    <ant dir="${base.src}" target="validate.database" inheritAll="true" inheritRefs="true" />
martin@2871
   453
  </target>
asier@1929
   454
martin@2871
   455
  <target name="validate.modules">
martin@2871
   456
    <ant dir="${base.src}" target="validate.modules" inheritAll="true" inheritRefs="true" />
martin@2871
   457
  </target>
asier@43
   458
martin@2871
   459
  <target name="compile.war" if="mode.war">
asier@7209
   460
    <antcall target="generate.entities" />
martin@2871
   461
    <antcall target="compile" />
martin@2871
   462
    <antcall target="war" />
martin@2871
   463
  </target>
ivan@1738
   464
martin@2871
   465
  <target name="compile.web" depends="init">
martin@2871
   466
    <ant dir="${base.src}" target="compile.web" inheritAll="true" inheritRefs="true" />
martin@2871
   467
  </target>
asier@43
   468
martin@2871
   469
  <target name="compile.web.development" depends="init">
martin@2871
   470
    <ant dir="${base.src}" target="compile.web.development" inheritAll="true" inheritRefs="true" />
martin@2871
   471
  </target>
martin@2245
   472
martin@2871
   473
  <target name="eclipse.compile" depends="init">
ivan@6003
   474
    <fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
martin@2871
   475
    <ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   476
    <ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   477
    <ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   478
    <ant dir="${base.src}" target="eclipse.compile" inheritAll="true" inheritRefs="true" />
ivan@6003
   479
    <echo message="Refreshing project..." level="info" />
martin@2871
   480
    <eclipse.refreshLocal resource="openbravo" depth="infinite" />
ivan@6003
   481
    <echo message="Building project..." level="info" />
martin@2871
   482
    <eclipse.incrementalBuild project="openbravo" kind="incremental" />
martin@2871
   483
  </target>
martin@2284
   484
martin@2871
   485
  <target name="eclipse.compile.complete" depends="init">
ivan@6003
   486
    <fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
martin@2871
   487
    <ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   488
    <ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   489
    <ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2871
   490
    <ant dir="${base.src}" target="eclipse.compile.complete" inheritAll="true" inheritRefs="true" />
ivan@6003
   491
    <echo message="Refreshing project..." level="info" />
martin@2871
   492
    <eclipse.refreshLocal resource="openbravo" depth="infinite" />
ivan@6003
   493
    <echo message="Building project..." level="info" />
martin@2871
   494
    <eclipse.incrementalBuild project="openbravo" kind="full" />
martin@2871
   495
  </target>
asier@43
   496
martin@2871
   497
  <target name="compile.src.gen" depends="init">
martin@2871
   498
    <ant dir="${base.src}" target="compile.src.gen" inheritAll="true" inheritRefs="true" />
martin@2871
   499
  </target>
martin@2830
   500
martin@3892
   501
  <target name="generate.java.doc">
martin@5205
   502
    <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@4089
   503
      <excludepackage name="org.openbravo.erpWindows.*"/>
martin@3892
   504
      <classpath>
martin@3892
   505
        <path refid="project.class.path"/>
martin@3892
   506
        <pathelement path="lib/build/js.jar" />
martin@3892
   507
      </classpath>
martin@4017
   508
      <link href="http://java.sun.com/javase/6/docs/api/"/>
martin@3892
   509
    </javadoc>
martin@3892
   510
  </target>
martin@3892
   511
martin@2871
   512
  <target name="generate.entities">
martin@2871
   513
    <ant dir="${base.src}" target="generate.entities" inheritAll="true" inheritRefs="true" />
martin@2871
   514
  </target>
asier@43
   515
martin@2871
   516
  <target name="generate.entities.quick">
martin@2871
   517
    <ant dir="${base.src}" target="generate.entities.quick" inheritAll="true" inheritRefs="true" />
martin@2871
   518
  </target>
juanpablo@131
   519
stefan@5683
   520
  <target name="run.tests" depends="init">
martin@3723
   521
    <ant dir="${base.src}" target="run.tests" inheritAll="true" inheritRefs="true" />
martin@3723
   522
  </target>
martin@3723
   523
stefan@5683
   524
  <target name="run.all.tests" depends="init">
martin@3754
   525
    <ant dir="${base.src}" target="run.all.tests" inheritAll="true" inheritRefs="true" />
martin@3754
   526
  </target>
martin@3754
   527
priya@6948
   528
  <target name="run.webservice.tests" depends="init">
priya@6948
   529
      <ant dir="${base.src}" target="run.webservice.tests" inheritAll="true" inheritRefs="true" />
priya@6948
   530
  </target>
priya@6948
   531
stefan@5683
   532
  <target name="run.quick.tests" depends="init">
martin@3723
   533
    <ant dir="${base.src}" target="run.quick.tests" inheritAll="true" inheritRefs="true" />
martin@3723
   534
  </target>
martin@3723
   535
stefan@3934
   536
  <target name="run.api.test.javascript">
stefan@3934
   537
    <ant dir="${base.src}" target="run.api.test.javascript" inheritAll="true" inheritRefs="true" />
ivan@3850
   538
  </target>
asier@3932
   539
  
asier@3932
   540
  <target name="run.api.test.model" 
asier@3932
   541
          description="Checks current xml db model and dictionary API for not-allowed changes. Requires stableDBdir parameter">
asier@3932
   542
    <taskdef name="checkAPI" classname="org.openbravo.ddlutils.task.CheckAPI">
asier@3932
   543
      <classpath refid="project.class.path" />
asier@3932
   544
    </taskdef>
asier@3932
   545
    <checkAPI driver="${bbdd.driver}" 
asier@3932
   546
                  url="${bbdd.owner.url}" 
asier@3932
   547
                  user="${bbdd.user}" 
asier@3932
   548
                  password="${bbdd.password}" 
asier@3932
   549
                  stableDBdir="${stableDBdir}"
asier@3932
   550
                  testDBdir="${base.src.db}/database"
asier@3932
   551
                  verbosity="${bbdd.verbosity}"
antonio@6668
   552
    />    
asier@3932
   553
  </target>
ivan@3850
   554
martin@2871
   555
  <target name="export.sample.data" depends="code.rev">
martin@2871
   556
    <ant dir="${base.src}" target="export.sample.data" inheritAll="true" inheritRefs="true" />
martin@2871
   557
  </target>
juanpablo@131
   558
martin@2871
   559
  <target name="import.sample.data" depends="code.rev">
martin@2871
   560
    <ant dir="${base.src}" target="import.sample.data" inheritAll="true" inheritRefs="true" />
martin@2871
   561
  </target>
juanpablo@131
   562
martin@2871
   563
  <target name="compile.src" depends="init">
martin@2871
   564
    <ant dir="${base.src}" target="compile.src" inheritAll="true" inheritRefs="true" />
martin@2871
   565
  </target>
juanpablo@131
   566
martin@2871
   567
  <target name="war" depends="init">
martin@2871
   568
    <ant dir="${base.src}" target="build.war" inheritAll="true" inheritRefs="true" />
martin@2871
   569
  </target>
juanpablo@131
   570
martin@2871
   571
  <target name="core.docs" depends="init">
martin@2871
   572
    <ant dir="${base.src.core}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2871
   573
  </target>
juanpablo@131
   574
martin@2871
   575
  <target name="core.lib" depends="init">
martin@2871
   576
    <ant dir="${base.src.core}" target="build" inheritAll="true" inheritRefs="true" />
martin@2871
   577
    <antcall target="copy.core.lib" />
martin@2871
   578
  </target>
juanpablo@131
   579
martin@2871
   580
  <target name="copy.core.lib">
asier@2994
   581
    <copy file="${base.src.core}/lib/openbravo-core.jar" todir="${base.lib}/runtime" failonerror="false" />
martin@2871
   582
  </target>
juanpablo@131
   583
martin@2871
   584
  <target name="eclipse.wad.lib" depends="init">
martin@2871
   585
    <ant dir="${base.src.wad}" target="sqlc" inheritAll="true" inheritRefs="true" />
martin@2871
   586
    <eclipse.refreshLocal resource="OpenbravoWAD" depth="infinite" />
martin@2871
   587
    <eclipse.incrementalBuild project="OpenbravoWAD" kind="full" />
martin@2871
   588
  </target>
asier@43
   589
martin@2871
   590
  <target name="wad.docs" depends="init">
martin@2871
   591
    <ant dir="${base.src.wad}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2871
   592
  </target>
juanpablo@179
   593
martin@2871
   594
  <target name="wad.lib" depends="init">
martin@2871
   595
    <ant dir="${base.src.wad}" target="build" inheritAll="true" inheritRefs="true" />
martin@2871
   596
  </target>
juanpablo@179
   597
martin@2871
   598
  <target name="eclipse.trl.lib" depends="init">
martin@2871
   599
    <ant dir="${base.src.trl}" target="sqlc" inheritAll="true" inheritRefs="true" />
martin@2871
   600
    <eclipse.refreshLocal resource="OpenbravoTrl" depth="infinite" />
martin@2871
   601
    <eclipse.incrementalBuild project="OpenbravoTrl" kind="full" />
martin@2871
   602
  </target>
juanpablo@179
   603
martin@2871
   604
  <target name="trl.docs" depends="init">
martin@2871
   605
    <ant dir="${base.src.trl}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2871
   606
  </target>
asier@43
   607
martin@2871
   608
  <target name="trl.lib" depends="init">
martin@2871
   609
    <ant dir="${base.src.trl}" target="build" inheritAll="true" inheritRefs="true" />
martin@2871
   610
  </target>
asier@43
   611
martin@2871
   612
  <target name="database.lib" depends="init">
martin@2871
   613
    <ant dir="${base.src.db}" target="jar" inheritAll="true" inheritRefs="true" />
asier@2995
   614
    <copy file="${base.src.db}/build/lib/dbmanager.jar" todir="${base.db}/lib" failonerror="false" />
martin@2871
   615
  </target>
martin@2345
   616
martin@2871
   617
  <target name="clean" depends="init">
martin@2871
   618
    <ant dir="${base.src}" target="clean" inheritAll="true" inheritRefs="true" />
martin@2871
   619
  </target>
martin@2345
   620
martin@2871
   621
  <target name="trl.clean" depends="init">
martin@2871
   622
    <ant dir="${base.src}" target="trl.clean" inheritAll="true" inheritRefs="true" />
martin@2871
   623
  </target>
martin@2345
   624
martin@2871
   625
  <target name="translate" depends="init">
martin@2871
   626
    <ant dir="${base.src}" target="translate" inheritAll="true" inheritRefs="true" />
martin@2871
   627
  </target>
martin@2686
   628
martin@2871
   629
  <target name="translate.modules" depends="init">
martin@2871
   630
    <ant dir="${base.src}" target="translate.modules" inheritAll="true" inheritRefs="true" />
martin@2871
   631
  </target>
martin@2871
   632
martin@2871
   633
  <target name="installWebService" depends="init">
martin@2871
   634
    <ant dir="${base.src}" target="installWebService" inheritAll="true" inheritRefs="true">
martin@2871
   635
      <property name="wsdd" value="1" />
martin@2871
   636
    </ant>
martin@2871
   637
  </target>
martin@2871
   638
martin@2871
   639
  <target name="uninstallWebService" depends="init">
martin@2871
   640
    <ant dir="${base.src}" target="uninstallWebService" inheritAll="true" inheritRefs="true" />
martin@2871
   641
  </target>
martin@2871
   642
stefan@5405
   643
  <target name="install.source" depends="init, create.database, wad.lib, trl.lib, compile.complete.deploy">
antonio@7539
   644
    <echo message="applying modules" />    
antonio@7539
   645
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
antonio@5618
   646
martin@2871
   647
    <antcall target="import.sample.data" />
antonio@4965
   648
    <antcall target="load.logoimages" />
antonio@6506
   649
    <updatesystemstatus v="RB51"/> 
antonio@5629
   650
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
martin@2871
   651
martin@2871
   652
    <!--
martin@2686
   653
		<antcall target="validate.database" />
martin@2686
   654
		<antcall target="validate.modules" />
martin@2704
   655
		-->
martin@2871
   656
  </target>
juanpablo@131
   657
stefan@5405
   658
  <target name="eclipse.install.source" depends="init, create.database">
ivan@6003
   659
    <fail unless="eclipse.running" message="eclipse.* tasks must be executed inside Eclipse" />
ivan@6003
   660
    <echo message="Building OpenbravoCore project..." level="info" />
rafael@3542
   661
    <eclipse.incrementalBuild project="OpenbravoCore" kind="full"/>
rafael@3542
   662
    <antcall target="eclipse.wad.lib"/>
rafael@3542
   663
    <antcall target="eclipse.trl.lib"/>
rafael@3542
   664
    <antcall target="eclipse.compile.complete"/>
martin@4287
   665
    <echo message="applying modules" />    
martin@4287
   666
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
rafael@3542
   667
    <antcall target="import.sample.data" />
antonio@6506
   668
    <updatesystemstatus v="RB51"/>
antonio@6506
   669
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
martin@2871
   670
  </target>
asier@43
   671
stefan@5405
   672
  <target name="create.database" depends="init, core.lib, database.lib">
martin@2871
   673
    <ant dir="${base.db}" antfile="build-create.xml" target="create.database" inheritAll="true" inheritRefs="true" />
martin@2871
   674
    <antcall target="db.apply.modules.sampledata" />
martin@2871
   675
  </target>
antonio@1335
   676
antonio@6918
   677
  <target name="update.database" depends="init, core.lib, database.lib, buildvalidation">
antonio@7539
   678
    <updatesystemstatus v="RB12"/>
antonio@4870
   679
    <ant dir="${base.db}" target="update.database.java" inheritAll="true" inheritRefs="true" />
martin@4287
   680
    <antcall target="generate.entities.quick" />
antonio@7539
   681
    <antcall target="apply.module" />
martin@2871
   682
  </target>
asier@1929
   683
antonio@6918
   684
  <target name="update.database.mod" depends="init, core.lib, database.lib, buildvalidation">
antonio@7539
   685
    <updatesystemstatus v="RB12"/>
antonio@7549
   686
    <ant dir="${base.db}" target="update.database.mod.java" inheritAll="true" inheritRefs="true" />
antonio@7539
   687
    <antcall target="generate.entities.quick" />
antonio@7539
   688
    <antcall target="apply.module" />
martin@2871
   689
  </target>
asier@43
   690
stefan@5405
   691
  <target name="create.database.script" depends="init, core.lib">
martin@2871
   692
    <ant dir="${base.db}" target="create.database.script" inheritAll="true" inheritRefs="true" />
martin@2871
   693
  </target>
asier@43
   694
stefan@5405
   695
  <target name="update.database.script" depends="init, core.lib">
martin@2871
   696
    <ant dir="${base.db}" target="update.database.script" inheritAll="true" inheritRefs="true" />
martin@2871
   697
  </target>
adrian@97
   698
antonio@5420
   699
  <target name="export.database" depends="init, core.lib, database.lib, generate.entities.quick">
martin@2871
   700
    <ant dir="${base.db}" target="export.database.structure" inheritAll="true" inheritRefs="true" />
martin@2871
   701
  </target>
adrian@164
   702
stefan@5405
   703
  <target name="export.config.script" depends="init, core.lib">
martin@2871
   704
    <ant dir="${base.db}" target="export.config.script" inheritAll="true" inheritRefs="true" />
martin@2871
   705
  </target>
asier@1929
   706
antonio@6114
   707
  <target name="db.apply.modules" if="apply.modules.on.update">
antonio@6080
   708
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
antonio@6080
   709
  </target>
antonio@6080
   710
martin@2871
   711
  <target name="db.apply.modules.sampledata" if="apply.modules.on.create">
antonio@5103
   712
    <antcall target="generate.entities" />
martin@4287
   713
    <antcall inheritall="true" inheritrefs="true" target="apply.module" />
martin@2871
   714
    <antcall target="import.sample.data" />
antonio@4965
   715
    <antcall target="load.logoimages" />
martin@2871
   716
  </target>
martin@2345
   717
martin@4287
   718
antonio@6907
   719
  <target name="apply.modules" depends="update.database.mod">
martin@4287
   720
asier@4119
   721
    <condition property="apply.modules.complete.compilation.var">
asier@4119
   722
      <istrue value="${apply.modules.complete.compilation}"  />
asier@4119
   723
    </condition>
asier@4119
   724
    
asier@4119
   725
    <condition property="apply.modules.simple.compilation.var">
asier@4119
   726
      <isfalse value="${apply.modules.complete.compilation.var}" />
asier@4119
   727
    </condition>
antonio@7520
   728
antonio@7539
   729
    <updatesystemstatus v="RB43"/>
asier@4119
   730
    <antcall target="apply.modules.compile"/>
antonio@7520
   731
antonio@5614
   732
    <ant dir="${base.db}" target="setApplied" inheritAll="true" inheritRefs="true" />
antonio@7520
   733
asier@4119
   734
  </target>
asier@4119
   735
  
martin@4287
   736
  <target name="apply.module.forked">
martin@4287
   737
    <!-- 
martin@4287
   738
    Note: set reinitializeModel to false because otherwise the dal is re-initialized with classes and a model
martin@4287
   739
    which are not in sync (see issue: https://issues.openbravo.com/view.php?id=9376)
martin@4287
   740
    Note: applyModule can also be moved to a java task to fork it (to prevent this from occuring)
martin@4287
   741
    but then no output is visible for the user.
martin@4287
   742
    -->
martin@4287
   743
    <taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
martin@4287
   744
      <classpath refid="project.class.path" />
martin@4287
   745
    </taskdef>
martin@5458
   746
    <applyModule userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties"/>
martin@4287
   747
  </target>
antonio@7539
   748
  
antonio@7539
   749
  <target name="compile.apply.module" depends="init">
antonio@7541
   750
    <updatesystemstatus v="RB31"/>
antonio@7539
   751
    <ant dir="${base.src}" target="compile.apply.module" inheritAll="true" inheritRefs="true" />
antonio@7539
   752
  </target>
antonio@7539
   753
  
antonio@7545
   754
  <!--
antonio@7545
   755
  This task uses a special classpath.
antonio@7545
   756
  This classpath is equivalent to the normal project.class.path, except for the fact that that the normal build folder
antonio@7545
   757
  is replaced by the apply.module.build folder, in which the ApplyModule task related classes will be compiled.
antonio@7545
   758
  This is done to workaround the fact that the javac task needs to compile all the related classes when upgrading openbravo
antonio@7545
   759
  and if the normal build folder is included, none of them are recompiled by default unless the whole build directory is specified.
antonio@7545
   760
  -->
antonio@7539
   761
  <target name="apply.module" depends="compile.apply.module">
antonio@6533
   762
    <java classname="org.openbravo.erpCommon.modules.ApplyModuleTask" fork="true" maxmemory="${build.maxmemory}" failonerror="true">
ivan@5167
   763
      <arg line="'${base.src}'" />
antonio@7547
   764
      <classpath refid="apply.module.runtime.classpath" />
martin@4287
   765
    </java>
antonio@7545
   766
   <delete includeEmptyDirs="true"  dir="${build.apply.module}" />
martin@4287
   767
  </target>
asier@4119
   768
  
asier@6227
   769
  <target name="apply.modules.compile" depends="wad.lib">
asier@4119
   770
    <antcall target="apply.modules.compile.simple"/>
asier@4119
   771
    <antcall target="apply.modules.compile.complete"/>
asier@4119
   772
  </target>
asier@4119
   773
  
asier@4119
   774
  <target name="apply.modules.compile.simple" if="apply.modules.simple.compilation.var">
martin@2871
   775
    <antcall target="compile.deploy" />
asier@4119
   776
  </target>
asier@4119
   777
  
asier@4119
   778
  <target name="apply.modules.compile.complete" if="apply.modules.complete.compilation.var">
asier@4119
   779
     <antcall target="compile.complete.deploy" />
martin@2871
   780
  </target>
martin@4106
   781
  
martin@2871
   782
  <!-- 
martin@2345
   783
		apparently this does not overwrite the default catalina_opts, only
martin@2345
   784
		if it is not set will it be set to the value below 
martin@2345
   785
	-->
martin@2871
   786
  <property name="env.CATALINA_OPTS" value="-XX:MaxPermSize=128M" />
martin@2345
   787
martin@2871
   788
  <!-- 
martin@2345
   789
		This task is called from the Openbravo ui, it spawns a java call which again
martin@2345
   790
		calls the restart.tomcat.do task as a spawned task.
martin@2345
   791
	-->
martin@2871
   792
  <target name="tomcat.restart" description="Restart the tomcat server process">
martin@2917
   793
    <echo message="Restarting tomcat..." />
martin@2871
   794
    <java classname="org.openbravo.service.system.RestartTomcat" spawn="true" fork="true" maxmemory="${build.maxmemory}">
martin@2871
   795
      <arg line="${base.src}" />
martin@2871
   796
      <classpath refid="project.class.path" />
martin@2871
   797
    </java>
martin@2871
   798
  </target>
martin@2345
   799
martin@2871
   800
  <!--
martin@2345
   801
		Is called by the org.openbravo.service.system.RestartTomcat class.
martin@2345
   802
	-->
martin@2871
   803
  <target name="tomcat.restart.do" description="Restart the tomcat server process">
martin@2871
   804
    <echo message="Restarting Tomcat at ${env.CATALINA_HOME}" />
martin@2871
   805
    <java classname="org.apache.catalina.startup.Bootstrap" fork="true">
martin@2871
   806
      <classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar" />
martin@2871
   807
      <jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
martin@2871
   808
      <jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
martin@2871
   809
      <arg line="stop" />
martin@2871
   810
    </java>
martin@2871
   811
    <sleep description="Wait to give tomcat time to stop" seconds="20" />
martin@2871
   812
    <java classname="org.apache.catalina.startup.Bootstrap" failonerror="true" fork="true">
martin@2871
   813
      <classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar" />
martin@2871
   814
      <!-- note because CATALINA_OPTS can be multi argument the line attribute has to be used! -->
martin@2871
   815
      <jvmarg line="${env.CATALINA_OPTS}" />
martin@2871
   816
      <jvmarg value="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" />
martin@2871
   817
      <jvmarg value="-Djava.util.logging.config.file=${env.CATALINA_BASE}/conf/logging.properties" />
martin@2871
   818
      <jvmarg value="-Djava.endorsed.dirs=${env.CATALINA_HOME}/endorsed" />
martin@2871
   819
      <jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
martin@2871
   820
      <jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
martin@2871
   821
      <jvmarg value="-Djava.io.tmpdir=${env.CATALINA_BASE}/temp" />
martin@2871
   822
      <arg line="start" />
martin@2871
   823
    </java>
martin@2871
   824
  </target>
martin@2345
   825
martin@2871
   826
  <!-- 
martin@2345
   827
		This task is called from the Openbravo ui, it spawns a java call which again
martin@2345
   828
		calls the tomcat.reload.do task as a spawned task.
martin@2345
   829
	-->
martin@2871
   830
  <target name="tomcat.reload" description="Reload the Openbravo context">
martin@2917
   831
    <echo message="Reloading webapp..." />
martin@2871
   832
    <java classname="org.openbravo.service.system.ReloadContext" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" spawn="true" fork="true">
martin@2871
   833
      <arg line="${base.src}" />
martin@2871
   834
      <classpath refid="project.class.path" />
martin@2871
   835
    </java>
martin@2871
   836
  </target>
martin@2345
   837
martin@2871
   838
  <target name="tomcat.reload.do">
martin@2871
   839
    <taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
martin@2871
   840
      <classpath refid="project.class.path" />
martin@2871
   841
    </taskdef>
martin@2871
   842
    <reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
martin@2871
   843
  </target>
adrian@171
   844
martin@2871
   845
  <target name="tomcat.list">
martin@2871
   846
    <taskdef name="list" classname="org.apache.catalina.ant.ListTask">
martin@2871
   847
      <classpath refid="project.class.path" />
martin@2871
   848
    </taskdef>
martin@2871
   849
    <list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
martin@2871
   850
  </target>
martin@2345
   851
martin@2871
   852
  <target name="deploy.context">
martin@2871
   853
    <taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
martin@2871
   854
      <classpath refid="project.class.path" />
martin@2871
   855
    </taskdef>
martin@2871
   856
    <taskdef name="deploy.tomcat" classname="org.apache.catalina.ant.DeployTask">
martin@2871
   857
      <classpath refid="project.class.path" />
martin@2871
   858
    </taskdef>
martin@2871
   859
    <taskdef name="start" classname="org.apache.catalina.ant.StartTask">
martin@2871
   860
      <classpath refid="project.class.path" />
martin@2871
   861
    </taskdef>
martin@2345
   862
martin@2871
   863
    <undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" failonerror="false" />
martin@2871
   864
    <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
   865
    <start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
martin@2871
   866
  </target>
martin@2345
   867
martin@2871
   868
  <target name="generate-wsdd">
martin@2871
   869
    <ant dir="${base.src}" target="generate-wsdd" inheritAll="true" inheritRefs="true" />
martin@2871
   870
  </target>
martin@2345
   871
martin@2871
   872
  <target name="obx.export.database" if="obx.exp.DB">
martin@2871
   873
    <antcall target="export.database" />
martin@2871
   874
  </target>
martin@2345
   875
martin@2871
   876
  <target name="obx.export.config.script" if="obx.exp.CS">
martin@2871
   877
    <antcall target="export.config.script" />
martin@2871
   878
  </target>
martin@2345
   879
martin@2871
   880
  <target name="package.module">
martin@2871
   881
    <taskdef name="extractModule" classname="org.openbravo.erpCommon.modules.ExtractModuleTask">
martin@2871
   882
      <classpath refid="project.class.path" />
martin@2871
   883
    </taskdef>
martin@2345
   884
martin@3038
   885
    <taskdef name="validateModules" classname="org.openbravo.service.system.SystemValidationTask">
martin@3038
   886
      <classpath refid="project.class.path" />
martin@3038
   887
    </taskdef>
asier@5533
   888
    
asier@5560
   889
    <taskdef name="WADValidation" classname="org.openbravo.wad.validation.WADValidatorTask">
asier@5533
   890
      <classpath refid="project.class.path" />
asier@5533
   891
    </taskdef>
asier@5533
   892
            
asier@5533
   893
    <echo message="Validating Module..." />
asier@5533
   894
    
asier@5533
   895
    <WADValidation propertiesFile="${base.config}/Openbravo.properties"
asier@5533
   896
                   modules="${module}"
asier@5533
   897
                   stoponerror="true"/>
martin@3038
   898
martin@5458
   899
    <validateModules moduleJavaPackage="${module}" failOnError="false" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" type="module" />
martin@3038
   900
martin@2871
   901
    <antcall target="obx.export.database" />
martin@2871
   902
    <antcall target="obx.export.config.script" />
juanpablo@2691
   903
martin@5458
   904
    <extractModule moduleName="${module}" userId="0" adminMode="true" propertiesFile="${base.config}/Openbravo.properties" exportRD="${obx.export.RD}" />
martin@2871
   905
  </target>
juanpablo@2691
   906
martin@2871
   907
  <target name="diagnostic">
antonio@6907
   908
    <ant dir="src-util/diagnostic" antfile="build-create.xml" target="build" />
antonio@6907
   909
    <ant dir="src-util/diagnostic" target="check.all" />
martin@2871
   910
  </target>
juanpablo@2691
   911
martin@3038
   912
  <target name="setup.check.os">
martin@2871
   913
    <condition property="osname" value="linux">
martin@2871
   914
      <equals arg1="${os.name}" arg2="Linux" />
martin@2871
   915
    </condition>
juanpablo@3949
   916
    <condition property="osname" value="freebsd6">
martin@2871
   917
      <equals arg1="${os.name}" arg2="FreeBSD" />
martin@2871
   918
    </condition>
martin@2871
   919
    <condition property="osname" value="windows">
martin@2871
   920
      <contains string="${os.name}" substring="Windows" />
martin@2871
   921
    </condition>
martin@2871
   922
    <condition property="osname" value="osx">
martin@2871
   923
      <contains string="${os.name}" substring="OS X" />
martin@2871
   924
    </condition>
juanpablo@4100
   925
    <condition property="osname" value="solaris">
martin@2871
   926
      <or>
martin@2871
   927
        <contains string="${os.name}" substring="Solaris" />
martin@2871
   928
        <contains string="${os.name}" substring="SunOS" />
martin@2871
   929
      </or>
martin@2871
   930
    </condition>
martin@2871
   931
    <condition property="osname" value="openbsd">
martin@2871
   932
      <equals arg1="${os.name}" arg2="OpenBSD" />
martin@2871
   933
    </condition>
martin@2871
   934
    <condition property="osname" value="aix">
martin@2871
   935
      <equals arg1="${os.name}" arg2="AIX" />
martin@2871
   936
    </condition>
martin@2871
   937
    <condition property="osname" value="hpux">
martin@2871
   938
      <equals arg1="${os.name}" arg2="HPUX" />
martin@2871
   939
    </condition>
martin@2871
   940
  </target>
juanpablo@2706
   941
martin@2871
   942
  <target name="setup.check.arch">
martin@2871
   943
    <condition property="osarch" value="">
martin@2871
   944
      <or>
martin@2871
   945
        <equals arg1="${os.arch}" arg2="x86" />
martin@2871
   946
        <equals arg1="${os.arch}" arg2="i386" />
juanpablo@7948
   947
        <contains string="${os.name}" substring="Windows" />
martin@2871
   948
      </or>
martin@2871
   949
    </condition>
martin@2871
   950
    <condition property="osarch" value="-x64">
martin@2871
   951
      <or>
martin@2871
   952
        <equals arg1="${os.arch}" arg2="amd64" />
martin@2871
   953
        <equals arg1="${os.arch}" arg2="x86_64" />
juanpablo@7948
   954
        <not>
juanpablo@7948
   955
          <contains string="${os.name}" substring="Windows" />
juanpablo@7948
   956
        </not>
martin@2871
   957
      </or>
martin@2871
   958
    </condition>
martin@2871
   959
    <condition property="osarch" value="-ia64">
martin@2871
   960
      <equals arg1="${os.arch}" arg2="ia64" />
martin@2871
   961
    </condition>
martin@2871
   962
    <condition property="osarch" value="-sparc">
martin@2871
   963
      <equals arg1="${os.arch}" arg2="sparc" />
martin@2871
   964
    </condition>
martin@2871
   965
    <condition property="osarch" value="-ppc">
martin@2871
   966
      <equals arg1="${os.arch}" arg2="ppc" />
martin@2871
   967
    </condition>
martin@2871
   968
  </target>
martin@2871
   969
martin@2871
   970
  <target name="setup.exists.test">
martin@2871
   971
    <condition property="bin.ext" value="exe" else="bin">
martin@2871
   972
      <os family="windows" />
martin@2871
   973
    </condition>
martin@2871
   974
martin@2871
   975
    <available file="config/setup-properties-${osname}${osarch}.${bin.ext}" property="setup.exists" value="true" />
martin@2871
   976
  </target>
martin@2871
   977
martin@2871
   978
  <target name="setup" depends="setup.check.os, setup.check.arch, setup.exists.test" unless="setup.exists">
martin@2871
   979
    <get src="https://dev.openbravo.com/svn/packaging/setup/output/setup-properties-${osname}${osarch}.${bin.ext}" dest="config/setup-properties-${osname}${osarch}.${bin.ext}" verbose="true" />
martin@2871
   980
martin@2871
   981
    <chmod file="config/setup-properties-${osname}${osarch}.${bin.ext}" perm="+x" />
martin@2871
   982
  </target>
juanpablo@2691
   983
asier@4280
   984
  <target name="package.core" depends="init, set.version.number">
asier@4278
   985
	<property name="tmpdir" value="${java.io.tmpdir}/ob.core${core.rev}" />
asier@4278
   986
   
asier@4278
   987
  	<exec executable="hg" >
asier@4278
   988
  		<arg value="archive"/>
asier@4278
   989
  		<arg value="${tmpdir}"/>
asier@4278
   990
  	</exec>
asier@4278
   991
  	
asier@4278
   992
  	<replaceregexp file="${tmpdir}/src-db/database/sourcedata/AD_MODULE.xml"
asier@4279
   993
                   match="(VERSION.*\[CDATA\[).*\..*\.(.*)(\]\])"
asier@4278
   994
                   replace="\1${core.rev}\3"
asier@4278
   995
                   byline="true"/>
asier@4278
   996
    
asier@4280
   997
    <echo message="${hg.id}" file="${tmpdir}/config/instance.revision"/>
asier@4280
   998
    
asier@4279
   999
    <zip destfile="${basedir}/core-${core.rev}.obx" basedir="${tmpdir}"/>
asier@4278
  1000
    
asier@4278
  1001
    <delete dir="${tmpdir}"/>
asier@4278
  1002
asier@4278
  1003
   </target>
asier@4279
  1004
 
asier@4279
  1005
  <target name="set.version.number" depends="set.version.from.file, set.version.calculated"/>
asier@4279
  1006
  
asier@4279
  1007
  <target name="set.version.calculated" if="calculate.core.rev">
asier@4279
  1008
    <echo message="calculating core revision..."/>
asier@4279
  1009
    <exec executable="hg" outputproperty="hg.idno" failifexecutionfails="false">
asier@4279
  1010
      <arg value="id"/>
asier@4279
  1011
      <arg value="-n"/>
asier@4279
  1012
    </exec>
asier@4279
  1013
    <taskdef name="CoreRevision" classname="org.openbravo.erpCommon.utility.CalculateCoreRevision">
asier@4279
  1014
            <classpath refid="project.class.path" />
asier@4279
  1015
          </taskdef>
asier@4279
  1016
asier@4279
  1017
    <CoreRevision hgRevNo="${hg.idno}" revision="core.rev"/>
asier@4279
  1018
  </target>
asier@4279
  1019
  
asier@4279
  1020
  <target name="set.version.from.file" if="xml.core.rev">
asier@4279
  1021
    <echo message="reading core revision from xml file..."/>
asier@4279
  1022
    <loadfile property="core.rev" srcfile="${basedir}/src-db/database/sourcedata/AD_MODULE.xml">
asier@4279
  1023
      <filterchain>
asier@4279
  1024
        <linecontains>
asier@4279
  1025
          <contains value="VERSION>"/>
asier@4279
  1026
        </linecontains>
asier@4279
  1027
        <tokenfilter>
asier@4279
  1028
            <replaceregex pattern="(.*VERSION.*\[CDATA\[)(.*\..*\..*)(\]\].*)" replace="\2"/>
asier@4279
  1029
        </tokenfilter>
gorka@5142
  1030
        <striplinebreaks/>
asier@4279
  1031
      </filterchain>
asier@4279
  1032
    </loadfile>
asier@4279
  1033
  </target>
antonio@4917
  1034
  
antonio@4917
  1035
  
antonio@4965
  1036
  <target name="load.logoimages">
antonio@4965
  1037
    <ant dir="${base.src}" target="load.logoimages" inheritAll="true" inheritRefs="true" />
antonio@4917
  1038
  </target>
asier@5536
  1039
  
asier@5536
  1040
  <target name="validate.wad">
asier@5536
  1041
    <ant dir="${base.src}" target="wadvalidation" inheritAll="true" inheritRefs="true" />
asier@5536
  1042
  </target>
antonio@7480
  1043
  
antonio@7480
  1044
  <target name="UIrebuild" depends="core.lib">
antonio@7480
  1045
    <java classname="org.openbravo.base.BuildTask" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
antonio@7480
  1046
      <arg line="'${base.config}/Openbravo.properties' ${logFileName}" />
antonio@7480
  1047
      <classpath>
antonio@7480
  1048
        <pathelement path="${build.core.lib}/openbravo-core.jar" />
antonio@7480
  1049
        <pathelement path="${base.lib}/runtime/log4j-1.2.8.jar" />
antonio@7480
  1050
        <pathelement path="${base.lib}/runtime/commons-pool.jar" />
antonio@7480
  1051
        <pathelement path="${base.lib}/runtime/commons-dbcp.jar" />
antonio@7480
  1052
        <pathelement path="${base.lib}/runtime/postgresql-jdbc3-8.2.jar" />
antonio@7480
  1053
        <pathelement path="${base.lib}/runtime/ojdbc6.jar" />
antonio@7480
  1054
        <pathelement path="${base.lib}/runtime/commons-collections.jar" />
antonio@7480
  1055
        <pathelement path="${base.lib}/runtime/ant-1.7.1.jar" />
antonio@7480
  1056
        <pathelement path="${base.lib}/runtime/ant-launcher.jar" />
antonio@7480
  1057
        <pathelement path="${base.lib}/runtime/ant-apache-log4j.jar" />
antonio@7480
  1058
        <pathelement path="${base.lib}/runtime/ant-nodeps.jar" />
antonio@7480
  1059
      </classpath>
antonio@7480
  1060
    </java>
antonio@7480
  1061
  </target>
asier@43
  1062
</project>