| <?xml version="1.0" encoding="UTF-8"?> |
| |
| <!-- |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You under the Apache License, Version 2.0 |
| * (the "License"); you may not use this file except in compliance with |
| * the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| --> |
| |
| <project name="build-basic" default="dist"> |
| |
| <property name="build-system.dir" location="."/> |
| |
| <!--XXX define tobago-home--> |
| <property file="${build-system.dir}/../../build.properties"/> |
| |
| <property name="maven.task.version" value="2.0"/> |
| <property name="maven.task" value="maven-artifact-ant-${maven.task.version}-dep.jar"/> |
| <property name="maven.task.jar" value="${build-system.dir}/${maven.task}"/> |
| <available file="${maven.task.jar}" property="maven.task.present"/> |
| |
| <property name="build" value="target"/> |
| <property name="build.classes.main" value="${build}/classes"/> |
| <property name="build.classes.test" value="${build}/test-classes"/> |
| <property name="build.config" value="${build}/config"/> |
| <property name="dist" value="${build}"/> |
| |
| <property name="java.source.encoding" value="UTF-8"/> |
| <property name="java.version.source" value="1.5"/> |
| <property name="java.version.target" value="1.5"/> |
| <property name="java.compilerargs" value=""/> |
| <property name="java.version.bootclasspath" value=""/> |
| <property name="java.version.extdirs" value=""/> |
| |
| <property name="src.main" value="src/main/java"/> |
| <property name="src.test" value="src/test/java"/> |
| <available file="${src.test}" property="src.test.present"/> |
| <property name="test.class.suffix" value="UnitTest"/> |
| <property name="report.junit" value="${build}/report/junit"/> |
| |
| <target name="download-task" unless="maven.task.present"> |
| <get |
| src="http://www.ibiblio.org/maven2/org/apache/maven/maven-artifact-ant/${maven.task.version}/${maven.task}" |
| dest="${maven.task.jar}"/> |
| </target> |
| |
| <target name="init-task" depends="download-task"> |
| <typedef resource="org/apache/maven/artifact/ant/antlib.xml"> |
| <classpath> |
| <pathelement location="${maven.task.jar}"/> |
| </classpath> |
| </typedef> |
| </target> |
| |
| <target name="init" depends="init-task"> |
| <pom file="pom.xml" id="pom"/> |
| <dependencies filesetId="pom.dependencies" pathId="project.classpath.jar" |
| verbose="false"> |
| <pom refid="pom"/> |
| </dependencies> |
| |
| <path id="project.classpath.test"> |
| <path refid="project.classpath.jar"/> |
| <pathelement path="${build.classes.main}/"/> |
| </path> |
| <path id="build.classpath.run"> |
| <path refid="project.classpath.test"/> |
| <pathelement path="${build.classes.test}/"/> |
| </path> |
| </target> |
| |
| <target name="init-apt" depends="init-task"> |
| <pom file="${build-system.dir}/dependencies.xml" id="dependencies"/> |
| <dependencies pathId="build.classpath.apt" verbose="false"> |
| <pom refid="dependencies"/> |
| </dependencies> |
| |
| <taskdef name="apt" |
| classname="org.apache.myfaces.tobago.apt.ant.Apt" |
| classpathref="build.classpath.apt"/> |
| <taskdef name="sniplet-extract" |
| classname="org.apache.myfaces.tobago.ant.sniplet.CodeSnipletExtractTask" |
| classpathref="build.classpath.apt"/> |
| </target> |
| |
| <presetdef name="javac-default"> |
| <javac deprecation="on" debug="on" |
| encoding="${java.source.encoding}" |
| target="${java.version.target}" source="${java.version.source}" |
| bootclasspath="${java.version.bootclasspath}" |
| extdirs="${java.version.extdirs}" |
| classpathref="project.classpath.jar"> |
| <compilerarg line="${java.compilerargs}"/> |
| </javac> |
| </presetdef> |
| |
| <target name="compile" depends="fetch-libs" |
| description="Compiles the sources of the artifact."> |
| <mkdir dir="${build.classes.main}"/> |
| <javac-default srcdir="${src.main}" destdir="${build.classes.main}"/> |
| </target> |
| |
| <target name="test" depends="compile" if="src.test.present" |
| description="Run the unit tests."> |
| <mkdir dir="${build.classes.test}"/> |
| <javac-default srcdir="${src.test}" |
| destdir="${build.classes.test}" |
| classpathref="project.classpath.test"/> |
| <mkdir dir="${report.junit}"/> |
| <junit printsummary="yes" haltonfailure="yes" haltonerror="yes" |
| dir="${basedir}" maxmemory="128m"> |
| <classpath refid="build.classpath.run"/> |
| <formatter type="xml"/> |
| <formatter type='brief' usefile='false'/> |
| <batchtest fork="yes" todir="${report.junit}"> |
| <fileset dir="${build.classes.test}"> |
| <include name="**/*${test.class.suffix}.class"/> |
| </fileset> |
| </batchtest> |
| </junit> |
| </target> |
| |
| <!-- not really necessary, but currently easier to include libs in IDE --> |
| <!-- XXX need flattenmapper for file sets to include POM dependencies directly --> |
| <target name="fetch-libs" depends="init"> |
| <mkdir dir="lib"/> |
| <copy todir="lib"> |
| <fileset refid="pom.dependencies"/> |
| <flattenmapper/> |
| </copy> |
| </target> |
| |
| <target name="dist" depends="compile" |
| description="Create a distribution of the artifact."> |
| <mkdir dir="${dist}"/> |
| <jar jarfile="${dist}/${pom.artifactId}.jar"> |
| <fileset dir="${build.classes.main}"> |
| <include name="**/*.class"/> |
| </fileset> |
| <fileset dir="${src.main}"> |
| <include name="**/*.properties"/> |
| <include name="**/*.xml"/> |
| <include name="**/*.txt"/> |
| <include name="**/*.dtd"/> |
| </fileset> |
| <manifest> |
| <attribute name="Implementation-Title" value="${pom.artifactId}"/> |
| <attribute name="Implementation-Version" value="${pom.version}"/> |
| </manifest> |
| </jar> |
| </target> |
| |
| <target name="install" depends="dist" |
| description="Install artifact into the local repository."> |
| <install file="${dist}/${pom.artifactId}.jar"> |
| <pom refid="pom"/> |
| </install> |
| </target> |
| |
| <target name="clean" description="Delete temporary files."> |
| <delete dir="${build}" quiet="true"/> |
| <mkdir dir="${build}"/> |
| <delete dir="lib" quiet="true"/> |
| <mkdir dir="lib"/> |
| </target> |
| |
| <target name="war" depends="compile" description="Generate WAR archive."> |
| <mkdir dir="${dist}"/> |
| <property name="module" value="${build}/module"/> |
| <mkdir dir="${module}"/> |
| <unjar dest="${module}"> |
| <!-- XXX need selector for scope attribute in POM --> |
| <fileset dir="lib" includes="tobago-theme-*.zip"/> |
| </unjar> |
| |
| <!-- build the war-file --> |
| <war warfile="${dist}/${pom.artifactId}.war" |
| webxml="src/main/webapp/WEB-INF/web.xml"> |
| <fileset dir="src/main/webapp"> |
| <include name="**"/> |
| <exclude name="WEB-INF/**"/> |
| </fileset> |
| <fileset dir="${module}"> |
| <include name="**/*"/> |
| <exclude name="META-INF"/> |
| </fileset> |
| <lib dir="${module}/WEB-INF/lib" includes="*.jar"/> |
| <lib dir="lib"> |
| <include name="*.jar"/> |
| <!-- XXX not used yet; use exclude via POM dependency scope --> |
| <exclude name="fop*"/> |
| <exclude name="avalon*"/> |
| <exclude name="batik*"/> |
| <!-- XXX use exclude via POM dependency scope --> |
| <exclude name="servletapi*"/> |
| <exclude name="jsp-api*"/> |
| <exclude name="ant*"/> |
| <exclude name="junit*"/> |
| <exclude name="tobago-apt*"/> |
| </lib> |
| <!-- application classes --> |
| <classes dir="${build.classes.main}"> |
| <include name="**/*.class"/> |
| </classes> |
| <classes dir="${src.main}"> |
| <include name="**/*.properties"/> |
| <include name="**/*.xml"/> |
| </classes> |
| <webinf dir="src/main/webapp/WEB-INF"> |
| <include name="**"/> |
| <exclude name="web.xml"/> |
| </webinf> |
| </war> |
| </target> |
| |
| </project> |