root/tags/release-0.13.4/pfixcore/skel/build-skel.xml

Revision 3959, 52.8 KB (checked in by akurth, 3 years ago)

Removed obsolete statusmessages file.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "ant.dtd">
3<!-- ant.dtd is generated by target dtd. This is not done automatically.
4If any problems arise either regenerate ant.dtd by invoking ant dtd
5or delete the DOCTYPE definition -->
6
7<project name="skel" default="all" basedir=".">
8  <!-- set global properties for this build -->
9  <property file="build.properties"/>
10  <property environment="env"/>
11  <property name="project.name"             value="${ant.project.name}"/>
12  <property name="uid"                      value="${env.USER}"/>
13  <property name="build.compiler"           value="modern"/>
14  <property name="build.compiler.emacs"     value="true"/>
15  <property name="javac.source"             value="1.5"/>
16  <property name="javac.encoding"           value="iso8859-1"/>
17  <property name="debugopts"                value="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5000"/>
18  <property name="gen"                      value="**/depend.xml"/>
19  <property name="dir.src"                  location="src"/>
20  <property name="dir.gensrc"               location="gensrc"/>
21  <property name="dir.build"                location="build"/>
22  <property name="dir.lib"                  location="lib"/>
23  <property name="lib.includes"             value="lib/**/*.jar"/>
24  <property name="test.lib.includes"        value="${lib.includes}"/>
25  <property name="dir.skel"                 location="skel"/>
26  <property name="dir.projects"             location="projects"/>
27  <property name="dir.docroot"              location="${dir.projects}" description="document root for tomcat, defaults to dir.projects"/>
28  <property name="dir.src.modules"          location="modules"/>
29  <property name="dir.extract.modules"      location="${dir.projects}/modules"/>
30  <property name="file.projects_xml"        location="${dir.projects}/servletconf/projects.xml"/>
31  <property name="validate"                 value="dynamic"/>
32  <property name="catalogfile"              location="${dir.projects}/core/schema/catalog.xml"/>
33  <property name="genlog"                   value="quiet"                                                description="which log4j config to use for the generate task; currently one of quiet, full, tree; defaults to quiet; see ${dir.projects}/core/conf/generator_*.xml"/>
34  <property name="file.log4jconfig"         location="${dir.projects}/core/conf/generator_${genlog}.xml"/>
35  <property name="dir.log"                  location="${dir.projects}/servletconf/log"/>
36  <!-- TODO: use dir.tomcat whereever possible -->
37  <!-- TODO: point into subdirectory of build.dir -->
38  <property name="dir.tomcat"               location="${dir.projects}/servletconf/tomcat"/>
39  <property name="dir.webapps"              location="${dir.tomcat}/webapps"/>
40  <property name="standalone.tomcat"        value="false"/>
41  <property name="portbase.tomcat"          value="8000"/>
42  <property name="webappmode"               value="false"/>
43  <property name="webapps"                  value=""/>
44
45  <property name="pat.pfixcore_jar"         value="pfixcore-*.jar"/>
46  <fileset  id="id.fs.pfixcore_jar"         dir="${dir.lib}" includes="pfixcore-*.jar"/>
47  <property name="pat.pfixcore_data_tgz"    value="pfixcore-*data*.tar.gz"/>
48  <fileset  id="id.fs.pfixcore_data_tgz"    dir="${dir.lib}" includes="${pat.pfixcore_data_tgz}"/>
49
50  <target name="check-ant-version" depends="ant-tasks-stage0">
51    <propertyregex property="unsupported.ant.version" input="${ant.version}" regexp="1\.[0-6](\.[0-9]+)?" select="\0"/>
52    <fail if="unsupported.ant.version" message="The currently used Ant version is too old, you are using ${unsupported.ant.version}, but 1.7.0 or higher is required!!!"/>
53  </target>
54
55  <target name="properties">
56    <!-- Ant properties are immutable, the order of definition is:
57         - ant commandline via the '-Dparam=value' option
58         - file build.properties in java.util.Properties format
59         - environment variable MAKE_MODE, e.g. export MAKE_MODE=test
60    -->
61    <condition property="makemode" value="${env.MAKE_MODE}">
62      <and>
63        <isset property="env.MAKE_MODE"/>
64        <not><equals arg1="${env.MAKE_MODE}" arg2=""/></not>
65      </and>
66    </condition>
67    <fail unless="makemode" message="Property &quot;makemode&quot; not set or empty. This property specifies whether the pustefix system is built and run in development mode (makemode=test) or production mode (makemode=prod). Specify propery either on the commandline (E.g. ant -Dmakemode=test or with the environment variable MAKE_MODE. See ant -projecthelp for more details." />
68
69    <condition property="javahome" value="${env.PFX_JAVA_HOME}">
70      <and>
71        <isset property="env.PFX_JAVA_HOME"/>
72        <not><equals arg1="${env.PFX_JAVA_HOME}" arg2=""/></not>
73      </and>
74    </condition>
75    <condition property="javahome" value="${env.JAVA_HOME}">
76      <and>
77        <isset property="env.JAVA_HOME"/>
78        <not><equals arg1="${env.JAVA_HOME}" arg2=""/></not>
79      </and>
80    </condition>
81    <condition property="javahome" value="${java.home}">
82      <and>
83        <isset property="java.home"/>
84        <not><equals arg1="${java.home}" arg2=""/></not>
85      </and>
86    </condition>
87    <fail unless="javahome" message="Property &quot;javahome&quot; not set. This property is used to create projects/servletconf/tomcat/workers.prop. Set environment variable JAVA_HOME to point to the root directory of the Java2 Standard Edition installation you wish to use."/>
88    <echo message="Using javahome=${javahome}"/>
89
90    <property name="debug" value="true"/>
91    <property name="debuglevel" value="lines,vars,source"/>
92
93    <condition property="machine"       value="${env.MACHINE}">
94      <and>
95        <isset property="env.MACHINE"/>
96        <not><equals arg1="${env.MACHINE}" arg2=""/></not>
97      </and>
98    </condition>
99    <exec outputproperty="machine" executable="hostname" os="Linux, Mac OS X"><arg value="-s"/></exec>
100    <fail message="Property &quot;machine&quot; not set. Either set environment variable MACHINE or property machine to the localpart of your fully qualified hostname." unless="machine"/>
101
102    <exec outputproperty="dnsdomainname"    executable="hostname" os="Linux"><arg value="-d"/></exec>
103    <exec outputproperty="dnsdomainname"    executable="sh" os="Mac OS X"><arg value="-c"/><arg value="hostname|cut -d. -f2-"/></exec>
104        <condition property="fqdn"     value="${machine}.${dnsdomainname}">
105      <isset property="dnsdomainname"/>
106    </condition>
107    <condition property="fqdn"     value="${machine}">
108      <not><isset property="dnsdomainname"/></not>
109    </condition>
110    <condition property="in.webapp.mode">
111      <equals arg1="${webappmode}" arg2="true"/>
112    </condition>
113  </target>
114
115  <path id="cp.libs">
116    <fileset dir="${basedir}" includes="${lib.includes}"/>
117    <fileset dir="${dir.projects}/servletconf/tomcat/common" includes="lib/servlet-api.jar"/>
118  </path>
119
120  <path id="cp.classpath">
121    <path refid="cp.libs"/>
122    <pathelement location="${dir.build}"/>
123  </path>
124 
125  <path id="test.libs">
126    <fileset dir="${basedir}" includes="${test.lib.includes}"/>
127    <fileset dir="${dir.projects}/servletconf/tomcat/common" includes="lib/servlet-api.jar"/>
128  </path>
129 
130  <path id="test.classpath">
131    <path refid="test.libs"/>
132    <pathelement location="${dir.build}"/>
133  </path>
134
135  <target name="check-newbuildskel">
136    <condition property="newbuildskel">
137      <and>
138        <available file="${dir.projects}/core/build/build-skel.xml"/>
139        <available file="build-skel.xml"/>
140        <not>
141          <uptodate srcfile="${dir.projects}/core/build/build-skel.xml" targetfile="build-skel.xml"/>
142        </not>
143      </and>
144    </condition>
145  </target>
146
147  <target name="check-changedbuildskel" depends="check-newbuildskel" if="newbuildskel">
148    <checksum file="${dir.projects}/core/build/build-skel.xml" property="newbuildskelMD5"/>
149    <checksum file="build-skel.xml" property="oldbuildskelMD5"/>
150    <condition property="changedbuildskel">
151      <not><equals arg1="${newbuildskelMD5}" arg2="${oldbuildskelMD5}"/></not>
152    </condition>
153  </target>
154
155  <target name="check-buildskel" depends="check-changedbuildskel" if="changedbuildskel">
156    <echo level="warning">
157      There's a new build-skel.xml in ${dir.projects}/core/build.
158      Please replace build-skel.xml in your Pustefix root directory by the new version, e.g.:
159     
160      cp ${dir.projects}/core/build/build-skel.xml .
161    </echo>
162    <fail message="Replace build-skel.xml and rebuild."/>
163  </target>
164
165  <target name="init-dirs">
166    <mkdir dir="${dir.build}"/>
167    <mkdir dir="${dir.src}"/>
168    <mkdir dir="${dir.gensrc}"/>
169    <mkdir dir="${dir.log}"/>
170  </target>
171
172  <target name="init" depends="check-ant-version, properties, init-data, check-buildskel, init-dirs">
173    <echo message="using machine=${machine} fqdn=${fqdn}" level="verbose"/>
174   
175    <!-- Create commons-logging configuration info -->
176    <mkdir dir="${dir.build}/META-INF/services"/>
177    <echo file="${dir.build}/META-INF/services/org.apache.commons.logging.LogFactory">de.schlund.pfixxml.util.logging.ProxyLogFactory</echo>
178   
179    <!-- pathconvert dumps classpath on ant -verbose -->
180    <!-- failed on 2005-10-21 with "example/servletconf/tomcat/common not found"
181    <pathconvert property="dev.null" refid="cp.classpath" pathsep="&#013;"/>
182    -->
183  </target>
184
185  <target name="noop" description="just prints the name of the project">
186    <echo message="${project.name}"/>
187  </target>
188
189  <target name="echoproperties" depends="properties">
190    <echoproperties/>
191  </target>
192
193  <target name="debug" depends="all" description="builds all and runs tomcat with debugging options">
194    <!-- added suspend=n to default debugging option, as without this option
195         Ctrl-C would not stop tomcat without leaving java processes hanging around
196         suspend=y target VM is to be suspended immediately before the main class is loaded
197         suspend=n do not suspend target VM
198         see http://java.sun.com/j2se/1.4.2/docs/guide/jpda/conninv.html -->
199    <antcall target="_run" inheritall="true">
200      <param name="run.debugopts" value="${debugopts}"/>
201    </antcall>
202  </target>
203
204  <target name="run" depends="all" description="builds all and runs tomcat">
205    <antcall target="_run" inheritall="true">
206      <param name="run.debugopts" value=""/>
207    </antcall>
208  </target>
209
210  <target name="_run">
211    <property name="run.debugopts" value=""/>
212    <path id="run.path.ld_library_path">
213      <pathelement path="${env.LD_LIBRARY_PATH}"/>
214    </path>
215    <property name="run.ld_library_path" refid="run.path.ld_library_path"/>
216    <exec dir="${dir.projects}/servletconf/tomcat" executable="${dir.projects}/servletconf/tomcat/bin/catalina.sh" vmlauncher="false">
217      <env key="LD_LIBRARY_PATH" value="${run.ld_library_path}"/>
218      <env key="JAVA_OPTS" value="-mx200M ${run.debugopts}"/>
219      <env key="JSSE_HOME" value="${basedir}/lib/jsse"/>
220      <env key="LANG" value="C"/>
221      <arg line="run"/>
222    </exec>
223  </target>
224
225  <target name="generate" depends="all" description="Generates Targets to ${dir.projects}/.cache">
226    <echo message="If build dies with an OutOfMemoryException, set and export environment variable ANT_OPTS to something like ANT_OPTS=&quot;-ms200m -mx200m&quot;."/>
227    <pfx-generate dir="${dir.projects}" includes="${gen}" log4jconfig="${file.log4jconfig}" excludes="${excludes.projects}"/>
228  </target>
229
230  <target name="all"
231          depends="init, compile, post-compile, installjars, check-permissions, compile-xml"
232          description="builds all files required to run"
233          />
234
235  <target name="compile-xml"
236          depends="buildtime-props, scgenerate, web_xml, webapp-setup, autodeploy, pfixlog_xml, apache_conf, jk_conf, ajp_conf, workers_prop, server_xml, webservice"
237          description="performs xslt transformations in dir.projects"
238          />
239
240  <target name="depend" depends="generate-src" description="checks dependencies of all .java files">
241    <depend
242     srcdir="${dir.src}"
243     destdir="${dir.build}"
244     cache="${dir.build}"
245     >
246    </depend>
247  </target>
248
249  <target name="pre-compile">
250    <!-- general purpose hook for build files importing this build file -->
251  </target>
252
253  <target name="generate-src" depends="ant-tasks, pre-compile" description="generates interfaces wrappers by transforming .iwrp to .java files">
254    <pfx-iwrp srcdir="${dir.src}" includes="**/*.iwrp" destdir="${dir.gensrc}" extension=".java" style="${dir.projects}/core/build/iwrapper.xsl" excludes="${excludes.src}" validate="${validate}" catalogfile="${catalogfile}"/>
255  </target>
256
257  <target name="apt" depends="ant-tasks">
258    <pfx-apt
259      classpathref="cp.classpath"
260      srcdir="${dir.src}:${dir.gensrc}"
261      destdir="${dir.build}"
262      preprocessdir="${dir.gensrc}"
263      encoding="${javac.encoding}"
264      factory="de.schlund.pfixcore.util.CommonAnnotationProcessorFactory"
265    />
266  </target>
267
268  <target name="compile" depends="tomcat.dir.opt, generate-src, depend, pre-compile, scgenerate, apt" description="preprocesses and compiles all .java files">
269    <javac
270     srcdir="${dir.src}:${dir.gensrc}"
271     destdir="${dir.build}"
272     debug="${debug}"
273     debuglevel="${debuglevel}"
274     classpathref="cp.classpath"
275     source="${javac.source}"
276     nowarn="${javac.nowarn}"
277     encoding="${javac.encoding}"
278     excludes="${excludes.src}, ${exclude.examples}"
279     >
280    </javac>
281
282    <available file="res" type="dir" property="has.resources" />
283    <antcall target="resources"/>
284  </target>
285
286  <target name="resources" if="has.resources">
287    <copy todir="${dir.build}">
288      <fileset dir="res"/>
289    </copy>
290  </target>
291   
292  <target name="post-compile" depends="compile">
293    <!-- general purpose hook for build files importing this build file -->
294  </target>
295
296  <target name="installjars" depends="tomcat.dir.opt">
297    <condition property="shared_lib_dirname" value="webapp-lib" else="lib">
298        <isset property="in.webapp.mode"/>
299    </condition>
300    <condition property="shared_classes_dirname" value="webapp-classes" else="classes">
301        <isset property="in.webapp.mode"/>
302    </condition>
303    <condition property="old_shared_lib_dirname" value="lib" else="webapp-lib">
304        <isset property="in.webapp.mode"/>
305    </condition>
306    <condition property="old_shared_classes_dirname" value="classes" else="webapp-classes">
307        <isset property="in.webapp.mode"/>
308    </condition>
309    <exec executable="sh">
310      <arg line="-c &quot;[ -L ${dir.tomcat}/shared/${old_shared_classes_dirname} ] &amp;&amp; rm -rf ${dir.tomcat}/shared/${old_shared_classes_dirname}; [ -e ${dir.tomcat}/shared/${old_shared_lib_dirname} ] &amp;&amp; rm -rf ${dir.tomcat}/shared/${old_shared_lib_dirname}&quot;"/>
311    </exec>
312    <!-- Setting absolute links instead of relative to avoid extra property for dir.build
313         as ${dir.build} is specified as location it always resolves to an absolute path;
314         does not work for filenames containing spaces -->
315    <echo level="verbose" message="Setting symlink to ${dir.build} as ${dir.projects}/servletconf/tomcat/shared/${shared_classes_dirname}"/>
316    <exec executable="sh">
317      <arg line="-c &quot;[ -e ${dir.projects}/servletconf/tomcat/shared/${shared_classes_dirname} ] &amp;&amp; rm -fr ${dir.projects}/servletconf/tomcat/shared/${shared_classes_dirname} ; ln -s  ${dir.build} ${dir.projects}/servletconf/tomcat/shared/${shared_classes_dirname}&quot;"/>
318    </exec>
319    <!-- As task delete does not delete symbolic links, deleting symlinks using native tools. -->
320    <!-- Deleting symlinks pointing to non existent files, assuming jar files -->
321    <!-- replaced by new versions (with new filenames) do not exist anymore -->
322    <mkdir dir="${dir.projects}/servletconf/tomcat/shared/${shared_lib_dirname}"/>
323    <exec executable="find" os="Linux, Mac OS X">
324      <arg file="${dir.projects}/servletconf/tomcat/shared/${shared_lib_dirname}"/>
325      <arg line="-iname *.jar -a -type l -exec rm -v {} ;"/>
326    </exec>
327    <echo level="verbose">Creating symlinks in tomcat's lib directory</echo>
328    <pathconvert property="cp.property" refid="cp.libs" pathsep=","/>
329    <apply executable="ln" dir="${dir.projects}/servletconf/tomcat/shared/${shared_lib_dirname}" failonerror="true" verbose="true"
330      type="file">  <!-- type file: to make sure that directories that might be added to cp.libs by accident are not passed to ln -->
331      <arg value="-s"/>
332      <srcfile/>
333      <arg value="."/>
334      <filelist dir="/" files="${cp.property}"/>
335    </apply>
336  </target>
337
338  <target name="ant-tasks" depends="ant-tasks-stage0, ant-tasks-stage1, ant-tasks-stage2"/>
339 
340  <target name="ant-tasks-stage0" description="declares the ant contrib tasks">
341     <taskdef
342     resource="net/sf/antcontrib/antlib.xml"
343     >
344        <classpath>
345            <fileset dir="${basedir}" includes="${lib.includes}"/>
346        </classpath>
347     </taskdef>
348  </target>
349 
350  <target name="ant-tasks-stage1" depends="init-dirs, tomcat.dir.opt" description="declares the ant task used for generating java source code. This target needs to be run prior to the actual compile.">
351    <taskdef
352     name="pfx-xslt"
353     classname="de.schlund.pfixcore.util.XsltGenericTask"
354     classpathref="cp.classpath"
355     loaderref="pfx-loader"
356     description="Performs generic XSLT transformations"
357     />
358    <taskdef
359         name="pfx-buildtime-props"
360         classname="de.schlund.pfixxml.config.BuildTimePropTask"
361         classpathref="cp.classpath"
362         loaderref="pfx-loader"
363         description="Stores properties used at buildtime to be used later at runtime"
364         />
365    <taskdef
366         name="pfx-propfiles"
367         classname="org.pustefixframework.config.build.CreatePropertyFileTask"
368         classpathref="cp.classpath"
369         loaderref="pfx-loader"
370         description="Creates standard Java property files from customizable XML property files"
371         />
372        <taskdef
373         name="pfx-sclibgen"
374         classname="de.schlund.pfixcore.util.GenerateSCodesTask"
375         classpathref="cp.classpath"
376         loaderref="pfx-loader"
377         description="Generate StatusCodeLib from statusmessages"
378        />
379        <taskdef
380         name="pfx-init-resource-util"
381         classname="org.pustefixframework.config.build.InitResourceUtilTask"
382         classpathref="cp.classpath"
383         loaderref="pfx-loader"
384         description="Initialize ResourceUtil use by other tasks"
385        />
386        <pfx-init-resource-util docroot="${dir.docroot}"/>
387  </target>
388 
389  <target name="ant-tasks-stage2" depends="init-dirs, tomcat.dir.opt" description="declares the ant task used for generating java source code. This target needs to be run prior to the actual compile.">
390    <taskdef
391     name="pfx-iwrp"
392     classname="de.schlund.pfixcore.util.XsltIWrapperTask"
393     classpathref="cp.classpath"
394     loaderref="pfx-loader"
395     description="Generates .java files out of .iwrp (Interface Wrapper) files"
396     />
397        <taskdef
398         name="pfx-webxml"
399         classname="org.pustefixframework.config.build.CreateWebXmlTask"
400         classpathref="cp.classpath"
401         loaderref="pfx-loader"
402         description="Creates WEB-INF/web.xml config files for each project"
403         />
404    <taskdef
405         name="pfx-server-config"
406         classname="org.pustefixframework.config.build.CreateServerConfigurationTask"
407         classpathref="cp.classpath"
408         loaderref="pfx-loader"
409         description="Creates central server configuration file"
410         />
411    <taskdef
412     name="pfx-xsltcus"
413     classname="de.schlund.pfixcore.util.XsltCustomizeXmlTask"
414     classpathref="cp.classpath"
415     loaderref="pfx-loader"
416     description="Performs XSLT transformations and evaluates customization tags"
417     />
418    <taskdef
419     name="pfx-generate"
420     classname="de.schlund.pfixcore.util.TargetGeneratorTask"
421     classpathref="cp.classpath"
422     loaderref="pfx-loader"
423     description="Creates dependencies in ${dir.projects}/.cache"
424     />
425    <taskdef
426     name="pfx-passthroughcopy"
427     classname="de.schlund.pfixcore.util.WebappCopyPassthroughHtdocsTask"
428     classpathref="cp.classpath"
429     loaderref="pfx-loader"
430     description="Copy passthrough paths during WAR generation"
431     />
432    <taskdef
433     name="pfx-unpack-jar-module"
434     classname="de.schlund.pfixcore.util.UnpackModuleTask"
435     classpathref="cp.classpath"
436     loaderref="pfx-loader"
437     description="Checks JARs for a Pustefix module deployment descriptor and unpacks the resources"
438     />
439    <taskdef
440     name="pfx-scmerge"
441     classname="de.schlund.pfixcore.util.MergeTask"
442     classpathref="cp.classpath"
443     loaderref="pfx-loader"
444     description="Merge statusmessages from module with existing statusmessages"
445    />
446    <taskdef
447      name="pfx-apt"
448      classname="de.schlund.pfixcore.generator.iwrpgen.AptTask"
449      classpathref="cp.classpath"
450      loaderref="pfx-loader"
451      description="Pustefix APT task"
452    />
453  </target>
454
455  <target name="webservice-modules-check">
456    <available classname="org.pustefixframework.webservices.jaxws.generate.WebserviceTask" classpathref="cp.classpath" property="webservice.jaxws.available"/>
457  </target>
458 
459  <target name="ant-tasks-webservice" depends="webservice-modules-check" if="webservice.jaxws.available">
460    <taskdef
461      name="pfx-webservice"
462      classname="org.pustefixframework.webservices.jaxws.generate.WebserviceTask"
463      classpathref="cp.classpath"
464      description="Generates/deploys WSDL, WSDD and JS stubs from web service interfaces/configuration"
465    />
466  </target>
467
468  <target name="dtd" depends="dtd-check, ant-tasks" unless="upd.dtd" description="creates a DTD for this build file">
469    <!-- DTD generated does not describe this build file thorough. It can't be used
470         for complete validation though it may be useful for auto competion within IDEs.
471         The Element not generated is the nested type "param" used within the custom ant-tasks -->
472    <echo message="Creating ant.dtd" level="info"/>
473    <antstructure output="ant.dtd"/>
474  </target>
475
476  <target name="dtd-check" unless="pfx.force">
477    <uptodate property="upd.dtd" srcfile="build.xml" targetfile="ant.dtd"/>
478  </target>
479
480  <target name="clean-dtd">
481    <delete file="ant.dtd"/>
482  </target>
483
484  <target name="clean" depends="clean-modules, clean-project, clean-webapps, clean-webservice" description="deletes ${dir.build}, directory trees and all .java files generated from .iwrp files in ${dir.src}">
485    <delete dir="${dir.build}" />
486    <!-- Delete *.java files created from some kind source files (e.g. .iwrp files) -->
487    <delete dir="${dir.gensrc}" />
488  </target>
489
490  <target name="clean-modules" description="deletes files from ${dir.extract.modules}">
491      <delete dir="${dir.extract.modules}" failonerror="false"/>
492  </target>
493 
494  <target name="clean-project" description="deletes files from ${dir.projects}">
495    <mkdir dir="${dir.webapps}"/>
496    <delete>
497      <fileset dir="${dir.projects}" includes="**/*.xsl" excludes="modules/**">
498        <present present="both" targetdir="${dir.projects}">
499          <mapper type="glob" from="*.xsl" to="*.xsl.in"/>
500        </present>
501      </fileset>
502      <fileset dir="${dir.projects}" includes="**/*.prop" excludes="modules/**">
503        <present present="both" targetdir="${dir.projects}">
504          <mapper type="glob" from="*.prop" to="*.prop.in"/>
505        </present>
506      </fileset>
507      <fileset dir="${dir.projects}" includes="**/webservice.conf" excludes="modules/**">
508        <present present="both" targetdir="${dir.projects}">
509          <mapper type="glob" from="*webservice.conf" to="*webservice.conf.in"/>
510        </present>
511      </fileset>
512      <fileset dir="${dir.projects}" includes="common/conf/buildtime.prop servletconf/projects.xml servletconf/tomcat/apache.conf servletconf/tomcat/jk.conf servletconf/tomcat/workers.prop servletconf/tomcat/conf/server.xml"/>
513    </delete>
514    <delete dir="${dir.projects}/servletconf/tomcat/conf/Catalina"/>
515  </target>
516 
517  <target name="clean-webapps-avl">
518    <available file="${dir.webapps}" property="avl.clean-webapps"></available>
519  </target>
520 
521  <target name="clean-webapps" depends="clean-webapps-avl" if="avl.clean-webapps">
522    <delete>
523      <fileset dir="${dir.webapps}" includes="**/WEB-INF/web.xml"/>
524    </delete>
525  </target>
526
527  <target name="distclean" depends="realclean">
528    <delete dir="${dir.projects}/.cache"/>
529  </target>
530
531  <target name="realclean" depends="clean, realclean-core"/>
532
533  <target name="realclean-core">
534    <delete dir="${dir.tomcat}"/>
535    <delete dir="${dir.projects}/core"/>
536  </target>
537       
538  <target name="extract-modules-check">
539    <!-- extract only if there are newer jars in the src directory than the target directory -->
540    <uptodate property="upd.extract-modules" targetfile="${dir.extract.modules}/TIMESTAMP">
541      <srcfiles dir="${dir.src.modules}" includes="**/*.jar"/>
542      <srcfiles dir="${basedir}" includes="${lib.includes}"/>
543    </uptodate>
544  </target>
545
546  <target name="extract-modules" depends="extract-modules-check, ant-tasks" unless="upd.extract-modules" description="extracts all *.jar files in ${dir.extract.modules}">
547    <antcall target="clean-modules"/>
548    <mkdir dir="${dir.extract.modules}"/>
549    <unjar dest="${dir.extract.modules}">
550      <fileset dir="${dir.src.modules}" includes="*.jar" />
551    </unjar>
552    <antcall target="-extract-jar-modules"></antcall>
553    <chmod perm="444"><fileset dir="${dir.extract.modules}" includes="**/*"/></chmod>
554    <touch file="${dir.extract.modules}/TIMESTAMP"/>
555    <foreach param="tmp.modules.buildxml" target="extract-modules-call-ant" inheritall="true" inheritrefs="true">
556      <fileset dir="${dir.extract.modules}">
557        <include name="*/build.xml"/>
558      </fileset>   
559    </foreach>
560    <antcall target="scmerge-modules"/>
561  </target>
562
563  <target name="webapp-setup" depends="webapp-removelinks, webapp-createlinks"/>
564
565  <target name="webapp-createlinks" depends="ant-tasks" if="in.webapp.mode">
566    <exec executable="sh">
567      <arg line="-c &quot;for f in `find ${dir.projects}/servletconf/tomcat/webapps -maxdepth 2 -type d -name 'WEB-INF'`; do [ ! -e $f/classes ] &amp;&amp; ln -s ${dir.projects}/servletconf/tomcat/shared/webapp-classes $f/classes; [ ! -e $f/lib ] &amp;&amp; ln -s ${dir.projects}/servletconf/tomcat/shared/webapp-lib $f/lib; done&quot;"/>
568    </exec>
569  </target>
570
571  <target name="webapp-removelinks" depends="ant-tasks" unless="in.webapp.mode">
572    <exec executable="sh">
573      <arg line="-c &quot;for f in `find ${dir.projects}/servletconf/tomcat/webapps -maxdepth 2 -type d -name 'WEB-INF'`; do [ -L $f/classes ] &amp;&amp; rm $f/classes; [ -L $f/lib ] &amp;&amp; rm $f/lib; done&quot;"/>
574    </exec>
575  </target>
576
577  <target name="-extract-jar-modules" depends="ant-tasks" description="Extracts resource data from JAR libraries">
578    <!-- This target should only be called by extract-modules --> 
579    <pfx-unpack-jar-module srcdir="${basedir}" extracttodir="${dir.extract.modules}" includes="${lib.includes}" />
580  </target>   
581 
582  <target name="extract-modules-call-ant">
583    <dirname property="tmp.modules.modulepath" file="${tmp.modules.buildxml}"/>
584    <ant antfile="${tmp.modules.buildxml}" dir="${tmp.modules.modulepath}" inheritAll="false">
585      <property name="dir.docroot" value="${dir.docroot}"/>
586      <property name="dir.projects" value="${dir.projects}"/>   
587      <property name="makemode" value="${makemode}"/>
588      <property name="uid" value="${uid}"/>
589      <property name="fqdn" value="${fqdn}"/>
590      <property name="machine" value="${machine}"/>
591    </ant>
592  </target>
593 
594  <target name="init-data-check" unless="pfx.force">
595    <!-- extract only if pfixcore-data.jar is newer than dir ${dir.projects}/core -->
596    <uptodate property="upd.init-data">
597      <srcfiles dir="${dir.lib}" includes="${pat.pfixcore_data_tgz}"></srcfiles>
598      <mapper type="merge" to="${dir.projects}/core/TIMESTAMP"></mapper>
599    </uptodate>
600  </target>
601
602  <target name="init-data" depends="extract-modules, init-data-check" unless="upd.init-data">
603    <delete dir="${dir.projects}/core"/>
604    <untar dest="${dir.projects}" compression="gzip" overwrite="true">
605      <fileset refid="id.fs.pfixcore_data_tgz"/>
606    </untar>
607    <antcall target="scmerge-core"/>
608    <chmod perm="444"><fileset dir="${dir.projects}/core" includes="**/*"/></chmod>
609    <touch file="${dir.projects}/core/TIMESTAMP"></touch>
610  </target>
611
612  <target name="scmerge-core" depends="ant-tasks-stage2">
613    <pfx-scmerge
614      srcdir="${dir.projects}/core"
615      destdir="${dir.projects}/core-override"
616      includes="dyntxt/statusmessages-core.xml"
617      suffix="-merged"
618      selection="/include_parts/part/theme[@name='default']"
619    />
620    <pfx-scmerge
621      srcdir="${dir.projects}/core"
622      destdir="${dir.projects}/core-override"
623      includes="dyntxt/statusmessages-editor.xml"
624      suffix="-merged"
625      selection="/include_parts/part/theme[@name='default']"
626    />
627  </target>
628
629  <target name="scmerge-modules" depends="ant-tasks-stage2">
630    <pfx-scmerge
631      srcdir="${dir.projects}/modules"
632      destdir="${dir.projects}/modules-override"
633      includes="*/dyntxt/statusmessages.xml"
634      suffix="-merged"
635      selection="/include_parts/part/theme[@name='default']"
636    />
637  </target>
638       
639  <target name="scgenerate" depends="buildtime-props">
640    <pfx-sclibgen
641      gendir="${dir.gensrc}"
642      docroot="${dir.projects}"
643      property="scgenerate.classes"
644      includes="*/dyntxt/statuscodeinfo.xml */conf/statuscodeinfo.xml"
645    />
646    <javac
647     srcdir="${dir.src}"
648     destdir="${dir.build}"
649     includes="de/schlund/util/statuscodes/*.java, de/schlund/pfixxml/resources/ResourceUtil.java"
650     debug="${debug}"
651     classpathref="cp.classpath"
652     encoding="${javac.encoding}"
653     >
654    </javac>
655    <antcall target="scgenerate-compile"/>
656  </target>
657
658  <target name="scgenerate-compile" if="scgenerate.classes">   
659    <javac
660     srcdir="${dir.gensrc}"
661     destdir="${dir.build}"
662     includes="${scgenerate.classes}"
663     debug="${debug}"
664     classpathref="cp.classpath"
665     encoding="${javac.encoding}"
666     >
667    </javac>
668  </target>
669 
670  <target name="check-permissions">
671    <apply executable="chmod" os="Linux, Mac OS X">
672      <arg line="a+x"/>
673      <fileset dir="${basedir}" includes="newproject.sh startTomcat.sh skel/newproject.sh skel/startTomcat.sh bin/setClassPath.sh bin/setvars.sh stuff/**/*.sh stuff/**/bin/*"/>
674      <fileset dir="${dir.projects}" includes="**/*.sh"/>
675    </apply>
676  </target>
677
678  <target name="force" description="disables uptodate checks">
679    <!-- All targets *-check that have set the attribute unless="pfx.force"
680         will be skipped, so the uptodate properties (upd.*), the execution of the actual tasks
681         depends on, do not get set and in turn the actual tasks get executed. -->
682    <property name="pfx.force" value="true"/>
683  </target>
684
685  <target name="checkfiles">
686    <!-- find the input files and write them to line separated files -->
687    <pathconvert property="checkfiles.ALLPROJECTS" pathsep="&#10;">
688      <path>
689        <fileset dir="${dir.projects}">
690          <include name="**/depend.xml"/>
691        </fileset>
692      </path>
693      <map from="${dir.projects}/" to=""/>
694    </pathconvert>
695    <echo message="${checkfiles.ALLPROJECTS}" file="${dir.projects}/.ALLPROJECTS"/>
696    <pathconvert property="checkfiles.ALLINCFILES" pathsep="&#10;">
697      <path>
698        <fileset dir="${dir.projects}" casesensitive="false">
699          <include name="**/txt/**/*.xml"/>
700        </fileset>
701      </path>
702      <map from="${dir.projects}/" to=""/>
703    </pathconvert>
704    <echo message="${checkfiles.ALLINCFILES}" file="${dir.projects}/.ALLINCFILES"/>
705    <pathconvert property="checkfiles.ALLIMAGES" pathsep="&#10;">
706      <path>
707        <fileset dir="${dir.projects}" casesensitive="false">
708          <include name="**/img/**/*.gif" />
709          <include name="**/img/**/*.jp*g"/>
710        </fileset>
711      </path>
712      <map from="${dir.projects}/" to=""/>
713    </pathconvert>
714    <echo message="${checkfiles.ALLIMAGES}" file="${dir.projects}/.ALLIMAGES"/>
715    <!-- we must fork a java vm here to set the current dir -->
716    <java
717     classname="de.schlund.pfixcore.util.CheckIncludes"
718     classpathref="cp.classpath"
719     dir="${dir.projects}"
720     fork="true"
721     failonerror="true"
722     >
723      <arg file="${dir.projects}/CHECKOUTPUT.xml"/>
724      <arg file="${dir.projects}/.ALLPROJECTS"/>
725      <arg file="${dir.projects}/.ALLINCFILES"/>
726      <arg file="${dir.projects}/.ALLIMAGES"/>
727    </java>
728    <echo message="Output written to ${dir.projects}/CHECKOUTPUT.xml" level="info"/>
729  </target>
730
731  <target name="buildtime-props" depends="ant-tasks-stage1" description="creates build-time property file">
732    <!-- Generate propfile with buildtime information -->
733    <pfx-buildtime-props
734     file="${dir.projects}/common/conf/buildtime.prop"
735     mode="${makemode}"
736     uid="${uid}"
737     machine="${machine}"
738     fqdn="${fqdn}"
739     docroot="${dir.projects}"
740    />
741  </target>
742
743  <target name="propfiles" depends="ant-tasks-stage1, buildtime-props" description="create Java property files from Pustefix XML property files">
744    <pfx-propfiles
745      basedir="${dir.projects}"
746      includes="**/*.prop.in"
747      excludes="modules/**"     
748      extension="prop"
749    />
750  </target>
751
752  <target name="web_xml" depends="ant-tasks, defaultwebxml" description="creates servletconf/tomcat/webapps/**/WEB-INF/web.xml">
753        <pfx-webxml
754                basedir="${dir.projects}"
755                webappsdir="${dir.tomcat}/webapps"
756                includes="**/conf/project.xml"
757                commonconfig="${dir.projects}/common/conf/projects.xml"
758                stylesheet="${dir.projects}/core/build/create_webxml.xsl"
759        />
760  </target>
761
762  <target name="init-autodeploy">
763    <available file="${dir.projects}/servletconf/autodeploy" type="dir" property="autodeploy.exists"/>
764  </target>
765                                                                                                                                                           
766  <target name="autodeploy" depends="web_xml, init-autodeploy" if="autodeploy.exists">
767    <copy todir="${dir.tomcat}">
768      <fileset dir="${dir.projects}/servletconf/autodeploy" includes="**"/>
769    </copy>
770  </target>
771
772  <target name="stylesheets" depends="ant-tasks, init" description="creates **/*.xsl from **/*.xsl.in with create_stylesheet.xsl">
773    <echo>WARNING: The 'stylesheets' target is deprecated. Instead you should adapt your '.xsl.in' files and either replace the 'cus:documentation' tags by comments or make them to top-level tags, which will be ignored by the XSLT processor.</echo>
774    <pfx-xslt
775     style="${dir.projects}/core/build/create_stylesheet.xsl"
776     srcdir="${dir.projects}"
777     destdir="${dir.projects}"
778     includes="**/*.xsl.in"
779     excludes="modules/**"   
780     extension=""
781     >
782      <param name="docroot" expression="${dir.docroot}"/>
783      <param name="fqdn"    expression="${fqdn}"/>
784      <param name="uid"     expression="${uid}"/>
785      <param name="machine" expression="${machine}"/>
786      <param name="mode"    expression="${makemode}"/>
787    </pfx-xslt>
788  </target>
789
790  <target name="pfixlog_xml" depends="ant-tasks" description="creates common/conf/pfixlog.xml from common/conf/pfixlog.xml.in with core/build/create_log4j_config.xsl">
791    <pfx-xsltcus
792     style="${dir.projects}/core/build/create_log4j_config.xsl"
793     infile="${dir.projects}/common/conf/pfixlog.xml"
794     outfile="${dir.projects}/servletconf/tomcat/conf/log4j.xml"
795     docroot="${dir.projects}"
796     extension=""
797     >
798      <param name="docroot" expression="${dir.docroot}"/>
799      <param name="fqdn"    expression="${fqdn}"/>
800      <param name="uid"     expression="${uid}"/>
801      <param name="machine" expression="${machine}"/>
802      <param name="mode"    expression="${makemode}"/>
803    </pfx-xsltcus>
804  </target>
805
806  <target name="apache_conf" depends="ant-tasks" description="creates servletconf/tomcat/apache.conf from servletconf/projects.xml with core/build/create_apacheconf.xsl">
807    <pfx-server-config
808      basedir="${dir.projects}"
809      outfile="${dir.tomcat}/apache.conf"
810      includes="**/conf/project.xml"
811      commonconfig="${dir.projects}/common/conf/projects.xml"
812      docroot="${dir.docroot}"
813      stylesheet="${dir.projects}/core/build/create_apacheconf.xsl"
814    >
815    </pfx-server-config>
816  </target>
817
818  <target name="jk_conf" depends="ant-tasks" description="creates servletconf/tomcat/jk.conf from servletconf/projects.xml with core/build/create_jkconf.xsl">
819    <pfx-xslt
820     infile="${dir.projects}/common/conf/projects.xml"
821     outfile="${dir.tomcat}/jk.conf"
822     style="${dir.projects}/core/build/create_jkconf.xsl"
823     >
824      <param name="docroot"   expression="${dir.docroot}"/>
825      <param name="fqdn"      expression="${fqdn}"/>
826      <param name="uid"       expression="${uid}"/>
827      <param name="machine"   expression="${machine}"/>
828      <param name="mode"      expression="${makemode}"/>
829    </pfx-xslt>
830  </target>
831 
832  <target name="ajp_conf" depends="ant-tasks" description="creates servletconf/tomcat/ajp.conf from servletconf/projects.xml with core/build/create_ajpconf.xsl">
833    <pfx-xslt
834     infile="${dir.projects}/common/conf/projects.xml"
835     outfile="${dir.tomcat}/ajp.conf"
836     style="${dir.projects}/core/build/create_ajpconf.xsl"
837     >
838      <param name="docroot"   expression="${dir.docroot}"/>
839      <param name="fqdn"      expression="${fqdn}"/>
840      <param name="uid"       expression="${uid}"/>
841      <param name="machine"   expression="${machine}"/>
842      <param name="mode"      expression="${makemode}"/>
843    </pfx-xslt>
844  </target>
845 
846  <target name="workers_prop" depends="ant-tasks" description="creates servletconf/tomcat/workers.prop from servletconf/projects.xml with core/build/create_workersprop.xsl">
847    <pfx-xslt
848     infile="${dir.projects}/common/conf/projects.xml"
849     outfile="${dir.projects}/servletconf/tomcat/workers.prop"
850     style="${dir.projects}/core/build/create_workersprop.xsl"
851     >
852      <param name="docroot"   expression="${dir.docroot}"/>
853      <param name="fqdn"      expression="${fqdn}"/>
854      <param name="uid"       expression="${uid}"/>
855      <param name="machine"   expression="${machine}"/>
856      <param name="mode"      expression="${makemode}"/>
857      <param name="java_home" expression="${javahome}"/>
858    </pfx-xslt>
859  </target>
860
861  <target name="server_xml-check">
862    <condition property="server_xml.outdated">
863      <and>
864        <available file="build.properties"/>
865        <available file="${dir.tomcat}/conf/server.xml"/>
866        <uptodate targetfile="build.properties" srcfile="${dir.tomcat}/conf/server.xml"/>
867      </and>
868    </condition>
869  </target>
870
871  <target name="server_xml-force" if="server_xml.outdated">
872    <delete file="${dir.tomcat}/conf/server.xml"/>
873  </target>
874
875  <target name="server_xml" depends="ant-tasks,server_xml-check,server_xml-force" description="creates servletconf/tomcat/conf/server.xml from servletconf/projects.xml with core/build/create_serverxml.xsl">
876    <pfx-server-config
877      basedir="${dir.projects}"
878      outfile="${dir.tomcat}/conf/server.xml"
879      includes="**/conf/project.xml"
880      commonconfig="${dir.projects}/common/conf/projects.xml"
881      docroot="${dir.docroot}"
882      stylesheet="${dir.projects}/core/build/create_serverxml.xsl"
883    >
884      <param name="standalone" expression="${standalone.tomcat}"/>
885      <param name="portbase"   expression="${portbase.tomcat}"/>
886      <param name="webappmode" expression="${webappmode}"/>
887      <param name="webapps"    expression="${webapps}"/>
888    </pfx-server-config>
889  </target>
890
891  <target name="tomcat.dir.opt">
892    <available file="${dir.tomcat}/bin/catalina.sh" type="file" property="dir.tomcat.exists" />
893    <antcall target="tomcat.dir.missing"/>
894  </target>
895  <target name="tomcat.dir.missing" unless="dir.tomcat.exists">
896    <antcall target="tomcat.dir"/>
897  </target>
898
899  <target name="tomcat.dir">
900    <antcall target="tomcat.extract"/>
901    <antcall target="tomcat.strip"/>
902    <antcall target="tomcat.user"/>
903    <antcall target="tomcat.cert"/>
904  </target>
905
906  <target name="tomcat.extract">
907    <path id="src.path">
908      <fileset dir="lib/tomcat" includes="apache-tomcat-*.tar.gz"/>
909    </path>
910    <pathconvert property="tomcat.bindist" refid="src.path" dirSep="/"/>
911    <echo>tomcat dist file: ${tomcat.bindist}</echo>
912    <available file="${tomcat.bindist}" type="file" property="tomcat.bindist.exists" />
913    <fail unless="tomcat.bindist.exists" message="tomcat dist file not found"/>
914
915    <delete dir="${dir.tomcat}"/>
916    <property name="dir" location="${dir.tomcat}/.."/>
917    <untar src="${tomcat.bindist}" dest="${dir}" compression="gzip"/>
918    <path id="dest.path">
919      <dirset dir="${dir}" includes="apache-tomcat-*"/>
920    </path>
921    <pathconvert property="tmp.tomcat" refid="dest.path" dirSep="/"/>
922    <echo>tmp directory: ${tmp.tomcat}</echo>
923    <available file="${tmp.tomcat}" type="dir" property="tmp.tomcat.exists" />
924    <fail unless="tmp.tomcat.exists" message="tmp.tomcat not found"/>
925    <move todir="${dir.tomcat}">
926      <fileset dir="${tmp.tomcat}" />
927    </move>
928   <!-- Create dummy log4j config to make start process faster -->
929   <available file="${dir.tomcat}/common/classes/log4j.properties" property="tomcat.log4jconfig.exists"/>
930   <antcall target="tomcat.log4jconfig"/>
931  </target>
932 
933 <target name="tomcat.log4jconfig" unless="tomcat.log4jconfig.exists">
934    <!-- Create dummy log4j config to make startup faster -->
935    <echo>Creating dummy log4j config</echo>
936    <echo file="${dir.tomcat}/common/classes/log4j.properties">log4j.rootLogger=OFF</echo>   
937 </target>   
938
939  <target name="tomcat.strip">
940    <delete dir="${dir.tomcat}/conf/Catalina"/>
941
942    <!-- remove predefined web-apps -->
943    <delete dir="${dir.tomcat}/webapps"/>
944    <mkdir dir="${dir.tomcat}/webapps"/>
945
946    <!-- we keep server/webapps, it contains tomcat manager -->
947
948    <delete>
949      <fileset dir="${dir.tomcat}/conf">
950        <include name="jk2.properties"/>
951        <include name="server-minimal.xml"/>
952        <include name="server.xml"/>
953      </fileset>
954    </delete>
955  </target>
956
957  <target name="tomcat.user">
958    <echo file="${dir.tomcat}/conf/tomcat-users.xml"><![CDATA[<?xml version='1.0' encoding='utf-8'?>
959<tomcat-users>
960  <role rolename="manager"/>
961  <user username="admin" password="pass" roles="manager, admin"/>
962</tomcat-users>]]></echo>
963  </target>
964
965  <target name="tomcat.cert">
966    <genkey alias="tomcat" storepass="secret" keyalg="RSA" keystore="${dir.tomcat}/conf/keystore">
967      <dname>
968        <param name="CN" value="ue.schlund.de"/>
969        <param name="OU" value="Unix Development"/>
970        <param name="O"  value="Schlund und Partner"/>
971        <param name="C"  value="DE"/>
972      </dname>
973    </genkey>
974  </target>
975
976
977  <target name="defaultwebxml-check">
978    <uptodate property="upd.defaultwebxml" targetfile="${dir.tomcat}/conf/web.xml">
979      <srcfiles dir="${dir.tomcat}/conf" includes="server.xml"/>
980      <srcfiles dir="${dir.projects}/core/build" includes="create_defaultwebxml.xsl"/>
981    </uptodate>
982  </target>
983
984  <target name="defaultwebxml" depends="defaultwebxml-check,ant-tasks" unless="upd.defaultwebxml">
985    <move file="${dir.tomcat}/conf/web.xml" tofile="${dir.tomcat}/conf/web.xml.tmp"/>
986    <pfx-xslt
987      style="${dir.projects}/core/build/create_defaultwebxml.xsl"
988      srcdir="${dir.tomcat}/conf"
989      destdir="${dir.tomcat}/conf"
990      includes="web.xml.tmp"
991      extension=""
992      validate="false"
993      catalogfile="${catalogfile}"
994    />
995  </target>
996
997  <target name="webservice" depends="ant-tasks-webservice" if="webservice.jaxws.available">
998    <pfx-webservice
999      tmpdir="${dir.projects}/.webservice"
1000      prjdir="${dir.projects}"
1001      builddir="${dir.build}"
1002      webappsdir="${dir.tomcat}/webapps"
1003      classpathref="cp.classpath"
1004      standalone="${standalone.tomcat}"
1005      portbase="${portbase.tomcat}"
1006      includes="**/conf/project.xml"
1007    />
1008  </target>
1009
1010  <target name="clean-webservice">
1011    <delete dir="${dir.projects}/.webservice"/>
1012    <delete includeEmptyDirs="true">
1013      <fileset dir="${dir.tomcat}/webapps" includes="*/WEB-INF/server-config.wsdd"/>
1014      <fileset dir="${dir.tomcat}/webapps" includes="*/wsdl/"/>
1015      <fileset dir="${dir.tomcat}/webapps" includes="*/wsscript/"/>
1016    </delete>
1017  </target>
1018
1019  <!-- all: depends on a readily built project -->
1020  <target name="webapp" depends="all, webapp.dir, webapp.tomcat.opt"/>
1021   
1022  <target name="webapp.init" depends="ant-tasks">
1023    <fail unless="webapp.name" message="please provide property webapp.name"/>
1024    <property name="engine.dir" location="${basedir}/dist/webapps"/>
1025    <property name="host.dir" location="${engine.dir}/${webapp.name}"/>
1026    <property name="webapp.dir" location="${host.dir}"/>
1027    <property name="webapp.pfixroot" location="${webapp.dir}/WEB-INF/pfixroot"/>
1028    <property name="webapp.tomcat.dir" location="${basedir}/dist/tomcat"/>
1029  </target>   
1030
1031  <target name="webapp.dir" depends="webapp.init, webservice, generate">
1032    <delete dir="${webapp.dir}"/>
1033    <mkdir dir="${webapp.dir}"/>
1034    <mkdir dir="${webapp.pfixroot}"/>
1035    <mkdir dir="${webapp.pfixroot}/servletconf"/>
1036    <mkdir dir="${webapp.pfixroot}/servletconf/log"/>
1037    <mkdir dir="${webapp.dir}/xml"/>
1038    <mkdir dir="${webapp.dir}/WEB-INF/classes"/>
1039    <mkdir dir="${webapp.dir}/WEB-INF/lib"/>
1040   
1041    <copy todir="${webapp.dir}/WEB-INF/lib" flatten="true">
1042        <fileset dir="${basedir}">
1043           <include name="${lib.includes}"/>
1044        </fileset>
1045    </copy>
1046   
1047    <copy todir="${webapp.dir}/WEB-INF/classes">
1048        <fileset dir="${dir.build}">
1049        </fileset>
1050    </copy>
1051   
1052    <copy todir="${webapp.dir}/xml">
1053        <fileset dir="${dir.tomcat}/webapps/${webapp.name}">
1054            <include name="**/*"/>
1055            <exclude name="WEB-INF/**/*"/>
1056            <exclude name="WEB-INF"/>
1057        </fileset>
1058    </copy>
1059    <copy todir="${webapp.dir}">
1060        <fileset dir="${dir.tomcat}/webapps/${webapp.name}">
1061            <include name="WEB-INF/server-config.wsdd"/>
1062        </fileset>
1063    </copy>
1064
1065    <copy todir="${webapp.pfixroot}">
1066        <fileset dir="${dir.projects}">
1067            <include name="core/**"/>
1068            <include name="common/**"/>
1069            <include name="${webapp.name}/**"/>
1070            <include name=".cache/${webapp.name}/**"/>
1071        </fileset>
1072    </copy>
1073   
1074    <pfx-passthroughcopy
1075      srcdir="${dir.projects}"
1076      destdir="${webapp.dir}"
1077      projectsxml="${webapp.pfixroot}/common/conf/projects.xml"
1078      projectxml="${webapp.pfixroot}/${webapp.name}/conf/project.xml"
1079      projectname="${webapp.name}"
1080    />
1081   
1082    <pfx-webxml
1083                basedir="${webapp.pfixroot}"
1084                webappsdir="${engine.dir}"
1085                includes="${webapp.name}/conf/project.xml"
1086                commonconfig="${webapp.pfixroot}/common/conf/projects.xml"
1087                stylesheet="${dir.projects}/core/build/create_webxml.xsl"
1088        />
1089   
1090    <!-- Create context.xml for Tomcat to disable use of session cookies -->
1091    <mkdir dir="${webapp.dir}/META-INF"/>
1092    <echo file="${webapp.dir}/META-INF/context.xml">
1093    <![CDATA[ <Context cookies="false"></Context> ]]>
1094    </echo>
1095   
1096    <war destfile="${engine.dir}/${webapp.name}.war" webxml="${webapp.dir}/WEB-INF/web.xml">
1097        <fileset dir="${webapp.dir}"/>
1098    </war>
1099  </target>
1100 
1101  <target name="webapp.tomcat.opt" depends="webapp.init" >
1102    <available file="${webapp.tomcat.dir}/bin/catalina.sh" type="file" property="webapp.tomcat.exists" />
1103    <antcall target="webapp.tomcat.missing"/>
1104  </target>
1105  <target name="webapp.tomcat.missing" unless="webapp.tomcat.exists">
1106    <antcall target="webapp.tomcat"/>
1107  </target>
1108
1109  <target name="webapp.tomcat" depends="webapp.init">
1110    <antcall target="tomcat.dir">
1111      <param name="dir.tomcat" value="${webapp.tomcat.dir}"/>
1112    </antcall>
1113    <antcall target="apache_conf">
1114      <param name="dir.tomcat" value="${webapp.tomcat.dir}"/>
1115    </antcall>
1116    <antcall target="jk_conf">
1117      <param name="dir.tomcat" value="${webapp.tomcat.dir}"/>
1118    </antcall>
1119   
1120    <pfx-server-config
1121      basedir="${webapp.pfixroot}"
1122      outfile="${webapp.tomcat.dir}/conf/server.xml"
1123      includes="${webapp.name}/conf/project.xml"
1124      commonconfig="${webapp.pfixroot}/common/conf/projects.xml"
1125      docroot="${webapp.pfixroot}"
1126      stylesheet="${dir.projects}/core/build/create_serverxml.xsl"
1127    >
1128      <param name="standalone" expression="${standalone.tomcat}"/>
1129      <param name="portbase"   expression="${portbase.tomcat}"/>
1130      <param name="warmode"    expression="true"/>
1131      <param name="webappbase" expression="${engine.dir}"/>
1132    </pfx-server-config>
1133   
1134    <apply executable="chmod" os="Linux, Mac OS X">
1135      <arg line="a+x"/>
1136      <fileset dir="${webapp.tomcat.dir}" includes="**/*.sh"/>
1137    </apply>
1138   
1139  </target>   
1140
1141
1142  <property name="dir.test.src" location="tests/junit"/>
1143  <property name="dir.test.classes" location="build/test-classes"/>
1144  <property name="dir.test.report" location="build/test-reports"/>
1145  <target name="test" depends="test.compile">
1146    <mkdir dir="${dir.test.report}"/>
1147    <junit dir="./" printSummary="yes" fork="true" haltonfailure="true">
1148      <sysproperty key="basedir" value="."/>
1149      <formatter type="xml"/>
1150      <formatter type="plain"/>
1151      <formatter type="brief" usefile="off"/>
1152      <classpath>
1153        <path refid="test.classpath"/>
1154        <pathelement path="${dir.test.classes}"/>
1155      </classpath>
1156      <batchtest todir="${dir.test.report}">
1157        <fileset dir="${dir.test.src}">
1158          <include name="**/*Test.java"/>
1159        </fileset>
1160      </batchtest>
1161    </junit>
1162  </target>
1163  <target name="test.compile" depends="compile">
1164    <mkdir dir="${dir.test.classes}"/>
1165    <javac
1166     srcdir="${dir.test.src}"
1167     destdir="${dir.test.classes}"
1168     debug="${debug}"
1169     debuglevel="${debuglevel}"
1170     classpathref="cp.classpath"
1171     source="${javac.source}"
1172     nowarn="${javac.nowarn}"
1173     encoding="${javac.encoding}"
1174     >
1175      <classpath>
1176        <path refid="test.classpath"/>
1177      </classpath>
1178    </javac>
1179    <available file="res" type="dir" property="has.resources" />
1180    <antcall target="resources"/>
1181  </target>
1182
1183   
1184   
1185  <description>
1186    Targets
1187    -------
1188    all [default]:  Builds all files required to run ./startTomcat.sh
1189    generate-src:   Generates .java from .iwrp files
1190    compile:        Compiles all java files.
1191    generate:       Generates all top level targets to
1192    ${dir.projects}/.cache
1193    run/debug:      Runs tomcat. Advantage over ./startTomcat.sh:
1194    Ensures all files are build before
1195    starting tomcat. Drawback: As tomcat is started
1196    as an external process, there is one more java vm
1197    in memory, that does nothing but waiting for tomcat
1198    to exit.
1199    checkfiles:     Searches .xml files for unused include parts and
1200    writes report to dir.projects/CHECKOUTPUT.xml
1201    noop:           Echos the name of the project
1202    clean:          Deletes files created by target all.
1203    echoproperties: Dumps all properties and exits.
1204
1205    Properties
1206    ----------
1207    -Dmakemode=
1208    value:       test|prod
1209    test: development mode, editing features enabled
1210    prod: production mode, editing features disabled
1211    Controls availablilty of editing features of the pustefix
1212    content management system:
1213    * the editor console, used for displaying information
1214    and setting the page to editable
1215    * automatic regeneration of pages changend on disc
1216    environment: MAKE_MODE
1217    default:     -
1218    mandatory:   yes
1219
1220    -Djavahome=
1221    value:       location of the root directory of the j2se installation
1222    used for generation of
1223    ${dir.projects}/servletconf/tomcat/workers.prop
1224    environment: PFX_JAVA_HOME, JAVA_HOME
1225    default:     -
1226    mandatory:   yes
1227
1228    -Dgen=
1229    value:       include pattern for searching depend.xml files
1230    for target generate. E.g. for generating only
1231    project1 and project2 use: ant
1232    -Dgen="project1/**/depend.xml, project2/**/depend.xml"
1233    For more info on pattern matching see
1234    http://ant.apache.org/manual/dirtasks.html#patterns
1235    environment: -
1236    default:     **/depend.xml
1237    mandatory:   no
1238
1239    -Dbuild.compiler=
1240    value:       jikes, modern, ...
1241    see http://ant.apache.org/manual/CoreTasks/javac.html
1242    environment: -
1243    default:     modern
1244    mandatory:   no
1245
1246    -Djavac.nowarn=
1247    value:       true, false
1248    Indicates whether the -nowarn switch should be passed to the compiler
1249    see http://ant.apache.org/manual/CoreTasks/javac.html
1250    environment: -
1251    default:     false
1252    mandatory:   no
1253
1254    -Dvalidate=
1255    value:       true, false, dynamic
1256    Indicates whether certain xslt transformations perform validation of input
1257    documents.
1258    If true, perform validation, fail if no schema could be found.
1259    If false, do not perform validation
1260    If dynamic, perform validation if there is a schema, do not fail otherwise.
1261    environment: -
1262    default:     dynamic
1263    mandatory:   no
1264
1265    -Ddebugopts=
1266    value:       see java -X
1267    environment: -
1268    default:     ${debugopts}
1269    mandatory:   no
1270
1271    Note about Properties
1272    ---------------------
1273    This build file defines several targets and properties. Targets
1274    are a collection of actions, that may depend on the execution of
1275    other targets and can be parametrized by setting properties.
1276    Ant properties are immutable, so for customization of the build
1277    process, knowledge about the order of definition is essential.
1278    Order of definition:
1279    1) Commandline. E.g. ant -Dproperty=value
1280    2) If file ${basedir}/build.properties exists it is read
1281    3) Environment variables are loaded as properties with prefix "env."
1282    4) Target "properties": Many targets using properties depend on task
1283    "properties". Within this target, properties whose values depend on
1284    the values of other properties are defined.
1285
1286  </description>
1287
1288</project>
Note: See TracBrowser for help on using the browser.