build.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Thu, 22 Jan 2009 16:57:43 +0000
changeset 2706 c4b8c10a0f44
parent 2704 9eaee561a9d7
child 2766 432b309c11e5
permissions -rw-r--r--
Related to issue 4566: set the executable bit on the setup tool
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.
juanpablo@1548
    14
* The Initial Developer of the Original Code is Openbravo SL
juanpablo@1548
    15
* All portions are Copyright (C) 2001-2008 Openbravo SL
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@213
    48
preinstall: deprecated.
juanpablo@213
    49
preinstall.complete: deprecated.
juanpablo@213
    50
install: deprecated.
juanpablo@2061
    51
deploy.context: deploy the context into Tomcat using the manager
juanpablo@213
    52
install.source: install the ERP from sources (from subversion).
juanpablo@213
    53
eclipse.install.source: install the ERP from sources for eclipse (from subversion).
juanpablo@213
    54
create.database: refer to create.database target of database.
juanpablo@213
    55
update.database: refer to update.database target of database.
juanpablo@213
    56
create.database.structure: refer to create.database.structure target of database.
juanpablo@213
    57
update.database.structure: refer to update.database.structure target of database.
juanpablo@213
    58
create.database.script: refer to create.database.script target of database.
juanpablo@213
    59
update.database.script: refer to update.database.script target of database.
juanpablo@213
    60
export.database: exports database structure and data to xml files.
juanpablo@213
    61
export.database.structure: refer to export.database.structure target of database.
juanpablo@213
    62
export.database.data: refer to export.database.data target of database.
juanpablo@213
    63
import.database.data: refer to import.database.data target of database.
juanpablo@213
    64
save.database.model: refer to save.database.model target of database.
juanpablo@213
    65
compare.database.structure: refer to compare.database.structure target of database.
fernando@202
    66
-->
asier@43
    67
<project name="openbravo" default="compile.complete" basedir=".">
martin@2345
    68
	<property environment="env" />
martin@2345
    69
	<property name="base.config" location="config" />
martin@2345
    70
	<property file="${base.config}/Openbravo.properties" />
juanpablo@131
    71
martin@2432
    72
	<property name="base.config" location="config" />
martin@2345
    73
	<property name="base.src" location="src" />
martin@2345
    74
	<property name="base.src.core" location="src-core" />
martin@2345
    75
	<property name="base.src.db" location="src-db" />
martin@2345
    76
	<property name="base.src.trl" location="src-trl" />
martin@2345
    77
	<property name="base.src.wad" location="src-wad" />
martin@2345
    78
	<property name="base.src.gen" location="src-gen" />
martin@2345
    79
	<property name="base.client.src" location="srcClient" />
martin@2345
    80
	<property name="base.db" location="src-db/database" />
martin@2345
    81
	<property name="base.web" location="web" />
martin@2345
    82
	<property name="base.context" location="WebContent" />
martin@2345
    83
	<property name="base.design" location="${base.context}/src-loc" />
martin@2345
    84
	<property name="base.lib" location="lib" />
martin@2345
    85
	<property name="base.modules" location="modules" />
martin@2345
    86
	<property name="build" location="build/classes" />
martin@2345
    87
	<property name="build.AD" location="srcAD" />
martin@2345
    88
	<property name="build.sqlc" location="build/javasqlc" />
martin@2345
    89
	<property name="build.core.lib" location="src-core/lib" />
martin@2345
    90
	<property name="build.trl.lib" location="src-trl/lib" />
martin@2345
    91
	<property name="build.wad.lib" location="src-wad/lib" />
martin@2345
    92
	<property name="build.docs" location="docs/api" />
martin@2345
    93
	<property name="jakarta.home" location="${env.CATALINA_HOME}" />
martin@2345
    94
	<property name="module" value="%" />
martin@2345
    95
	<property name="apply.on.create" value="false" />
martin@2345
    96
	<property name="obx.export.RD" value="false" />
martin@2345
    97
	<property name="obx.export.DB" value="false" />
martin@2345
    98
	<property name="obx.export.CS" value="false" />
martin@2345
    99
	<property name="chekPerms" value="false" />
asier@2057
   100
martin@2345
   101
	<available file=".svn/entries" property="is.svn" />
martin@2345
   102
juanpablo@2522
   103
  <condition property="deploy.mode" value="class">
juanpablo@2522
   104
    <not>
juanpablo@2522
   105
      <isset property="${deploy.mode}" />
juanpablo@2522
   106
    </not>
juanpablo@2522
   107
  </condition>
martin@2345
   108
asier@1977
   109
	<condition property="mode.war">
martin@2345
   110
		<equals arg1="war" arg2="${deploy.mode}" />
asier@1977
   111
	</condition>
martin@2345
   112
martin@2345
   113
	<condition property="mode.class">
martin@2345
   114
		<equals arg1="class" arg2="${deploy.mode}" />
martin@2345
   115
	</condition>
martin@2345
   116
asier@1929
   117
	<condition property="apply.modules.on.create">
asier@1929
   118
		<or>
martin@2345
   119
			<equals arg1="yes" arg2="${apply.on.create}" />
martin@2345
   120
			<equals arg1="true" arg2="${apply.on.create}" />
asier@1929
   121
		</or>
asier@1929
   122
	</condition>
martin@2345
   123
asier@1929
   124
	<condition property="obx.exp.DB">
asier@1929
   125
		<or>
martin@2345
   126
			<equals arg1="yes" arg2="${obx.export.DB}" />
martin@2345
   127
			<equals arg1="true" arg2="${obx.export.DB}" />
asier@1929
   128
		</or>
asier@1929
   129
	</condition>
martin@2345
   130
asier@1929
   131
	<condition property="obx.exp.CS">
asier@1929
   132
		<or>
martin@2345
   133
			<equals arg1="yes" arg2="${obx.export.CS}" />
martin@2345
   134
			<equals arg1="true" arg2="${obx.export.CS}" />
asier@1929
   135
		</or>
asier@1929
   136
	</condition>
asier@43
   137
martin@2345
   138
	<condition property="jakarta.base" value="${env.CATALINA_BASE}" else="${jakarta.home}">
martin@2345
   139
		<and>
martin@2345
   140
			<isset property="env.CATALINA_BASE" />
martin@2345
   141
		</and>
martin@2345
   142
	</condition>
martin@2345
   143
	<property name="log.path" location="${jakarta.base}/logs" />
martin@2345
   144
	<property name="lib" location="${jakarta.home}/common" />
martin@2345
   145
	<property name="jakarta.context" location="${jakarta.base}/webapps/${context.name}" />
martin@2345
   146
	<property name="build.maxmemory" value="512M" />
stefan@124
   147
martin@2345
   148
	<condition property="no.java.home" value="true">
martin@2345
   149
		<not>
martin@2345
   150
			<isset property="env.JAVA_HOME" />
martin@2345
   151
		</not>
martin@2345
   152
	</condition>
juanpablo@1548
   153
martin@2345
   154
martin@2345
   155
	<path id="project.class.path">
martin@2345
   156
		<pathelement path="${build}" />
martin@2345
   157
		<pathelement path="${base.src}" />
martin@2345
   158
		<fileset dir="${base.lib}">
martin@2345
   159
			<include name="**/*.jar" />
martin@2345
   160
		</fileset>
martin@2345
   161
		<fileset dir="${build.core.lib}">
martin@2345
   162
			<include name="openbravo-core.jar" />
martin@2345
   163
		</fileset>
martin@2345
   164
		<fileset dir="${build.trl.lib}">
martin@2345
   165
			<include name="openbravo-trl.jar" />
martin@2345
   166
		</fileset>
martin@2345
   167
		<fileset dir="${build.wad.lib}">
martin@2345
   168
			<include name="openbravo-wad.jar" />
martin@2345
   169
		</fileset>
martin@2345
   170
		<fileset dir="${base.lib}">
martin@2345
   171
			<include name="**/*.jar" />
martin@2345
   172
		</fileset>
martin@2345
   173
		<fileset dir="${base.db}/lib/">
martin@2345
   174
			<include name="**/*.jar" />
martin@2345
   175
		</fileset>
martin@2345
   176
		<fileset dir="${base.modules}">
martin@2345
   177
			<include name="*/lib/**" />
martin@2345
   178
		</fileset>
martin@2345
   179
	</path>
martin@2345
   180
martin@2345
   181
	<taskdef resource="axis-tasks.properties" classpathref="project.class.path" />
martin@2345
   182
martin@2345
   183
	<target name="init">
martin@2345
   184
		<fail if="no.java.home" message="The environment variable JAVA_HOME is not set." />
martin@2345
   185
	</target>
stefan@124
   186
asier@2057
   187
	<target name="code.rev" depends="set.code.rev">
martin@2345
   188
		<condition property="code.revision" value="${svn.entries}" else="0">
martin@2345
   189
			<isset property="svn.entries" />
martin@2345
   190
		</condition>
asier@2057
   191
	</target>
ivan@812
   192
martin@2345
   193
	<target name="set.code.rev" if="is.svn">
martin@2345
   194
		<loadfile property="svn.entries" srcFile=".svn/entries" failonerror="false">
martin@2345
   195
			<filterchain>
martin@2345
   196
				<filterreader classname="org.apache.tools.ant.filters.HeadFilter">
martin@2345
   197
					<param name="skip" value="3" />
martin@2345
   198
					<param name="lines" value="1" />
martin@2345
   199
				</filterreader>
martin@2345
   200
			</filterchain>
martin@2345
   201
			<filterchain>
martin@2345
   202
				<filterreader classname="org.apache.tools.ant.filters.StripLineBreaks" />
martin@2345
   203
			</filterchain>
martin@2345
   204
		</loadfile>
martin@2345
   205
	</target>
asier@43
   206
martin@2345
   207
	<target name="compile.complete" depends="init">
martin@2345
   208
		<ant dir="${base.src}" target="compile.complete" inheritAll="true" inheritRefs="true" />
martin@2345
   209
	</target>
martin@2345
   210
martin@2345
   211
	<target name="compile" depends="init">
martin@2345
   212
		<ant dir="${base.src}" target="compile" inheritAll="true" inheritRefs="true" />
martin@2345
   213
	</target>
martin@2345
   214
asier@1977
   215
	<target name="compile.complete.deploy">
martin@2345
   216
		<antcall target="compile.complete.development" />
martin@2345
   217
		<antcall target="compile.complete.war" />
asier@1977
   218
	</target>
martin@2345
   219
martin@2345
   220
	<target name="compile.complete.development" depends="init" if="mode.class">
martin@2345
   221
		<ant dir="${base.src}" target="compile.complete.development" inheritAll="true" inheritRefs="true" />
martin@2345
   222
	</target>
martin@2345
   223
asier@1977
   224
	<target name="compile.complete.war" depends="init" if="mode.war">
martin@2345
   225
		<antcall target="compile.complete" />
martin@2345
   226
		<antcall target="war" />
asier@1977
   227
	</target>
asier@43
   228
asier@1977
   229
	<target name="compile.deploy">
martin@2345
   230
		<antcall target="compile.war" />
martin@2345
   231
		<antcall target="compile.development" />
asier@1977
   232
	</target>
asier@43
   233
martin@2345
   234
	<target name="compile.development" depends="init" if="mode.class">
martin@2345
   235
		<ant dir="${base.src}" target="compile.development" inheritAll="true" inheritRefs="true" />
martin@2345
   236
	</target>
asier@1929
   237
martin@2686
   238
	<target name="validate.database">
martin@2686
   239
		<ant dir="${base.src}" target="validate.database" inheritAll="true" inheritRefs="true" />
martin@2686
   240
	</target>
martin@2686
   241
martin@2686
   242
	<target name="validate.modules">
martin@2686
   243
		<ant dir="${base.src}" target="validate.modules" inheritAll="true" inheritRefs="true" />
martin@2686
   244
	</target>
martin@2686
   245
martin@2345
   246
	<target name="compile.war" if="mode.war">
martin@2345
   247
		<antcall target="compile" />
martin@2345
   248
		<antcall target="war" />
martin@2345
   249
	</target>
asier@1929
   250
martin@2345
   251
	<target name="compile.web" depends="init">
martin@2345
   252
		<ant dir="${base.src}" target="compile.web" inheritAll="true" inheritRefs="true" />
martin@2345
   253
	</target>
asier@43
   254
martin@2345
   255
	<target name="compile.web.development" depends="init">
martin@2345
   256
		<ant dir="${base.src}" target="compile.web.development" inheritAll="true" inheritRefs="true" />
martin@2345
   257
	</target>
ivan@1738
   258
martin@2345
   259
	<target name="eclipse.compile" depends="init">
martin@2345
   260
		<ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2345
   261
		<ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2345
   262
		<ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2345
   263
		<ant dir="${base.src}" target="eclipse.compile" inheritAll="true" inheritRefs="true" />
martin@2345
   264
		<eclipse.refreshLocal resource="openbravo" depth="infinite" />
martin@2345
   265
		<eclipse.incrementalBuild project="openbravo" kind="incremental" />
martin@2345
   266
	</target>
asier@43
   267
martin@2345
   268
	<target name="eclipse.compile.complete" depends="init">
martin@2345
   269
		<ant dir="${base.src.core}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2345
   270
		<ant dir="${base.src.trl}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2345
   271
		<ant dir="${base.src.wad}" target="build.jar" inheritAll="true" inheritRefs="true" />
martin@2345
   272
		<ant dir="${base.src}" target="eclipse.compile.complete" inheritAll="true" inheritRefs="true" />
martin@2345
   273
		<eclipse.refreshLocal resource="openbravo" depth="infinite" />
martin@2345
   274
		<eclipse.incrementalBuild project="openbravo" kind="full" />
martin@2345
   275
	</target>
martin@2245
   276
martin@2345
   277
	<target name="compile.src.gen" depends="init">
martin@2345
   278
		<ant dir="${base.src}" target="compile.src.gen" inheritAll="true" inheritRefs="true" />
martin@2345
   279
	</target>
martin@2284
   280
martin@2345
   281
	<target name="generate.entities">
martin@2345
   282
		<ant dir="${base.src}" target="generate.entities" inheritAll="true" inheritRefs="true" />
martin@2345
   283
	</target>
asier@43
   284
asier@2348
   285
	<target name="export.sample.data" depends="code.rev">
martin@2345
   286
		<ant dir="${base.src}" target="export.sample.data" inheritAll="true" inheritRefs="true" />
martin@2345
   287
	</target>
asier@43
   288
martin@2345
   289
	<target name="import.sample.data">
martin@2345
   290
		<ant dir="${base.src}" target="import.sample.data" inheritAll="true" inheritRefs="true" />
martin@2345
   291
	</target>
juanpablo@131
   292
martin@2345
   293
	<target name="compile.src" depends="init">
martin@2345
   294
		<ant dir="${base.src}" target="compile.src" inheritAll="true" inheritRefs="true" />
martin@2345
   295
	</target>
juanpablo@131
   296
martin@2345
   297
	<target name="war" depends="init">
martin@2345
   298
		<ant dir="${base.src}" target="build.war" inheritAll="true" inheritRefs="true" />
martin@2345
   299
	</target>
juanpablo@131
   300
martin@2345
   301
	<target name="core.docs" depends="init">
martin@2345
   302
		<ant dir="${base.src.core}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2345
   303
	</target>
juanpablo@131
   304
martin@2345
   305
	<target name="core.lib" depends="init">
martin@2345
   306
		<ant dir="${base.src.core}" target="build" inheritAll="true" inheritRefs="true" />
martin@2345
   307
		<copy file="${base.src.core}/lib/openbravo-core.jar" todir="${base.lib}/runtime" overwrite="true" failonerror="false" />
martin@2345
   308
	</target>
juanpablo@131
   309
martin@2345
   310
	<target name="eclipse.wad.lib" depends="init">
martin@2345
   311
		<ant dir="${base.src.wad}" target="sqlc" inheritAll="true" inheritRefs="true" />
martin@2345
   312
		<eclipse.refreshLocal resource="OpenbravoWAD" depth="infinite" />
martin@2345
   313
		<eclipse.incrementalBuild project="OpenbravoWAD" kind="full" />
martin@2345
   314
	</target>
juanpablo@131
   315
martin@2345
   316
	<target name="wad.docs" depends="init">
martin@2345
   317
		<ant dir="${base.src.wad}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2345
   318
	</target>
juanpablo@131
   319
martin@2345
   320
	<target name="wad.lib" depends="init">
martin@2345
   321
		<ant dir="${base.src.wad}" target="build" inheritAll="true" inheritRefs="true" />
martin@2345
   322
	</target>
juanpablo@131
   323
martin@2345
   324
	<target name="eclipse.trl.lib" depends="init">
martin@2345
   325
		<ant dir="${base.src.trl}" target="sqlc" inheritAll="true" inheritRefs="true" />
martin@2345
   326
		<eclipse.refreshLocal resource="OpenbravoTrl" depth="infinite" />
martin@2345
   327
		<eclipse.incrementalBuild project="OpenbravoTrl" kind="full" />
martin@2345
   328
	</target>
asier@43
   329
martin@2345
   330
	<target name="trl.docs" depends="init">
martin@2345
   331
		<ant dir="${base.src.trl}" target="doc" inheritAll="true" inheritRefs="true" />
martin@2345
   332
	</target>
juanpablo@179
   333
martin@2345
   334
	<target name="trl.lib" depends="init">
martin@2345
   335
		<ant dir="${base.src.trl}" target="build" inheritAll="true" inheritRefs="true" />
martin@2345
   336
	</target>
juanpablo@179
   337
martin@2345
   338
	<target name="database.lib" depends="init">
martin@2345
   339
		<ant dir="${base.src.db}" target="jar" inheritAll="true" inheritRefs="true" />
martin@2345
   340
		<copy file="${base.src.db}/build/lib/dbmanager.jar" todir="${base.db}/lib" overwrite="true" failonerror="false" />
martin@2345
   341
	</target>
juanpablo@179
   342
martin@2345
   343
	<target name="clean" depends="init">
martin@2345
   344
		<ant dir="${base.src}" target="clean" inheritAll="true" inheritRefs="true" />
martin@2345
   345
	</target>
asier@43
   346
martin@2345
   347
	<target name="trl.clean" depends="init">
martin@2345
   348
		<ant dir="${base.src}" target="trl.clean" inheritAll="true" inheritRefs="true" />
martin@2345
   349
	</target>
asier@43
   350
martin@2345
   351
	<target name="translate" depends="init">
martin@2345
   352
		<ant dir="${base.src}" target="translate" inheritAll="true" inheritRefs="true" />
martin@2345
   353
	</target>
asier@2363
   354
	
asier@2363
   355
	 <target name="translate.modules" depends="init">
asier@2363
   356
	    <ant dir="${base.src}" target="translate.modules" inheritAll="true" inheritRefs="true" />
asier@2363
   357
	  </target>
martin@2345
   358
martin@2345
   359
	<target name="installWebService" depends="init">
martin@2345
   360
		<ant dir="${base.src}" target="installWebService" inheritAll="true" inheritRefs="true">
martin@2345
   361
			<property name="wsdd" value="1" />
martin@2345
   362
		</ant>
martin@2345
   363
	</target>
martin@2345
   364
martin@2345
   365
	<target name="uninstallWebService" depends="init">
martin@2345
   366
		<ant dir="${base.src}" target="uninstallWebService" inheritAll="true" inheritRefs="true" />
martin@2345
   367
	</target>
martin@2345
   368
martin@2345
   369
	<target name="install.source" depends="init,code.rev">
martin@2345
   370
		<antcall target="database.lib" />
martin@2524
   371
		<antcall target="core.lib" />
martin@2345
   372
		<ant dir="${base.db}" antfile="build-create.xml" target="create.database" inheritAll="true" inheritRefs="true" />
martin@2345
   373
		<antcall target="wad.lib" />
martin@2345
   374
		<antcall target="trl.lib" />
martin@2345
   375
		<antcall target="compile.complete.deploy" />
martin@2345
   376
		<echo message="applying modules" />
martin@2345
   377
		<taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
martin@2345
   378
			<classpath refid="project.class.path" />
martin@2345
   379
		</taskdef>
martin@2686
   380
		<applyModule userId="0" propertiesFile="${base.config}/Openbravo.properties"/>
martin@2686
   381
		
martin@2345
   382
		<antcall target="import.sample.data" />
martin@2686
   383
martin@2704
   384
		<!--
martin@2686
   385
		<antcall target="validate.database" />
martin@2686
   386
		<antcall target="validate.modules" />
martin@2704
   387
		-->
martin@2345
   388
	</target>
juanpablo@131
   389
martin@2345
   390
	<target name="eclipse.install.source" depends="init,code.rev">
martin@2345
   391
		<antcall target="database.lib" />
martin@2581
   392
		<antcall target="core.lib" />
martin@2524
   393
		<eclipse.incrementalBuild project="OpenbravoCore" kind="full" />
martin@2345
   394
		<ant dir="${base.db}" antfile="build-create.xml" target="create.database" inheritAll="true" inheritRefs="true" />
martin@2345
   395
		<antcall target="eclipse.wad.lib" />
martin@2345
   396
		<antcall target="eclipse.trl.lib" />
martin@2345
   397
		<antcall target="eclipse.compile.complete" />
martin@2345
   398
		<echo message="applying modules" />
martin@2345
   399
		<taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
martin@2345
   400
			<classpath refid="project.class.path" />
martin@2345
   401
		</taskdef>
martin@2345
   402
		<applyModule userId="0" propertiesFile="${base.config}/Openbravo.properties" />
asier@2351
   403
		<antcall target="import.sample.data" />
martin@2686
   404
martin@2686
   405
		<antcall target="validate.database" />
martin@2686
   406
		<antcall target="validate.modules" />
martin@2345
   407
	</target>
asier@43
   408
martin@2345
   409
	<target name="create.database" depends="init,code.rev">
martin@2345
   410
		<antcall target="database.lib" />
martin@2591
   411
		<antcall target="core.lib" />
martin@2345
   412
		<ant dir="${base.db}" antfile="build-create.xml" target="create.database" inheritAll="true" inheritRefs="true" />
martin@2345
   413
		<antcall target="db.apply.modules.sampledata" />
martin@2345
   414
	</target>
antonio@1335
   415
martin@2345
   416
	<target name="update.database" depends="init,code.rev">
martin@2345
   417
		<antcall target="database.lib" />
martin@2591
   418
		<antcall target="core.lib" />
martin@2345
   419
		<ant dir="${base.db}" target="update.database" inheritAll="true" inheritRefs="true" />
martin@2345
   420
		<antcall target="db.apply.modules" />
martin@2345
   421
	</target>
asier@1929
   422
martin@2345
   423
	<target name="update.database.mod" depends="init,code.rev">
martin@2345
   424
		<antcall target="database.lib" />
martin@2591
   425
		<antcall target="core.lib" />
martin@2345
   426
		<ant dir="${base.db}" target="update.database.mod" inheritAll="true" inheritRefs="true" />
martin@2345
   427
		<antcall target="db.apply.modules" />
martin@2345
   428
	</target>
asier@43
   429
martin@2345
   430
	<target name="update.customized.database" depends="init,code.rev">
martin@2345
   431
		<antcall target="database.lib" />
martin@2591
   432
		<antcall target="core.lib" />
martin@2345
   433
		<ant dir="${base.db}" target="update.customized.database" inheritAll="true" inheritRefs="true" />
martin@2345
   434
	</target>
antonio@1335
   435
martin@2345
   436
	<target name="create.database.structure" depends="init">
martin@2591
   437
		<antcall target="core.lib" />
martin@2345
   438
		<ant dir="${base.db}" target="create.database.structure" inheritAll="true" inheritRefs="true" />
martin@2345
   439
	</target>
asier@43
   440
martin@2345
   441
	<target name="update.database.structure" depends="init">
martin@2591
   442
		<antcall target="core.lib" />
martin@2345
   443
		<ant dir="${base.db}" target="update.database.structure" inheritAll="true" inheritRefs="true" />
martin@2345
   444
	</target>
asier@43
   445
martin@2345
   446
	<target name="create.database.script" depends="init">
martin@2591
   447
		<antcall target="core.lib" />
martin@2345
   448
		<ant dir="${base.db}" target="create.database.script" inheritAll="true" inheritRefs="true" />
martin@2345
   449
	</target>
asier@43
   450
martin@2345
   451
	<target name="update.database.script" depends="init">
martin@2591
   452
		<antcall target="core.lib" />
martin@2345
   453
		<ant dir="${base.db}" target="update.database.script" inheritAll="true" inheritRefs="true" />
martin@2345
   454
	</target>
adrian@97
   455
martin@2345
   456
	<target name="export.database" depends="init,code.rev">
martin@2345
   457
		<antcall target="database.lib" />
martin@2591
   458
		<antcall target="core.lib" />
martin@2345
   459
		<ant dir="${base.db}" target="export.database.structure" inheritAll="true" inheritRefs="true" />
martin@2345
   460
		<ant dir="${base.db}" target="export.database.data" inheritAll="true" inheritRefs="true" />
martin@2345
   461
	</target>
adrian@164
   462
martin@2345
   463
	<target name="export.database.structure" depends="init,code.rev">
martin@2591
   464
		<antcall target="core.lib" />
martin@2345
   465
		<ant dir="${base.db}" target="export.database.structure" inheritAll="true" inheritRefs="true" />
martin@2345
   466
	</target>
asier@43
   467
martin@2345
   468
	<target name="export.config.script" depends="init,code.rev">
martin@2591
   469
		<antcall target="core.lib" />
martin@2345
   470
		<ant dir="${base.db}" target="export.config.script" inheritAll="true" inheritRefs="true" />
martin@2345
   471
	</target>
asier@1929
   472
martin@2345
   473
	<target name="export.database.data" depends="init,code.rev">
martin@2591
   474
		<antcall target="core.lib" />
martin@2345
   475
		<ant dir="${base.db}" target="export.database.data" inheritAll="true" inheritRefs="true" />
martin@2345
   476
	</target>
asier@43
   477
martin@2345
   478
	<target name="import.database.data" depends="init,code.rev">
martin@2591
   479
		<antcall target="core.lib" />
martin@2345
   480
		<ant dir="${base.db}" target="import.database.data" inheritAll="true" inheritRefs="true" />
martin@2345
   481
	</target>
asier@43
   482
martin@2345
   483
	<target name="db.apply.modules" if="apply.modules.on.create">
martin@2345
   484
		<echo message="applying modules" />
martin@2345
   485
		<taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
martin@2345
   486
			<classpath refid="project.class.path" />
martin@2345
   487
		</taskdef>
martin@2345
   488
		<applyModule userId="0" propertiesFile="${base.config}/Openbravo.properties" />
martin@2345
   489
	</target>
martin@2345
   490
martin@2345
   491
	<target name="db.apply.modules.sampledata" if="apply.modules.on.create">
martin@2345
   492
		<echo message="applying modules" />
martin@2345
   493
		<taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
martin@2345
   494
			<classpath refid="project.class.path" />
martin@2345
   495
		</taskdef>
martin@2345
   496
		<applyModule userId="0" propertiesFile="${base.config}/Openbravo.properties" />
asier@2351
   497
		<antcall target="import.sample.data" />
martin@2345
   498
	</target>
martin@2345
   499
asier@1929
   500
	<target name="apply.modules">
martin@2345
   501
		<echo>Applying ${module} modules...</echo>
martin@2345
   502
		<taskdef name="applyModule" classname="org.openbravo.erpCommon.modules.ApplyModuleTask">
martin@2345
   503
			<classpath refid="project.class.path" />
martin@2345
   504
		</taskdef>
martin@2345
   505
		<antcall target="update.database.mod" />
martin@2345
   506
		<applyModule userId="0" propertiesFile="${base.config}/Openbravo.properties" reinitializemodel="true" />
martin@2345
   507
		<antcall target="compile.deploy" />
asier@1929
   508
		<!--antcall target="deploy.context"/-->
asier@1929
   509
	</target>
martin@2345
   510
martin@2345
   511
	<!-- 
martin@2345
   512
		apparently this does not overwrite the default catalina_opts, only
martin@2345
   513
		if it is not set will it be set to the value below 
martin@2345
   514
	-->
martin@2345
   515
	<property name="env.CATALINA_OPTS" value="-XX:MaxPermSize=128M" />
martin@2345
   516
martin@2345
   517
	<!-- 
martin@2345
   518
		This task is called from the Openbravo ui, it spawns a java call which again
martin@2345
   519
		calls the restart.tomcat.do task as a spawned task.
martin@2345
   520
	-->
martin@2345
   521
	<target name="tomcat.restart" description="Restart the tomcat server process">
martin@2471
   522
		<java classname="org.openbravo.service.system.RestartTomcat" spawn="true" fork="true" maxmemory="${build.maxmemory}">
martin@2345
   523
			<arg line="${base.src}" />
martin@2345
   524
			<classpath refid="project.class.path" />
martin@2345
   525
		</java>
martin@2345
   526
	</target>
martin@2345
   527
martin@2345
   528
	<!--
martin@2345
   529
		Is called by the org.openbravo.service.system.RestartTomcat class.
martin@2345
   530
	-->
martin@2345
   531
	<target name="tomcat.restart.do" description="Restart the tomcat server process">
martin@2345
   532
		<echo message="Restarting Tomcat at ${env.CATALINA_HOME}" />
martin@2471
   533
		<java classname="org.apache.catalina.startup.Bootstrap" fork="true">
martin@2471
   534
			<classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar" />
martin@2345
   535
			<jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
ivan@2489
   536
			<jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
martin@2345
   537
			<arg line="stop" />
martin@2345
   538
		</java>
ivan@2489
   539
		<sleep description="Wait to give tomcat time to stop" seconds="20"/>
martin@2471
   540
		<java classname="org.apache.catalina.startup.Bootstrap" failonerror="true" fork="true">
martin@2471
   541
			<classpath path=":${env.CATALINA_HOME}/bin/bootstrap.jar:${env.CATALINA_HOME}/bin/commons-logging-api.jar" />
martin@2471
   542
			<!-- note because CATALINA_OPTS can be multi argument the line attribute has to be used! -->
martin@2471
   543
			<jvmarg line="${env.CATALINA_OPTS}"/>
martin@2345
   544
			<jvmarg value="-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager" />
ivan@2489
   545
			<jvmarg value="-Djava.util.logging.config.file=${env.CATALINA_BASE}/conf/logging.properties" />
martin@2345
   546
			<jvmarg value="-Djava.endorsed.dirs=${env.CATALINA_HOME}/endorsed" />
ivan@2489
   547
			<jvmarg value="-Dcatalina.base=${env.CATALINA_BASE}" />
martin@2345
   548
			<jvmarg value="-Dcatalina.home=${env.CATALINA_HOME}" />
ivan@2489
   549
			<jvmarg value="-Djava.io.tmpdir=${env.CATALINA_BASE}/temp" />
martin@2471
   550
			<arg line="start" />
martin@2345
   551
		</java>
martin@2345
   552
	</target>
martin@2345
   553
martin@2345
   554
	<!-- 
martin@2345
   555
		This task is called from the Openbravo ui, it spawns a java call which again
martin@2345
   556
		calls the tomcat.reload.do task as a spawned task.
martin@2345
   557
	-->
martin@2345
   558
	<target name="tomcat.reload" description="Reload the Openbravo context">
martin@2549
   559
		<java classname="org.openbravo.service.system.ReloadContext" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}" spawn="true" fork="true">
martin@2345
   560
			<arg line="${base.src}" />
martin@2345
   561
			<classpath refid="project.class.path" />
martin@2345
   562
		</java>
martin@2345
   563
	</target>
martin@2345
   564
martin@2345
   565
	<target name="tomcat.reload.do">
martin@2345
   566
		<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
martin@2345
   567
			<classpath refid="project.class.path" />
martin@2345
   568
		</taskdef>
martin@2345
   569
		<reload url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}"/>
martin@2345
   570
	</target>
asier@1977
   571
	
asier@1929
   572
	<target name="tomcat.list">
martin@2345
   573
		<taskdef name="list" classname="org.apache.catalina.ant.ListTask">
martin@2345
   574
			<classpath refid="project.class.path" />
asier@1929
   575
		</taskdef>
martin@2345
   576
		<list url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" />
asier@1929
   577
	</target>
adrian@171
   578
martin@2345
   579
	<target name="deploy.context">
martin@2345
   580
		<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
martin@2345
   581
			<classpath refid="project.class.path" />
martin@2345
   582
		</taskdef>
martin@2345
   583
		<taskdef name="deploy.tomcat" classname="org.apache.catalina.ant.DeployTask">
martin@2345
   584
			<classpath refid="project.class.path" />
martin@2345
   585
		</taskdef>
martin@2345
   586
		<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
martin@2345
   587
			<classpath refid="project.class.path" />
martin@2345
   588
		</taskdef>
martin@2345
   589
martin@2345
   590
		<undeploy url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" failonerror="false" />
martin@2345
   591
		<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@2345
   592
		<start url="${tomcat.manager.url}" username="${tomcat.manager.username}" password="${tomcat.manager.password}" path="/${context.name}" />
martin@2345
   593
	</target>
martin@2345
   594
martin@2345
   595
	<target name="generate-wsdd">
martin@2345
   596
		<ant dir="${base.src}" target="generate-wsdd" inheritAll="true" inheritRefs="true" />
martin@2345
   597
	</target>
martin@2345
   598
martin@2345
   599
	<target name="obx.export.database" if="obx.exp.DB">
martin@2345
   600
		<antcall target="export.database" />
martin@2345
   601
	</target>
martin@2345
   602
martin@2345
   603
	<target name="obx.export.config.script" if="obx.exp.CS">
martin@2345
   604
		<antcall target="export.config.script" />
martin@2345
   605
	</target>
martin@2345
   606
asier@2647
   607
	<target name="package.module">
martin@2345
   608
		<taskdef name="extractModule" classname="org.openbravo.erpCommon.modules.ExtractModuleTask">
martin@2345
   609
			<classpath refid="project.class.path" />
martin@2345
   610
		</taskdef>
martin@2686
   611
		
martin@2686
   612
		<taskdef name="validateModules" classname="org.openbravo.service.system.SystemValidationTask">		
martin@2686
   613
			<classpath refid="project.class.path" />
martin@2686
   614
		</taskdef>
martin@2686
   615
		
martin@2686
   616
		<echo message="Validating Module..." />
martin@2686
   617
		<validateModules moduleName="${module}" failOnError="true" userId="0" propertiesFile="${base.config}/Openbravo.properties" type="module"/>
martin@2686
   618
		
martin@2345
   619
		<antcall target="obx.export.database" />
martin@2345
   620
		<antcall target="obx.export.config.script" />
martin@2345
   621
martin@2345
   622
		<extractModule moduleName="${module}" userId="0" propertiesFile="${base.config}/Openbravo.properties" exportRD="${obx.export.RD}" />
martin@2345
   623
	</target>
martin@2345
   624
martin@2345
   625
	<target name="diagnostic">
martin@2345
   626
		<ant dir="src-diagnostics" antfile="build-create.xml" target="build" />
martin@2345
   627
		<ant dir="src-diagnostics" target="check.all" />
martin@2345
   628
	</target>
martin@2345
   629
asier@2060
   630
	<target name="test">
martin@2345
   631
		<echo message="testing..." />
martin@2345
   632
	</target>
juanpablo@2691
   633
juanpablo@2691
   634
    <target name="setup.check.os">
juanpablo@2691
   635
        <condition property="osname" value="linux">
juanpablo@2691
   636
            <equals arg1="${os.name}" arg2="Linux" />
juanpablo@2691
   637
        </condition>
juanpablo@2691
   638
        <condition property="osname" value="freebsd">
juanpablo@2691
   639
            <equals arg1="${os.name}" arg2="FreeBSD" />
juanpablo@2691
   640
        </condition>
juanpablo@2691
   641
        <condition property="osname" value="windows">
juanpablo@2691
   642
            <contains string="${os.name}" substring="Windows" />
juanpablo@2691
   643
        </condition>
juanpablo@2691
   644
        <condition property="osname" value="osx">
juanpablo@2691
   645
            <contains string="${os.name}" substring="OS X" />
juanpablo@2691
   646
        </condition>
juanpablo@2691
   647
        <condition property="os.is.solaris">
juanpablo@2691
   648
            <or>
juanpablo@2691
   649
                <contains string="${os.name}" substring="Solaris" />
juanpablo@2691
   650
                <contains string="${os.name}" substring="SunOS" />
juanpablo@2691
   651
            </or>
juanpablo@2691
   652
        </condition>
juanpablo@2691
   653
        <condition property="osname" value="openbsd">
juanpablo@2691
   654
            <equals arg1="${os.name}" arg2="OpenBSD" />
juanpablo@2691
   655
        </condition>
juanpablo@2691
   656
        <condition property="osname" value="aix">
juanpablo@2691
   657
            <equals arg1="${os.name}" arg2="AIX" />
juanpablo@2691
   658
        </condition>
juanpablo@2691
   659
        <condition property="osname" value="hpux">
juanpablo@2691
   660
            <equals arg1="${os.name}" arg2="HPUX" />
juanpablo@2691
   661
        </condition>
juanpablo@2691
   662
    </target>
juanpablo@2691
   663
juanpablo@2691
   664
    <target name="setup.check.arch">
juanpablo@2691
   665
        <condition property="osarch" value="">
juanpablo@2691
   666
            <or>
juanpablo@2691
   667
                <equals arg1="${os.arch}" arg2="x86" />
juanpablo@2691
   668
                <equals arg1="${os.arch}" arg2="i386" />
juanpablo@2691
   669
            </or>
juanpablo@2691
   670
        </condition>
juanpablo@2691
   671
        <condition property="osarch" value="-x64">
juanpablo@2691
   672
            <or>
juanpablo@2691
   673
                <equals arg1="${os.arch}" arg2="amd64" />
juanpablo@2691
   674
                <equals arg1="${os.arch}" arg2="x86_64" />
juanpablo@2691
   675
            </or>
juanpablo@2691
   676
        </condition>
juanpablo@2691
   677
        <condition property="osarch" value="-ia64">
juanpablo@2691
   678
            <equals arg1="${os.arch}" arg2="ia64" />
juanpablo@2691
   679
        </condition>
juanpablo@2691
   680
        <condition property="osarch" value="sparc">
juanpablo@2691
   681
            <equals arg1="${os.arch}" arg2="sparc" />
juanpablo@2691
   682
        </condition>
juanpablo@2691
   683
        <condition property="arch.is.ppc" value="-ppc">
juanpablo@2691
   684
            <equals arg1="${os.arch}" arg2="ppc" />
juanpablo@2691
   685
        </condition>
juanpablo@2691
   686
    </target>
juanpablo@2691
   687
juanpablo@2691
   688
    <target name="setup.exists.test">
juanpablo@2691
   689
        <condition property="bin.ext" value="exe" else="bin">
juanpablo@2691
   690
            <os family="windows"/>
juanpablo@2691
   691
        </condition>
juanpablo@2691
   692
juanpablo@2691
   693
        <available file="config/setup-properties-${osname}${osarch}.${bin.ext}" property="setup.exists" value="true" />
juanpablo@2691
   694
    </target>
juanpablo@2691
   695
juanpablo@2691
   696
    <target name="setup" depends="setup.check.os, setup.check.arch, setup.exists.test" unless="setup.exists">
juanpablo@2691
   697
        <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" />
juanpablo@2706
   698
juanpablo@2706
   699
        <chmod file="config/setup-properties-${osname}${osarch}.${bin.ext}" perm="+x"/>
juanpablo@2691
   700
    </target>
juanpablo@2691
   701
asier@43
   702
</project>