| 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. |
|---|
| 4 | If any problems arise either regenerate ant.dtd by invoking ant dtd |
|---|
| 5 | or delete the DOCTYPE definition --> |
|---|
| 6 | |
|---|
| 7 | <project name="pfixcore" default="all" basedir="."> |
|---|
| 8 | <!-- override properties --> |
|---|
| 9 | <property name="dir.projects" location="projects"/> |
|---|
| 10 | |
|---|
| 11 | <import file="skel/build-skel.xml"/> |
|---|
| 12 | <import file="build-maven.xml"/> |
|---|
| 13 | |
|---|
| 14 | <property name="dist.version" value="0.13.4" description="the version to use for pfixcore-*.*"/> |
|---|
| 15 | <property name="dist.type" value="release" description="distribution type: supported values release, build"/> |
|---|
| 16 | |
|---|
| 17 | <!-- additional properties --> |
|---|
| 18 | <property name="name.svnrevision" value="SVN_REVISION"/> |
|---|
| 19 | <property name="dir.metainf" location="${dir.build}/META-INF"/> |
|---|
| 20 | <property name="dir.dist" location="dist"/> |
|---|
| 21 | <property name="dir.toconf" value="${dir.projects}/common/conf/"/> |
|---|
| 22 | <property name="name.testskel" value="testskel"/> |
|---|
| 23 | <property name="dir.testskel" location="${name.testskel}"/> |
|---|
| 24 | <property name="dir.examplepage" location="${dir.projects}/simplepage"/> |
|---|
| 25 | <property name="name.examplepage" value="simplepage"/> |
|---|
| 26 | <property name="dir.examplelink" location="${dir.projects}/simplelink"/> |
|---|
| 27 | <property name="name.examplelink" value="simplelink"/> |
|---|
| 28 | <property name="dir.exampleform" location="${dir.projects}/simpleform"/> |
|---|
| 29 | <property name="name.exampleform" value="simpleform"/> |
|---|
| 30 | |
|---|
| 31 | <!-- initialize distribution type dependent properties used for creation of distribution files --> |
|---|
| 32 | |
|---|
| 33 | <target name="dist-properties"> |
|---|
| 34 | <exec executable="sh" outputproperty="dist.revision" errorproperty="dist.revision.error"> |
|---|
| 35 | <arg line="-c 'svn info | grep ^Revision: | cut -d\ -f2'"/> |
|---|
| 36 | </exec> |
|---|
| 37 | <condition property="project.version" value="${dist.version}"> |
|---|
| 38 | <equals arg1="${dist.type}" arg2="release"/> |
|---|
| 39 | </condition> |
|---|
| 40 | <condition property="project.version" value="${dist.version}-norev"> |
|---|
| 41 | <and> |
|---|
| 42 | <equals arg1="${dist.type}" arg2="build"/> |
|---|
| 43 | <not><equals arg1="${dist.revision.error}" arg2=""/></not> |
|---|
| 44 | </and> |
|---|
| 45 | </condition> |
|---|
| 46 | <condition property="project.version" value="${dist.version}-r${dist.revision}"> |
|---|
| 47 | <equals arg1="${dist.type}" arg2="build"/> |
|---|
| 48 | </condition> |
|---|
| 49 | <property name="name.pfixcore_jar" value="${project.name}-${project.version}.jar"/> |
|---|
| 50 | <property name="file.pfixcore_jar" location="${dir.dist}/${name.pfixcore_jar}"/> |
|---|
| 51 | <property name="name.pfixcore_srcjar" value="${project.name}-src-${project.version}.jar"/> |
|---|
| 52 | <property name="file.pfixcore_srcjar" location="${dir.dist}/${name.pfixcore_srcjar}"/> |
|---|
| 53 | <property name="name.pfixcore_data_tgz" value="${project.name}-data-${project.version}.tar.gz"/> |
|---|
| 54 | <property name="file.pfixcore_data_tgz" location="${dir.dist}/${name.pfixcore_data_tgz}"/> |
|---|
| 55 | <property name="name.pfixcore_skel_tgz" value="${project.name}-skel-${project.version}.tar.gz"/> |
|---|
| 56 | <property name="file.pfixcore_skel_tgz" location="${dir.dist}/${name.pfixcore_skel_tgz}"/> |
|---|
| 57 | <property name="name.pfixcore_examples_tgz" value="${project.name}-examples-${project.version}.tar.gz"/> |
|---|
| 58 | <property name="file.pfixcore_examples_tgz" location="${dir.dist}/${name.pfixcore_examples_tgz}"/> |
|---|
| 59 | </target> |
|---|
| 60 | |
|---|
| 61 | <!-- override targets --> |
|---|
| 62 | |
|---|
| 63 | <!-- TODO: always compiles before invoking skel.ant-tasks? --> |
|---|
| 64 | <target name="ant-tasks" depends="ant-tasks-compile, skel.ant-tasks"/> |
|---|
| 65 | <target name="ant-tasks-stage1" depends="ant-tasks-compile-stage1, skel.ant-tasks-stage1"/> |
|---|
| 66 | <target name="ant-tasks-stage2" depends="ant-tasks-compile-stage2, skel.ant-tasks-stage2"/> |
|---|
| 67 | |
|---|
| 68 | <target name="init" depends="skel.init"> |
|---|
| 69 | <mkdir dir="${dir.dist}"/> |
|---|
| 70 | </target> |
|---|
| 71 | |
|---|
| 72 | <target name="ant-tasks-compile" depends="ant-tasks-compile-stage2"> |
|---|
| 73 | </target> |
|---|
| 74 | |
|---|
| 75 | <target name="ant-tasks-compile-stage1" depends="tomcat.dir.opt, init" description="compiles java files needed by ant-tasks"> |
|---|
| 76 | <javac |
|---|
| 77 | srcdir="${dir.src}" |
|---|
| 78 | destdir="${dir.build}" |
|---|
| 79 | includes="de/schlund/pfixcore/util/XsltGenericTask.java, de/schlund/pfixxml/config/BuildTimePropTask.java, org/pustefixframework/config/build/CreatePropertyFileTask.java, de/schlund/pfixcore/util/GenerateSCodes.java de/schlund/pfixcore/util/GenerateSCodesTask.java, org/pustefixframework/config/build/CreateWebXmlTask.java, org/pustefixframework/config/build/CreateServerConfigurationTask.java, org/pustefixframework/config/build/InitResourceUtilTask.java" |
|---|
| 80 | debug="${debug}" |
|---|
| 81 | classpathref="cp.classpath" |
|---|
| 82 | sourcepath="${dir.src}" |
|---|
| 83 | encoding="${javac.encoding}" |
|---|
| 84 | > |
|---|
| 85 | </javac> |
|---|
| 86 | </target> |
|---|
| 87 | |
|---|
| 88 | <target name="ant-tasks-compile-stage2" depends="scgenerate, ant-tasks-compile-stage1" description="compiles java files needed by ant-tasks"> |
|---|
| 89 | <javac |
|---|
| 90 | srcdir="${dir.src}" |
|---|
| 91 | destdir="${dir.build}" |
|---|
| 92 | includes="de/schlund/pfixcore/util/Xslt*.java, de/schlund/pfixcore/util/*Task.java, de/schlund/pfixxml/util/StringUtil.java, de/schlund/pfixcore/generator/iwrpgen/AptTask.java" |
|---|
| 93 | debug="${debug}" |
|---|
| 94 | classpathref="cp.classpath" |
|---|
| 95 | sourcepath="${dir.src}" |
|---|
| 96 | encoding="${javac.encoding}" |
|---|
| 97 | > |
|---|
| 98 | </javac> |
|---|
| 99 | </target> |
|---|
| 100 | |
|---|
| 101 | <target name="scgenerate" depends="scgenerate-dist, buildtime-props"> |
|---|
| 102 | <antcall target="skel.scgenerate"/> |
|---|
| 103 | </target> |
|---|
| 104 | |
|---|
| 105 | <target name="scgenerate-dist" depends="ant-tasks-stage1" if="dist.build"> |
|---|
| 106 | <pfx-sclibgen |
|---|
| 107 | gendir="${dir.gensrc}" |
|---|
| 108 | docroot="${dir.projects}" |
|---|
| 109 | includes="core/dyntxt/statuscodeinfo.xml" |
|---|
| 110 | module="pfixcore" |
|---|
| 111 | /> |
|---|
| 112 | </target> |
|---|
| 113 | |
|---|
| 114 | <target name="pre-compile" depends="init" description="compiles AnnotationProcessors used by apt"> |
|---|
| 115 | <javac |
|---|
| 116 | srcdir="${dir.src}" |
|---|
| 117 | destdir="${dir.build}" |
|---|
| 118 | includes="de/schlund/pfixcore/util/CommonAnnotationProcessorFactory.java, de/schlund/pfixcore/generator/iwrpgen/IWrapperAnnotationProcessor.java, de/schlund/pfixcore/generator/iwrpgen/IWrapperAnnotationProcessorFactory.java" |
|---|
| 119 | classpathref="cp.classpath" |
|---|
| 120 | sourcepath="${dir.src}" |
|---|
| 121 | encoding="${javac.encoding}"/> |
|---|
| 122 | </target> |
|---|
| 123 | |
|---|
| 124 | <target name="clean-project" depends="skel.clean-project"> |
|---|
| 125 | <delete dir="${dir.dist}"/> |
|---|
| 126 | <!-- Delete empty htdocs and img dirs in the dist examples --> |
|---|
| 127 | <delete includeemptydirs="true"> |
|---|
| 128 | <fileset dir="${dir.examplepage}" includes="htdocs/**"/> |
|---|
| 129 | <fileset dir="${dir.examplepage}" includes="img/**"/> |
|---|
| 130 | <fileset dir="${dir.examplelink}" includes="htdocs/**"/> |
|---|
| 131 | <fileset dir="${dir.examplelink}" includes="img/**"/> |
|---|
| 132 | <fileset dir="${dir.exampleform}" includes="htdocs/**"/> |
|---|
| 133 | <fileset dir="${dir.exampleform}" includes="img/**"/> |
|---|
| 134 | </delete> |
|---|
| 135 | </target> |
|---|
| 136 | |
|---|
| 137 | <target name="realclean-core"><!-- override target - we don't delete the core directory here --> |
|---|
| 138 | <delete dir="${dir.tomcat}"/> |
|---|
| 139 | <delete dir="${dir.testskel}"/> |
|---|
| 140 | </target> |
|---|
| 141 | |
|---|
| 142 | <target name="init-data"> |
|---|
| 143 | <!-- override skel.init-data: do nothing --> |
|---|
| 144 | </target> |
|---|
| 145 | |
|---|
| 146 | <target name="dist" depends="clean, init, dist-examples" description="Builds release files in dist directory."> |
|---|
| 147 | <property name="dist.build" value="true"/> |
|---|
| 148 | <delete file="${dir.metainf}/${name.svnrevision}"/> |
|---|
| 149 | <exec executable="svn" outputproperty="dist.autotagmessage"> |
|---|
| 150 | <arg line="info"/> |
|---|
| 151 | </exec> |
|---|
| 152 | <!-- looks funny, but if someone called something like |
|---|
| 153 | "ant jar dist" the jar file would have a wrong SVN_REVISION file --> |
|---|
| 154 | <antcall target="skeleton" inheritall="true"> |
|---|
| 155 | <param name="autotagmessage" value="${dist.autotagmessage}"/> |
|---|
| 156 | </antcall> |
|---|
| 157 | </target> |
|---|
| 158 | |
|---|
| 159 | <!-- Building the basic examples for dist --> |
|---|
| 160 | <target name="dist-examples" depends="clean, init, dist-properties" description="Builds three basic examples as a pustefix turorial"> |
|---|
| 161 | <echo message="Building ${name.pfixcore_examples_tgz} in dist directory"/> |
|---|
| 162 | |
|---|
| 163 | <!-- creating the empty htdocs and img directories --> |
|---|
| 164 | <mkdir dir="${dir.examplepage}/htdocs"/> |
|---|
| 165 | <mkdir dir="${dir.examplepage}/img"/> |
|---|
| 166 | <mkdir dir="${dir.examplelink}/htdocs"/> |
|---|
| 167 | <mkdir dir="${dir.examplelink}/img"/> |
|---|
| 168 | <mkdir dir="${dir.exampleform}/htdocs"/> |
|---|
| 169 | <mkdir dir="${dir.exampleform}/img"/> |
|---|
| 170 | |
|---|
| 171 | <!-- Deleting the old tar and also the configuration files --> |
|---|
| 172 | <delete file="${file.pfixcore_examples_tgz}"/> |
|---|
| 173 | |
|---|
| 174 | <!-- Building the example tar with the main java and iwrp files --> |
|---|
| 175 | <tar destfile="${file.pfixcore_examples_tgz}" compression="gzip"> |
|---|
| 176 | <tarfileset dir="${dir.examplepage}" includes="**" prefix="${name.examplepage}"/> |
|---|
| 177 | <tarfileset dir="${dir.projects}" includes="README_EXAMPLES.txt"/> |
|---|
| 178 | <tarfileset dir="${dir.examplelink}" includes="**" prefix="${name.examplelink}"/> |
|---|
| 179 | <tarfileset dir="${dir.exampleform}" includes="**" prefix="${name.exampleform}"/> |
|---|
| 180 | <tarfileset dir="${dir.src}" includes="de/skelexamples/DemoText.iwrp" prefix="src"/> |
|---|
| 181 | <tarfileset dir="${dir.src}" includes="de/skelexamples/ContextDemoText.java" prefix="src"/> |
|---|
| 182 | <tarfileset dir="${dir.src}" includes="de/skelexamples/ContextDemoTextImpl.java" prefix="src"/> |
|---|
| 183 | <tarfileset dir="${dir.src}" includes="de/skelexamples/DemoTextHandler.java" prefix="src"/> |
|---|
| 184 | </tar> |
|---|
| 185 | </target> |
|---|
| 186 | |
|---|
| 187 | |
|---|
| 188 | <!-- a target to create a new project --> |
|---|
| 189 | <target name="new-basicapp" depends="compile" description="Builds a naked application and creates the basic stuff"> |
|---|
| 190 | <java classname="de.schlund.pfixcore.util.basicapp.InitNewPfixProject"> |
|---|
| 191 | <classpath refid="cp.classpath"/> |
|---|
| 192 | </java> |
|---|
| 193 | </target> |
|---|
| 194 | |
|---|
| 195 | <target name="fixtabs"> |
|---|
| 196 | <fixcrlf srcdir="${basedir}" includes="build.xml, skel/build.xml" tab="remove" tablength="4"/> |
|---|
| 197 | </target> |
|---|
| 198 | |
|---|
| 199 | <target name="skeleton" depends="tomcat.dir, ant-tasks, fixtabs, compile, jar, srcjar, data"> |
|---|
| 200 | <echo message="Building ${name.pfixcore_skel_tgz} in dist directory"/> |
|---|
| 201 | <tar destfile="${file.pfixcore_skel_tgz}" compression="gzip"> |
|---|
| 202 | <tarfileset dir="${dir.skel}" prefix="skel"/> |
|---|
| 203 | <tarfileset dir="${dir.metainf}" includes="${name.svnrevision}" prefix="skel"/> |
|---|
| 204 | <tarfileset dir="${dir.lib}" includes="*.jar, tomcat/README" excludes="saxon8*.jar" prefix="skel/lib"/> |
|---|
| 205 | <tarfileset dir="${dir.dist}" includes="${name.pfixcore_jar}" prefix="skel/lib"/> |
|---|
| 206 | <tarfileset dir="${dir.dist}" includes="${name.pfixcore_data_tgz}" prefix="skel/lib"/> |
|---|
| 207 | <tarfileset dir="${basedir}" includes="ant.dtd" prefix="skel"/> |
|---|
| 208 | <tarfileset dir="${basedir}" includes="INSTALL" prefix="skel"/> |
|---|
| 209 | <tarfileset dir="${dir.toconf}" includes="newproject.prop.in newprjlog.xml.in" prefix="skel/projects/common/conf"/> |
|---|
| 210 | </tar> |
|---|
| 211 | </target> |
|---|
| 212 | |
|---|
| 213 | <target name="data" depends="init, dist-properties, autotag"> |
|---|
| 214 | <echo message="Building ${name.pfixcore_data_tgz} in dist directory" /> |
|---|
| 215 | <copy file="${dir.metainf}/${name.svnrevision}" tofile="${dir.projects}/core/${name.svnrevision}"/> |
|---|
| 216 | <tar destfile="${file.pfixcore_data_tgz}" compression="gzip"> |
|---|
| 217 | <tarfileset dir="${dir.projects}/core" prefix="core"> |
|---|
| 218 | <exclude name="dyntxt/statuscodeinfo.xml"/> |
|---|
| 219 | </tarfileset> |
|---|
| 220 | <tarfileset file="${basedir}/skel/build-skel.xml" prefix="core/build"/> |
|---|
| 221 | </tar> |
|---|
| 222 | <delete file="${dir.projects}/core/${name.svnrevision}"/> |
|---|
| 223 | </target> |
|---|
| 224 | |
|---|
| 225 | <target name="jar" depends="dist-properties, autotag"> |
|---|
| 226 | <mkdir dir="${dir.dist}" description="creates ${name.pfixcore_jar}"/> |
|---|
| 227 | <jar destfile="${file.pfixcore_jar}"> |
|---|
| 228 | <fileset dir="${dir.build}"> |
|---|
| 229 | <exclude name="de/schlund/util/statuscodes/StatusCodeLib.class"/> |
|---|
| 230 | <exclude name="de/schlund/pfixcore/example/**"/> |
|---|
| 231 | <exclude name="de/skelexamples/**"/> |
|---|
| 232 | <exclude name="de/schlund/pfixcore/testsuite/**/*.class"/> |
|---|
| 233 | </fileset> |
|---|
| 234 | </jar> |
|---|
| 235 | </target> |
|---|
| 236 | |
|---|
| 237 | <target name="srcjar" depends="dist-properties"> |
|---|
| 238 | <mkdir dir="${dir.dist}"/> |
|---|
| 239 | <jar destfile="${file.pfixcore_srcjar}"> |
|---|
| 240 | <fileset dir="${dir.src}"> |
|---|
| 241 | <exclude name="de/schlund/pfixcore/example/**"/> |
|---|
| 242 | <exclude name="de/skelexamples/**"/> |
|---|
| 243 | </fileset> |
|---|
| 244 | <fileset dir="${dir.gensrc}"> |
|---|
| 245 | <exclude name="de/schlund/util/statuscodes/StatusCodeLib.java"/> |
|---|
| 246 | <exclude name="de/schlund/pfixcore/example/**"/> |
|---|
| 247 | <exclude name="de/skelexamples/**"/> |
|---|
| 248 | </fileset> |
|---|
| 249 | </jar> |
|---|
| 250 | </target> |
|---|
| 251 | |
|---|
| 252 | <target name="autotag" depends="init"> |
|---|
| 253 | <!-- make echo insert a newline into the file with 
 --> |
|---|
| 254 | <echo file="${dir.metainf}/${name.svnrevision}" message="${autotagmessage}
"/> |
|---|
| 255 | </target> |
|---|
| 256 | |
|---|
| 257 | <target name="test-skeleton" depends="dist-properties" description="extracts skel.jar, copies sample files, runs ant"> |
|---|
| 258 | <delete dir="${dir.testskel}"/> |
|---|
| 259 | <mkdir dir="${dir.testskel}"/> |
|---|
| 260 | <untar src="${file.pfixcore_skel_tgz}" dest="${dir.testskel}" compression="gzip"/> |
|---|
| 261 | <copy todir="${dir.testskel}/skel/src"> |
|---|
| 262 | <fileset dir="${dir.src}" includes="de/schlund/pfixcore/example/**"/> |
|---|
| 263 | </copy> |
|---|
| 264 | <!-- Copying over sample application for testing purposes --> |
|---|
| 265 | <copy todir="${dir.testskel}/skel/projects"> |
|---|
| 266 | <fileset dir="${dir.projects}" includes="sample1/**"/> |
|---|
| 267 | </copy> |
|---|
| 268 | <!-- DocumentRoot for sample application, apache fails to start without --> |
|---|
| 269 | <mkdir dir="${dir.testskel}/skel/projects/htdocs"/> |
|---|
| 270 | <!-- jakarta-tomcat-x.x.xx.tar.gz is not included in skeleton anymore --> |
|---|
| 271 | <copy todir="${dir.testskel}/skel/lib/tomcat"> |
|---|
| 272 | <fileset dir="${dir.lib}/tomcat"> |
|---|
| 273 | <include name="*.tar.gz"/> |
|---|
| 274 | </fileset> |
|---|
| 275 | </copy> |
|---|
| 276 | <exec dir="${dir.testskel}/skel" executable="ant" failonerror="true"> |
|---|
| 277 | </exec> |
|---|
| 278 | </target> |
|---|
| 279 | |
|---|
| 280 | </project> |
|---|
| 281 | |
|---|