root/tags/release-1.0.2/pustefix-tutorial/build-skel.xml

Revision 3914, 50.2 KB (checked in by tfehrenbach, 4 years ago)

new pfixcore 0.13.1

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