src/build.xml
author Juan Pablo Aroztegi <juanpablo.aroztegi@openbravo.com>
Tue, 11 Dec 2007 09:10:22 +0000
changeset 213 7bc683ea98e9
parent 201 1370ef2d56c3
child 247 ad88dfb0eded
permissions -rw-r--r--
Remove ^M garbage
carlos@0
     1
<?xml version="1.0" encoding="UTF-8" ?>
carlos@0
     2
<!--
carlos@0
     3
 *************************************************************************
carlos@0
     4
 * The contents of this file are subject to the Openbravo Public License 
carlos@0
     5
 * Version 1.1 (the "License"), being the Mozilla Public License 
carlos@0
     6
 * version 1.1  with a permitted attribution clause ; you may not use 
carlos@0
     7
 * this file except in compliance with the License. 
carlos@0
     8
 * You may obtain a copy of the License at  
carlos@0
     9
 * http://www.openbravo.com/legal/license.txt 
carlos@0
    10
 * Software distributed under the License is distributed on an 
carlos@0
    11
 * "AS IS" basis, WITHOUT WARRANTY OF  ANY KIND, either express or 
carlos@0
    12
 * implied. See the License for the specific language governing rights 
carlos@0
    13
 * and  limitations under the License. 
carlos@0
    14
 * The Original Code is Openbravo ERP. 
carlos@0
    15
 * The Initial Developer of the Original Code is [Autores] and Openbravo SL 
carlos@0
    16
 * All portions are Copyright (C) 2005-2006 Openbravo SL 
carlos@0
    17
 * All Rights Reserved. 
carlos@0
    18
 * Contributor(s): Openbravo S.L.
carlos@0
    19
 ************************************************************************
carlos@0
    20
-->
juanpablo@213
    21
juanpablo@213
    22
<!--
juanpablo@213
    23
List of methods inside:
juanpablo@213
    24
juanpablo@213
    25
init: creates all the folders.
juanpablo@213
    26
trl.clean: clean the AD_TEXTINTERFACES table
juanpablo@213
    27
clean: delete all folders.
juanpablo@213
    28
copy.srcClient: copy the content of the srcClient to the src folder.
juanpablo@213
    29
sqlc: generates the java from the xsql files.
juanpablo@213
    30
compileSqlc: compiles all the java generated from the xsqls.
juanpablo@213
    31
wad: generates all the files from the mda.
juanpablo@213
    32
postwad: copies the generated files to the base design folder.
juanpablo@213
    33
postsrc: copies the src files to the base design folder and the 
juanpablo@213
    34
         xml and jasper files to the translated designs folders
juanpablo@213
    35
build.local.context: copies all files to the eclipse base context 
juanpablo@213
    36
                     (WebContent...).
juanpablo@213
    37
compile.src: comiles only the src files.
juanpablo@213
    38
eclipse.compile: generates specified wad files and compiles modified xsql files.
juanpablo@213
    39
eclipse.compile.complete: generates all wad files and compiles all xsql files
juanpablo@213
    40
compile: compiles specified WAD window and src and also translates.
juanpablo@213
    41
compile.complete: compiles all WAD windows and src and also translates.
juanpablo@213
    42
translate: Translate the modified files.
juanpablo@213
    43
compile.translate: Translate the specified extensions files.
juanpablo@213
    44
installWebService: install the web services configuration file.
juanpablo@213
    45
uninstallWebService: uninstall the web services configuration file.
juanpablo@213
    46
copy.files: copy the local files to the context.
juanpablo@213
    47
compile.development: like compile, but also copies the files to the context.
juanpablo@213
    48
compile.complete.development: like compile.complete, but also copies the files 
juanpablo@213
    49
                              to the context.
juanpablo@213
    50
build.war: build a war file in the lib directory.
juanpablo@213
    51
-->
juanpablo@213
    52
carlos@0
    53
<project name="openbravo sources" default="compile" basedir=".">
carlos@0
    54
  <property name="webTab" value="all"/>
carlos@0
    55
  <property name="tab" value="%"/>
carlos@0
    56
  <property name="base.language" value="${base.source}/src"/>
carlos@0
    57
  <property name="base.translate.structure" value="org/openbravo/erpWindows"/>
carlos@0
    58
  <property name="client.web.xml" value="${base.client.src}/web.xml"/>
carlos@0
    59
  <property name="package" value="/org"/>
carlos@0
    60
  <property name="extension" value="html"/>
carlos@0
    61
  <property name="src" value="."/>
carlos@0
    62
  <property name="tr" value="yes"/>
carlos@0
    63
  <condition property="translation">
carlos@0
    64
    <not> 
carlos@0
    65
      <equals arg1="no" arg2="${tr}"/>
carlos@0
    66
    </not>
carlos@0
    67
  </condition>
carlos@0
    68
  <target name="init">
carlos@0
    69
    <mkdir dir="${build}"/>
carlos@0
    70
    <mkdir dir="${base.design}/design"/>
carlos@0
    71
    <mkdir dir="${build.sqlc}"/>
carlos@0
    72
    <mkdir dir="${build.sqlc}/src"/>
carlos@0
    73
    <mkdir dir="${build.sqlc}/srcAD"/>
carlos@0
    74
    <mkdir dir="${build.AD}"/>
carlos@0
    75
    <mkdir dir="${build.AD}/org/openbravo/erpWindows"/>
carlos@0
    76
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/ad_actionButton"/>
carlos@0
    77
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/ad_callouts"/>
carlos@0
    78
    <mkdir dir="${build.AD}/org/openbravo/erpCommon/reference"/>
carlos@0
    79
    <mkdir dir="${build.docs}"/>
carlos@0
    80
  </target>
carlos@0
    81
juanpablo@213
    82
  <target name="trl.clean" if="translation">
asier@134
    83
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@134
    84
      <arg line="clean ${base.config}/Openbravo.properties"/>
asier@134
    85
      <classpath refid="project.class.path"/>
asier@134
    86
    </java>
juanpablo@213
    87
  </target>
juanpablo@213
    88
  
asier@134
    89
  <target name="clean" depends="trl.clean">
carlos@0
    90
    <property name="complete" value="true"/>
carlos@0
    91
    <delete includeEmptyDirs="true" failonerror="false">
carlos@0
    92
      <fileset dir="${base.design}"/>
carlos@0
    93
      <fileset dir="${build}"/>
carlos@0
    94
      <fileset dir="${build.docs}"/>
carlos@0
    95
      <fileset dir="${build.AD}"/>
carlos@0
    96
      <fileset dir="${build.sqlc}"/>
carlos@0
    97
    </delete>
carlos@0
    98
    <basename property="attach.path.filename" file="${attach.path}"/>
carlos@0
    99
    <condition property="attach.path.condition" value="**/${attach.path.filename}/**" else="">
carlos@0
   100
      <and>
carlos@0
   101
        <contains string="${attach.path}" substring="${jakarta.context}" casesensitive="false"/>
carlos@0
   102
      </and>
carlos@0
   103
    </condition>
carlos@0
   104
    <delete includeEmptyDirs="true" failonerror="false">
carlos@0
   105
      <fileset dir="${jakarta.context}">
carlos@0
   106
        <exclude name="${attach.path.condition}"/>
carlos@0
   107
      </fileset>
carlos@0
   108
    </delete>
juanpablo@213
   109
carlos@0
   110
  </target>
carlos@0
   111
carlos@0
   112
  <target name="copy.srcClient">
carlos@0
   113
    <mkdir dir="${base.client.src}"/>
carlos@0
   114
    <copy todir="${basedir}" overwrite="true" failonerror="false">
carlos@0
   115
      <fileset dir="${base.client.src}">
carlos@0
   116
        <exclude name="**/web.xml"/>
carlos@0
   117
      </fileset>
carlos@0
   118
    </copy>
carlos@0
   119
  </target>
carlos@0
   120
carlos@0
   121
  <target name="sqlc" depends="copy.srcClient">
carlos@0
   122
    <java classname="org.openbravo.data.Sqlc" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}">
asier@45
   123
      <arg line="${base.config}/Openbravo.properties .xsql . ${build.sqlc}/src"/>
carlos@0
   124
      <classpath refid="project.class.path"/>
carlos@0
   125
    </java>
juanpablo@131
   126
    <copy file="${base.source}/src/buildAD.xml" tofile="${base.source}/srcAD/build.xml"/>
juanpablo@131
   127
    <copy file="${base.source}/src/log4j.lcf" tofile="${base.source}/srcAD/log4j.lcf"/>
carlos@0
   128
    <ant dir="${base.source}/srcAD" target="buildAD" inheritAll="true" inheritRefs="true"/>
carlos@0
   129
  </target>
carlos@0
   130
carlos@0
   131
  <target name="compileSqlc" depends="sqlc">
carlos@0
   132
    <javac srcdir="${build.sqlc}/src:${basedir}:${build.sqlc}/srcAD/org/openbravo/erpCommon/reference" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="${debug.level}" deprecation="on">
carlos@0
   133
      <classpath refid="project.class.path"/>
carlos@0
   134
    </javac>
carlos@0
   135
    <javac srcdir="${build.sqlc}/srcAD" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="${debug.level}" deprecation="on">
carlos@0
   136
      <classpath refid="project.class.path"/>
carlos@0
   137
    </javac>
carlos@0
   138
    <javac srcdir="${build.AD}" destdir="${build}" encoding="UTF-8" fork="true" memorymaximumsize="${build.maxmemory}" debug="${debug.level}" deprecation="on">
carlos@0
   139
      <classpath refid="project.class.path"/>
carlos@0
   140
    </javac>
carlos@0
   141
  </target>
carlos@0
   142
carlos@0
   143
  <target name="wad" depends="init">
carlos@0
   144
    <java classname="org.openbravo.wad.Wad" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
carlos@0
   145
      <arg line="'${base.config}' '${tab}' '${build.AD}/org/openbravo/erpWindows' '${build.AD}/org/openbravo/erpCommon' '${build.sqlc}/src' '${webTab}' '${build.AD}/org/openbravo/erpCommon/ad_actionButton' '${base.design}' '${base.translate.structure}' '${client.web.xml}' '${base.source}' '${attach.path}' '${web.url}' '${base.src}' '${complete}'"/>
carlos@0
   146
      <classpath refid="project.class.path"/>
carlos@0
   147
    </java>
carlos@0
   148
    <antcall target="postwad" inheritall="true" inheritrefs="true"/>
carlos@0
   149
  </target>
juanpablo@131
   150
carlos@0
   151
  <target name="postwad">
carlos@0
   152
    <copy todir="${base.design}/design" >
carlos@0
   153
      <fileset dir="${build.AD}" includes="**/*.xml"/>
carlos@0
   154
    </copy>
carlos@0
   155
    <copy todir="${base.design}/design" >
carlos@0
   156
      <fileset dir="${build.AD}" includes="**/*.fo"/>
carlos@0
   157
    </copy>
carlos@0
   158
    <copy todir="${base.design}/design" >
carlos@0
   159
      <fileset dir="${build.AD}" includes="**/*.html"/>
carlos@0
   160
    </copy>
carlos@0
   161
    <copy todir="${base.design}/design" >
carlos@0
   162
      <fileset dir="${build.AD}" includes="**/*.srpt"/>
carlos@0
   163
    </copy>
carlos@0
   164
    <copy todir="${base.design}/design" >
carlos@0
   165
      <fileset dir="${build.AD}" includes="**/*.jrxml"/>
carlos@0
   166
    </copy>
carlos@0
   167
    <copy todir="${base.design}/design" >
carlos@0
   168
      <fileset dir="${build.AD}" includes="**/*.jasper"/>
carlos@0
   169
    </copy>
carlos@0
   170
  </target>
carlos@0
   171
carlos@0
   172
  <target name="postsrc">
carlos@0
   173
    <copy todir="${base.design}/design" >
carlos@0
   174
      <fileset dir="${basedir}" includes="**/*.xml"/>
carlos@0
   175
    </copy>
carlos@0
   176
    <copy todir="${base.design}/design" >
carlos@0
   177
      <fileset dir="${basedir}" includes="**/*.fo"/>
carlos@0
   178
    </copy>
carlos@0
   179
    <copy todir="${base.design}/design" >
carlos@0
   180
      <fileset dir="${basedir}" includes="**/*.html"/>
carlos@0
   181
    </copy>
carlos@0
   182
    <copy todir="${base.design}/design" >
carlos@0
   183
      <fileset dir="${basedir}" includes="**/*.srpt"/>
carlos@0
   184
    </copy>
carlos@0
   185
    <copy todir="${base.design}/design" >
carlos@0
   186
      <fileset dir="${basedir}" includes="**/*.jrxml"/>
carlos@0
   187
    </copy>
carlos@0
   188
    <copy todir="${base.design}/design" >
carlos@0
   189
      <fileset dir="${basedir}" includes="**/*.jasper"/>
carlos@0
   190
    </copy>
carlos@0
   191
    <java classname="org.openbravo.translate.CommandLine_CopyFiles" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@75
   192
      <arg line="'${base.config}/Openbravo.properties' '${basedir}' '${base.design}' '.xml' 'true' 'false'"/>
carlos@0
   193
      <classpath refid="project.class.path"/>
carlos@0
   194
    </java>
carlos@0
   195
    <java classname="org.openbravo.translate.CommandLine_CopyFiles" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@45
   196
      <arg line="'${base.config}/Openbravo.properties' '${basedir}' '${base.design}' 'jasper' 'true' 'false'"/>
carlos@0
   197
      <classpath refid="project.class.path"/>
carlos@0
   198
    </java>
carlos@0
   199
    <antcall target="build.local.context"/>
carlos@0
   200
  </target>
juanpablo@131
   201
carlos@0
   202
  <target name="build.local.context">
carlos@0
   203
    <copy todir="${base.context}"  encoding="UTF-8">
carlos@0
   204
      <fileset file="${basedir}/index.html"/>
carlos@0
   205
    </copy>
carlos@0
   206
    <copy todir="${base.context}/WEB-INF"  encoding="UTF-8">
carlos@0
   207
      <fileset file="${build.sqlc}/src/web.xml"/>
carlos@0
   208
      <fileset dir="${base.config}"/>
carlos@0
   209
    </copy>
carlos@0
   210
    <copy todir="${base.context}/WEB-INF/lib"  encoding="UTF-8">
carlos@0
   211
      <fileset dir="${base.lib}">
carlos@0
   212
        <exclude name="openbravo-wad.jar"/>
carlos@0
   213
        <exclude name="openbravo-trl.jar"/>
carlos@0
   214
        <exclude name="*.war"/>
carlos@0
   215
      </fileset>
carlos@0
   216
    </copy>
carlos@0
   217
    <mkdir dir="${base.context}/web"/>
carlos@0
   218
    <copy todir="${base.context}/web"  encoding="UTF-8">
juanpablo@131
   219
      <fileset dir="${base.source}/web/"/>
carlos@0
   220
    </copy>
carlos@0
   221
    <chmod dir="${base.context}" perm="775"/>
carlos@0
   222
  </target>   
carlos@0
   223
carlos@0
   224
  <target name="compile.src" depends="compileSqlc, postsrc, copy.files">
carlos@0
   225
  </target>
juanpablo@131
   226
carlos@0
   227
  <target name="eclipse.compile" depends="wad,sqlc, postsrc, translate">
carlos@0
   228
  </target>
juanpablo@131
   229
carlos@0
   230
  <target name="eclipse.compile.complete" depends="clean,wad,sqlc, postsrc, translate">
juanpablo@131
   231
  </target>
carlos@0
   232
carlos@0
   233
  <target name="compile" depends="wad,compileSqlc, postsrc, translate">
carlos@0
   234
  </target>
carlos@0
   235
carlos@0
   236
  <target name="compile.complete" depends="clean,wad,compileSqlc,postsrc, translate">
carlos@0
   237
  </target>
carlos@0
   238
carlos@0
   239
  <target name="translate" if="translation">
carlos@0
   240
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
carlos@0
   241
      <param name="extension" value="html"/>
carlos@0
   242
    </antcall>
carlos@0
   243
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
carlos@0
   244
      <param name="extension" value="fo"/>
carlos@0
   245
    </antcall>
carlos@0
   246
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
carlos@0
   247
      <param name="extension" value="srpt"/>
carlos@0
   248
    </antcall>
carlos@0
   249
    <antcall inheritall="true" inheritrefs="true" target="compile.translate">
carlos@0
   250
      <param name="extension" value="jrxml"/>
carlos@0
   251
    </antcall>
carlos@0
   252
  </target>
carlos@0
   253
carlos@0
   254
  <target name="compile.translate">
carlos@0
   255
    <java classname="org.openbravo.translate.Translate" jvm="${env.JAVA_HOME}/bin/java" fork="yes" maxmemory="${build.maxmemory}">
asier@45
   256
      <arg line="${base.config}/Openbravo.properties ${extension} ${basedir} ${base.design} ${package}"/>
carlos@0
   257
      <classpath refid="project.class.path"/>
carlos@0
   258
    </java>
carlos@0
   259
  </target>
carlos@0
   260
carlos@0
   261
  <target name="installWebService" depends="init" if="wsdd">
carlos@0
   262
    <java classname="org.apache.axis.client.AdminClient" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}">
carlos@0
   263
      <arg line="-l${context.url}/servlet/AxisServlet ${src}/deploy.wsdd"/>
carlos@0
   264
      <classpath refid="project.class.path"/>
carlos@0
   265
    </java>
carlos@0
   266
  </target>
carlos@0
   267
carlos@0
   268
  <target name="uninstallWebService" depends="init">
carlos@0
   269
    <java classname="org.apache.axis.client.AdminClient" fork="yes" jvm="${env.JAVA_HOME}/bin/java" maxmemory="${build.maxmemory}">
carlos@8
   270
      <arg line="-l${context.url}/servlet/AxisServlet ${src}/undeploy.wsdd"/>
carlos@0
   271
      <classpath refid="project.class.path"/>
carlos@0
   272
    </java>
carlos@0
   273
  </target>
carlos@0
   274
carlos@0
   275
  <target name="copy.files">
carlos@0
   276
    <chmod dir="${build}" perm="755"/>
carlos@0
   277
    <mkdir dir="${jakarta.base}/webapps/${context.name}"/>
carlos@0
   278
    <copy todir="${jakarta.base}/webapps/${context.name}"  encoding="UTF-8">
carlos@0
   279
      <fileset dir="${base.context}"/>
carlos@0
   280
    </copy>
carlos@0
   281
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/classes"/>
juanpablo@131
   282
    <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/classes" encoding="UTF-8">
carlos@0
   283
      <fileset dir="${build}"/>
carlos@0
   284
    </copy> 
carlos@0
   285
    <chmod dir="${jakarta.base}/webapps/${context.name}" perm="775"/>
carlos@0
   286
  </target>
carlos@0
   287
carlos@0
   288
  <target name="compile.development" depends="compile, copy.files">
carlos@0
   289
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib"/>
carlos@0
   290
    <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8">
carlos@0
   291
    </copy>
carlos@0
   292
  </target>
carlos@0
   293
carlos@0
   294
  <target name="compile.complete.development" depends="compile.complete, copy.files">
carlos@0
   295
    <mkdir dir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib"/>
carlos@0
   296
    <copy todir="${jakarta.base}/webapps/${context.name}/WEB-INF/lib" file="${build.core.lib}/openbravo-core.jar" encoding="UTF-8">
carlos@0
   297
    </copy>
carlos@0
   298
  </target>
carlos@0
   299
carlos@0
   300
  <target name="build.war">
carlos@0
   301
    <chmod dir="${build}" perm="755"/>
carlos@0
   302
    <delete failonerror="false" file="${base.lib}/${context.name}.war"/>
carlos@0
   303
    <war compress="true" destfile="${base.lib}/${context.name}.war" encoding="UTF-8" webxml="${base.context}/WEB-INF/web.xml">
carlos@0
   304
      <zipfileset dir="${base.context}"/>
carlos@0
   305
      <classes dir="${build}"/>
carlos@0
   306
    </war>
carlos@0
   307
  </target>
carlos@0
   308
</project>