| <?xml version="1.0" encoding="ISO-8859-1"?> |
| |
| <!-- |
| 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. |
| --> |
| |
| <!-- Build file for Velocity --> |
| |
| <!-- This project has its basedir set to the root directory --> |
| <!-- of the velocity distribution. This is necessary so that --> |
| <!-- all the code that uses relative directory references --> |
| <!-- (like the tests) can be run in the same way when using --> |
| <!-- the ant based build and the maven based build. --> |
| <!-- *** DO NOT CHANGE THIS SETTING LIGHTLY! *** --> |
| |
| <project name="Velocity" default="world" basedir=".." xmlns:artifact="urn:maven-artifact-ant"> |
| |
| <path id="basedir-os"> |
| <pathelement location="${basedir}" /> |
| </path> |
| <!-- This is the relative base dir. This must be the root of the --> |
| <!-- Velocity distribution. All relative pathes are prefixed with --> |
| <!-- velocity.dir --> |
| <pathconvert property="velocity.dir" refid="basedir-os" targetos="unix"/> |
| |
| <!-- Give user a chance to override without editing this file |
| (and without typing -D each time it compiles it --> |
| <property file="${user.home}/.ant.properties" /> |
| <property file="${user.home}/build.properties" /> |
| <property file=".ant.properties" /> |
| |
| <!-- This file contains all the defaults for building Velocity --> |
| <property file="build/build.properties" /> |
| |
| <property name="parserjj.file" value="${build.parser}/Parser.jj" /> |
| <property name="parserjjt.file" value="${src.parser.dir}/Parser.jjt" /> |
| |
| <!-- =================================================================== --> |
| <!-- prints the targets available in this build file --> |
| <!-- =================================================================== --> |
| <target name="help"> |
| |
| <echo> |
| **************************************************************************** |
| ** |
| ** help is no longer supported. Please run 'ant -projecthelp' |
| ** |
| *************************************************************************** |
| </echo> |
| </target> |
| |
| <target name="world" depends="jar,test,javadocs,docs,env" |
| description="Build the Velocity Jar and Documentation"/> |
| |
| <!-- =================================================================== --> |
| <!-- prints the environment --> |
| <!-- =================================================================== --> |
| <target name="env" description="Prints build parameters"> |
| <echo> |
| Global settings: |
| java.home = ${java.home} |
| user.home = ${user.home} |
| java.class.path = ${java.class.path} |
| |
| Velocity settings: |
| Version: ${version} |
| Debug: ${debug} |
| Optimize: ${optimize} |
| Deprecation: ${deprecation} |
| |
| Target settings (relative to build tree root): |
| Velocity Source: ${build.src} |
| Velocity Classes: ${build.dest} |
| Velocity API Docs: ${build.javadoc} |
| Velocity Docs: ${build.docs} |
| Velocity Test Reports: ${build.test.reports} |
| </echo> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Prepares the build directory --> |
| <!-- =================================================================== --> |
| <target name="prepare" depends="basic-prepare,prepare-jdbc,prepare-jdk14"/> |
| |
| <!-- =================================================================== --> |
| <!-- sets up the build trees for sources and tests --> |
| <!-- =================================================================== --> |
| <target name="basic-prepare"> |
| <tstamp> |
| <format property="build.time" pattern="yyyy-MM-dd HH:mm:ss" /> |
| <format property="build.year" pattern="yyyy"/> |
| </tstamp> |
| <filter token="build.year" value="${build.year}"/> |
| <filter token="build.version" value="${version}"/> |
| <filter token="build.time" value="${build.time}"/> |
| |
| <mkdir dir="${build.dir}"/> |
| <mkdir dir="${build.dest}"/> |
| <mkdir dir="${build.src}"/> |
| <mkdir dir="${build.test.src}"/> |
| <mkdir dir="${build.test.dest}"/> |
| |
| <copy todir="${build.src}" filtering="yes"> |
| <fileset dir="${src.java.dir}"> |
| <include name="**/*.java"/> |
| <exclude name="**/DataSourceResourceLoader.java"/> |
| <exclude name="**/JdkLogChute.java"/> |
| </fileset> |
| </copy> |
| |
| <filter token="test.dir" value="${test.dir}"/> |
| <filter token="build.test" value="${build.test}"/> |
| |
| <copy todir="${build.test.src}" filtering="yes"> |
| <fileset dir="${test.java.dir}"> |
| <include name="**/*.java"/> |
| <exclude name="**/WrappedExceptionTestCase.java"/> |
| <exclude name="**/sql/*.java"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- sets up the build environment (classpath and libs) --> |
| <!-- =================================================================== --> |
| <target name="build-prepare"> |
| <ant antfile="${velocity.build.dir}/download.xml" target="build-download" /> |
| |
| <!-- Build classpath --> |
| <path id="velocity.build.classpath"> |
| <fileset dir="${build.lib}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| |
| <!-- Test classpath, contains dependencies needed only for Testing --> |
| <path id="velocity.test.classpath"> |
| <fileset dir="${build.test.lib}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </path> |
| |
| <path id="velocity.run.classpath"> |
| <path refid="velocity.build.classpath"/> |
| <pathelement location="${build.dir}/${final.name}.jar"/> |
| </path> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- checks for the existence/non-existence of various java features --> |
| <!-- --> |
| <!-- currently checks for --> |
| <!-- * javax.sql.Datasource (JDK1.4+, JDK1.3+JDBC2.0, J2EE 1.3+) --> |
| <!-- * java.util.logging.Logger (JDK 1.4+) --> |
| <!-- =================================================================== --> |
| |
| <target name="prepare-jdbc" depends="check-jdbc,check-jdbc-true,check-jdbc-false"/> |
| <target name="prepare-jdk14" depends="check-jdk14,check-jdk14-true,check-jdk14-false"/> |
| |
| <target name="check-jdbc" depends="build-prepare"> |
| <!-- note: check to see if required class is available. --> |
| <!-- might be j2ee.jar, jdbc2_0-stdext.jar, or simply JDK 1.4+ --> |
| <available classname="javax.sql.DataSource" |
| property="jdbc.present"> |
| <classpath refid="velocity.build.classpath"/> |
| </available> |
| </target> |
| |
| <target name="check-jdbc-true" if="jdbc.present"> |
| <copy todir="${build.src}" filtering="yes"> |
| <fileset dir="${src.java.dir}"> |
| <include name="**/DataSourceResourceLoader.java"/> |
| </fileset> |
| </copy> |
| <copy todir="${build.test.src}" filtering="yes"> |
| <fileset dir="${test.java.dir}"> |
| <include name="**/sql/*.java"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <target name="check-jdbc-false" unless="jdbc.present"> |
| <echo level="warning"> |
| ******************************************************** |
| ** |
| ** The javax.sql.Datasource class has not been found on |
| ** your classpath. This means that your newly built |
| ** Velocity jar will not contain the JDBC based resource |
| ** loaders. If this is a problem, please use a JDK for |
| ** building that contains the javax.sql.Datasource class. |
| ** |
| ******************************************************** |
| </echo> |
| </target> |
| |
| <target name="check-jdk14" depends="build-prepare"> |
| <available classname="java.util.logging.Logger" |
| property="jdk14.present"> |
| <classpath refid="velocity.build.classpath"/> |
| </available> |
| </target> |
| |
| <target name="check-jdk14-true" if="jdk14.present"> |
| <copy todir="${build.src}" filtering="yes"> |
| <fileset dir="${src.java.dir}"> |
| <include name="**/JdkLogChute.java"/> |
| </fileset> |
| </copy> |
| <copy todir="${build.test.src}" filtering="yes"> |
| <fileset dir="${test.java.dir}"> |
| <include name="**/WrappedExceptionTestCase.java"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <target name="check-jdk14-false" unless="jdk14.present"> |
| <echo level="warning"> |
| ******************************************************** |
| ** |
| ** The java.util.logging.Logger class has not been found on your |
| ** classpath. This means that your newly built Velocity jar will |
| ** not contain JDK 1.4 compatible logging code. If this is a |
| ** problem, please use a 1.4 or newer JDK for building. |
| ** |
| ******************************************************** |
| </echo> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Compiles the source tree and the tests --> |
| <!-- =================================================================== --> |
| <target name="compile" depends="compile-src,compile-test"/> |
| |
| <target name="compile-src" depends="prepare,build-prepare,check-jdbc,check-jdk14" |
| description="Compiles the Velocity source"> |
| <javac srcdir="${build.src}" |
| destdir="${build.dest}" |
| encoding="UTF-8" |
| debug="${debug}" |
| target="${javac.target}" |
| source="${javac.source}" |
| deprecation="${deprecation}" |
| optimize="${optimize}" |
| classpathref="velocity.build.classpath"/> |
| |
| <copy todir="${build.dest}" filtering="yes"> |
| <fileset dir="${src.java.dir}"> |
| <include name="**/*.properties"/> |
| </fileset> |
| </copy> |
| |
| </target> |
| |
| <target name="compile-test" depends="prepare,build-prepare,compile-src" |
| description="Compiles the Velocity test classes"> |
| <javac srcdir="${build.test.src}" |
| destdir="${build.test.dest}" |
| encoding="UTF-8" |
| debug="${debug}" |
| deprecation="${deprecation}" |
| optimize="${optimize}"> |
| |
| <!-- Don't use the run classpath, build using the exploded class tree --> |
| <classpath> |
| <path refid="velocity.build.classpath"/> |
| <path refid="velocity.test.classpath" /> |
| <pathelement location="${build.dest}"/> |
| </classpath> |
| </javac> |
| |
| <copy todir="${build.test.dest}" filtering="yes"> |
| <fileset dir="${test.java.dir}"> |
| <include name="**/*.properties"/> |
| </fileset> |
| </copy> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- rebuilds the JJTree/JavaCC based parser --> |
| <!-- =================================================================== --> |
| <target name="parser" depends="parser-check,jjtree,javacc,javacc-cleanup" |
| description="Rebuilds the JJTree/JavaCC based parser" /> |
| |
| <target name="parser-check"> |
| <condition property="javacc-home-unset"> |
| <equals arg1="${javacc.home}" arg2="*unset*" /> |
| </condition> |
| |
| <fail if="javacc-home-unset"> |
| Could not run javacc: |
| *********************************************************** |
| ** You have not configured your JavaCC installation |
| ** location in the javacc.home property. |
| *********************************************************** |
| </fail> |
| |
| <condition property="parser-task-runnable"> |
| <and> |
| <available file="${javacc.home}" type="dir"/> |
| |
| <!-- specify ant versions in the negative, to allow future upgrades--> |
| <not> |
| <or> |
| <contains string="${ant.version}" substring="1.2"/> |
| <contains string="${ant.version}" substring="1.3"/> |
| <contains string="${ant.version}" substring="1.4"/> |
| <contains string="${ant.version}" substring="1.5"/> |
| </or> |
| </not> |
| </and> |
| </condition> |
| |
| <fail unless="parser-task-runnable"> |
| Could not run javacc: |
| *********************************************************** |
| ** |
| ** JavaCC 3.2 or later must be installed at ${javacc.home}. |
| ** Ant must be at least version 1.6.x. |
| ** |
| *********************************************************** |
| </fail> |
| |
| <echo> |
| *********************************************************** |
| ** Creating Parser.jj and Parser.java in source tree. |
| ** |
| ** Note: ASTNode files generated by jjtree are |
| ** not generated with this task. To create new ASTNode files, |
| ** run jjtree manually then copy the relevant files into |
| ** the runtime/parser/node directory (deleting all other |
| ** generated files). |
| ** |
| *********************************************************** |
| </echo> |
| <!-- uncomment if generating the parser outside the source tree |
| <mkdir dir="${build.parser}"/> |
| <copy todir="${build.parser}" filtering="no"> |
| <fileset dir="${build.src}/org/apache/velocity/runtime/parser"> |
| <include name="**/*"/> |
| </fileset> |
| </copy> |
| --> |
| </target> |
| |
| <target name="jjtree" depends="parser-check"> |
| <delete file="${parserjj.file}" /> |
| <jjtree |
| target="${parserjjt.file}" |
| outputdirectory="${build.parser}" |
| javacchome="${javacc.home}" |
| buildnodefiles="false" /> |
| </target> |
| |
| <target name="javacc" depends="parser-check"> |
| <javacc target="${parserjj.file}" |
| outputdirectory="${build.parser}" |
| javacchome="${javacc.home}" /> |
| </target> |
| |
| <target name="javacc-cleanup" depends="parser-check"> |
| <delete> |
| <fileset dir="${src.java.dir}/org/apache/velocity/runtime/parser/"> |
| <include name="Node.java"/> |
| <include name="ParserVisitor.java"/> |
| </fileset> |
| </delete> |
| </target> |
| |
| <!-- ================================================================ --> |
| <!-- Gets the classes we need from the various support jars --> |
| <!-- ================================================================ --> |
| <target name="build-dependency-classes"> |
| <mkdir dir="${build.deps}"/> |
| <unzip src="${jar.commons-collections.dir}/${jar.commons-collections.name}-${jar.commons-collections.version}.jar" dest="${build.deps}"> |
| <!-- we only want a few files from commons collections --> |
| <patternset> |
| <include name="org/apache/commons/collections/BoundedMap.class" /> |
| <include name="org/apache/commons/collections/ExtendedProperties*.class" /> |
| <include name="org/apache/commons/collections/IterableMap.class" /> |
| <include name="org/apache/commons/collections/iterators/AbstractEmptyIterator.class" /> |
| <include name="org/apache/commons/collections/iterators/EmptyIterator.class" /> |
| <include name="org/apache/commons/collections/iterators/EmptyMapIterator.class" /> |
| <include name="org/apache/commons/collections/iterators/EmptyOrderedIterator.class" /> |
| <include name="org/apache/commons/collections/iterators/EmptyOrderedMapIterator.class" /> |
| <include name="org/apache/commons/collections/KeyValue.class" /> |
| <include name="org/apache/commons/collections/map/AbstractHashedMap*.class" /> |
| <include name="org/apache/commons/collections/map/AbstractLinkedMap*.class" /> |
| <include name="org/apache/commons/collections/map/LRUMap.class" /> |
| <include name="org/apache/commons/collections/MapIterator.class" /> |
| <include name="org/apache/commons/collections/OrderedMap.class" /> |
| <include name="org/apache/commons/collections/OrderedMapIterator.class" /> |
| <include name="org/apache/commons/collections/OrderedIterator.class" /> |
| <include name="org/apache/commons/collections/ResettableIterator.class" /> |
| </patternset> |
| </unzip> |
| |
| <unzip src="${jar.oro.dir}/${jar.oro.name}-${jar.oro.version}.jar" dest="${build.deps}"/> |
| <unzip src="${jar.commons-lang.dir}/${jar.commons-lang.name}-${jar.commons-lang.version}.jar" dest="${build.deps}"/> |
| <delete dir="${build.deps}/META-INF" quiet="true"/> |
| </target> |
| |
| <target name="clean-dependency-classes"> |
| <delete dir="${build.deps}" quiet="true"/> |
| <mkdir dir="${build.deps}"/> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Compiles the source directory and creates a .jar file --> |
| <!-- including the Oro and logkit dependencies for convenience --> |
| <!-- =================================================================== --> |
| <target name="jar-dep" depends="compile-src,build-dependency-classes" |
| description="Builds the Velocity Jar file including all dependencies"> |
| <property name="jarname" value="${project}-${version}-dep" /> |
| <antcall target="build-jar" /> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Compiles the source directory and creates a .jar file --> |
| <!-- =================================================================== --> |
| <target name="jar" depends="compile-src,clean-dependency-classes" |
| description="Builds the Velocity Jar file"> |
| <property name="jarname" value="${final.name}" /> |
| <antcall target="build-jar" /> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- build the jar file. Don't call this target directly, it relies on --> |
| <!-- the jar contents and ${jarname} being setup by jar or jar-dep --> |
| <!-- =================================================================== --> |
| <target name="build-jar"> |
| <jar jarfile="${build.dir}/${jarname}.jar"> |
| |
| <metainf dir="${velocity.dir}"> |
| <include name="LICENSE"/> |
| <include name="NOTICE"/> |
| </metainf> |
| |
| <fileset dir="${build.dest}"/> |
| <fileset dir="${build.deps}"/> |
| <manifest> |
| <attribute name="Created-By" value="Apache Ant"/> |
| <attribute name="Package" value="org.apache.velocity"/> |
| <attribute name="Build-Jdk" value="${java.version}"/> |
| <attribute name="Extension-Name" value="${project}"/> |
| <attribute name="Specification-Title" value="Velocity is a Java-based template engine" /> |
| <attribute name="Specification-Vendor" value="Apache Software Foundation"/> |
| <attribute name="Implementation-Title" value="org.apache.velocity"/> |
| <attribute name="Implementation-Vendor-Id" value="org.apache"/> |
| <attribute name="Implementation-Vendor" value="Apache Software Foundation"/> |
| <attribute name="Implementation-Version" value="${version}"/> |
| </manifest> |
| </jar> |
| <checksum file="${build.dir}/${jarname}.jar" algorithm="md5" property="checksum.jar.md5"/> |
| <checksum file="${build.dir}/${jarname}.jar" algorithm="sha1" property="checksum.jar.sha1"/> |
| <echo message="${checksum.jar.md5} *${jarname}.jar" file="${build.dir}/${jarname}.jar.md5" /> |
| <echo message="${checksum.jar.sha1} *${jarname}.jar" file="${build.dir}/${jarname}.jar.sha1" /> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- jars the source --> |
| <!-- ================================================================== --> |
| <target name="jar-src" |
| depends="prepare" |
| description="Builds the Velocity Source Jar File"> |
| <jar jarfile="${build.dir}/${final.name}-src.jar"> |
| <metainf dir="${velocity.dir}"> |
| <include name="LICENSE"/> |
| <include name="NOTICE"/> |
| </metainf> |
| |
| <fileset dir="${build.src}"/> |
| <manifest> |
| <attribute name="Created-By" value="Apache Ant"/> |
| <attribute name="Specification-Title" value="Velocity is a Java-based template engine" /> |
| <attribute name="Specification-Vendor" value="Apache Software Foundation"/> |
| <attribute name="Implementation-Title" value="org.apache.velocity"/> |
| <attribute name="Implementation-Vendor" value="Apache Software Foundation"/> |
| <attribute name="Implementation-Vendor-Id" value="org.apache"/> |
| <attribute name="Implementation-Version" value="${version}"/> |
| </manifest> |
| </jar> |
| <checksum file="${build.dir}/${final.name}-src.jar" algorithm="md5" property="checksum.jar-src.md5"/> |
| <checksum file="${build.dir}/${final.name}-src.jar" algorithm="sha1" property="checksum.jar-src.sha1"/> |
| <echo message="${checksum.jar-src.md5} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.md5" /> |
| <echo message="${checksum.jar-src.sha1} *${final.name}-src.jar" file="${build.dir}/${final.name}-src.jar.sha1" /> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Compiles the example code --> |
| <!-- =================================================================== --> |
| <target name="examples" depends="build-prepare,jar" |
| description="Compiles the Velocity Example code"> |
| |
| <echo> |
| ************************************************************** |
| ** Building the examples : |
| ** examples/app_example1 : application example |
| ** examples/app_example2 : application example |
| ** examples/context_example : example context implementations |
| ** examples/logger_example : how to make an external logger |
| ** examples/xmlapp_example : how to access XML data in a template |
| ** examples/event_example : how to use Velocity's event handlers |
| ************************************************************** |
| </echo> |
| |
| <javac srcdir="${example.dir}/app_example1 |
| :${example.dir}/app_example2 |
| :${example.dir}/context_example |
| :${example.dir}/logger_example |
| :${example.dir}/xmlapp_example |
| :${example.dir}/event_example" |
| encoding="UTF-8" |
| debug="${debug}" |
| deprecation="${deprecation}" |
| optimize="${optimize}" |
| classpathref="velocity.run.classpath"/> |
| </target> |
| |
| <target name="examples-clean" depends="examples-clean-anakia"> |
| <delete quiet="true"> |
| <fileset dir="${example.dir}" includes="**/*.class"> |
| <include name="**/*.log"/> |
| </fileset> |
| </delete> |
| </target> |
| |
| <target name="examples-clean-anakia"> |
| <delete dir="${example.dir}/anakia/docs" quiet="true"/> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Creates the API documentation --> |
| <!-- =================================================================== --> |
| <target name="javadocs" depends="prepare,build-prepare" |
| description="Creates the Javadoc API documentation"> |
| |
| <mkdir dir="${build.javadoc}"/> |
| |
| <javadoc sourcepath="${build.src}" |
| packagenames="org.apache.velocity.*" |
| destdir="${build.javadoc}" |
| author="true" |
| private="false" |
| version="true" |
| use="true" |
| windowtitle="${name} ${version} API" |
| doctitle="${name} ${version} API" |
| encoding="UTF-8" |
| docencoding="UTF-8" |
| bottom="Copyright © 2000-${build.year} <a href="http://www.apache.org/">Apache Software Foundation</a>. All Rights Reserved." |
| classpathref="velocity.build.classpath"> |
| |
| <link href="${javadocs.ref.jsdk}"/> |
| <link href="http://www.jdom.org/docs/apidocs"/> |
| <link href="http://logging.apache.org/log4j/docs/api"/> |
| <link href="http://excalibur.apache.org/apidocs"/> |
| <link href="http://tomcat.apache.org/tomcat-4.1-doc/servletapi"/> |
| <link href="http://jakarta.apache.org/oro/api"/> |
| <link href="http://jakarta.apache.org/commons/lang/api-release"/> |
| <link href="http://jakarta.apache.org/commons/collections/api-release"/> |
| </javadoc> |
| |
| <jar jarfile="${build.dir}/${final.name}-javadoc.jar"> |
| <fileset dir="${build.javadoc}"/> |
| <manifest> |
| <attribute name="Created-By" value="Apache Ant"/> |
| <attribute name="Specification-Title" value="Velocity is a Java-based template engine" /> |
| <attribute name="Specification-Vendor" value="Apache Software Foundation"/> |
| <attribute name="Implementation-Title" value="org.apache.velocity"/> |
| <attribute name="Implementation-Vendor" value="Apache Software Foundation"/> |
| <attribute name="Implementation-Vendor-Id" value="org.apache"/> |
| <attribute name="Implementation-Version" value="${version}"/> |
| </manifest> |
| </jar> |
| |
| <checksum file="${build.dir}/${final.name}-javadoc.jar" algorithm="md5" property="checksum.jar-javadoc.md5"/> |
| <checksum file="${build.dir}/${final.name}-javadoc.jar" algorithm="sha1" property="checksum.jar-javadoc.sha1"/> |
| <echo message="${checksum.jar-javadoc.md5} *${final.name}-javadoc.jar" file="${build.dir}/${final.name}-javadoc.jar.md5" /> |
| <echo message="${checksum.jar-javadoc.sha1} *${final.name}-javadoc.jar" file="${build.dir}/${final.name}-javadoc.jar.sha1" /> |
| </target> |
| |
| <target name="javadocs-clean"> |
| <delete dir="${build.javadoc}" quiet="true"/> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Prepares the Maven POM file for "release" target --> |
| <!-- =================================================================== --> |
| <target name="pom" description="Gets the POM ready to be distributed"> |
| <!-- Create a distribution ready POM --> |
| <copy file="pom.xml" tofile="${build.dir}/${final.name}.pom"/> |
| |
| <!-- Create checksums for the binary distribution files --> |
| <checksum file="${build.dir}/${final.name}.pom" algorithm="md5" fileext=".md5"/> |
| <checksum file="${build.dir}/${final.name}.pom" algorithm="sha1" fileext=".sha1"/> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Prepare Maven environment --> |
| <!-- =================================================================== --> |
| |
| <target name="maven-prepare"> |
| <ant antfile="${velocity.build.dir}/download.xml" target="build-download" /> |
| |
| <path id="maven-ant-tasks.classpath" path="${build.lib}/maven-ant-tasks-${jar.maven.ant.version}.jar"/> |
| <typedef resource="org/apache/maven/artifact/ant/antlib.xml" |
| uri="urn:maven-artifact-ant" |
| classpathref="maven-ant-tasks.classpath"/> |
| |
| <artifact:install-provider artifactId="wagon-ssh" version="${wagon-ssh.version}"/> |
| |
| <artifact:pom file="${maven.pom}" id="maven.project"/> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Install Maven artifacts --> |
| <!-- =================================================================== --> |
| <target name="maven-install" depends="maven-prepare,release" |
| description="Installs the Maven artifacts in local repository"> |
| |
| <artifact:install file="${build.dir}/${project}-${version}.jar" > |
| <pom refid="maven.project"/> |
| <attach file="${build.dir}/${project}-${version}-src.jar" type="jar" classifier="sources"/> |
| <attach file="${build.dir}/${project}-${version}-dep.jar" type="jar" classifier="dep"/> |
| <attach file="${build.dir}/${project}-${version}-javadoc.jar" type="jar" classifier="javadoc"/> |
| </artifact:install> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Deploy Maven artifacts - custom repository --> |
| <!-- =================================================================== --> |
| <target name="maven-deploy-custom-repository" if="maven.remote.repository" |
| description="Deploys the Maven artifacts in local repository"> |
| |
| <echo>Deploying to ${maven.remote.repository}</echo> |
| |
| <artifact:deploy file="${build.dir}/${project}-${version}.jar" > |
| <remoteRepository id="velocity.custom.repository" url="${maven.remote.repository}"/> |
| <pom refid="maven.project"/> |
| <attach file="${build.dir}/${project}-${version}-src.jar" type="jar" classifier="sources"/> |
| <attach file="${build.dir}/${project}-${version}-dep.jar" type="jar" classifier="dep"/> |
| <attach file="${build.dir}/${project}-${version}-javadoc.jar" type="jar" classifier="javadoc"/> |
| </artifact:deploy> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Deploy Maven artifacts - Apache Maven repository --> |
| <!-- =================================================================== --> |
| <target name="maven-deploy-apache-repository" unless="maven.remote.repository" |
| description="Deploys the Maven artifacts in apache repository"> |
| |
| <echo>Deploying to Apache Maven repository</echo> |
| |
| <artifact:deploy file="${build.dir}/${project}-${version}.jar" > |
| <pom refid="maven.project"/> |
| <attach file="${build.dir}/${project}-${version}-src.jar" type="jar" classifier="sources"/> |
| <attach file="${build.dir}/${project}-${version}-dep.jar" type="jar" classifier="dep"/> |
| <attach file="${build.dir}/${project}-${version}-javadoc.jar" type="jar" classifier="javadoc"/> |
| </artifact:deploy> |
| </target> |
| |
| <target name="maven-deploy" |
| depends="maven-prepare,release,maven-deploy-custom-repository,maven-deploy-apache-repository" |
| description="Deployes the Maven artifacts in local repository or apache repository"> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Package --> |
| <!-- =================================================================== --> |
| <target name="build-package-tree" depends="clean"> |
| |
| <!-- |
| Don't move these ant calls into depends! If you do so, either jar |
| or jar-dep or docs (via its depends on jar) will set the jarname |
| property and as it is immutable, you will no longer be able to |
| build both jars in one go. Using antcall executes these targets |
| as subtasks and this property setting will not propagate back |
| into the main ant build |
| |
| --> |
| <antcall target="jar" /> |
| <antcall target="jar-dep" /> |
| <antcall target="jar-src" /> |
| <antcall target="docs" /> |
| <antcall target="javadocs" /> |
| |
| <mkdir dir="${dist.dir}"/> |
| <mkdir dir="${dist.dir}/src/java"/> |
| |
| <!-- use original to get pre-filtered text --> |
| <copy todir="${dist.dir}/src/java/"> |
| <fileset dir="${src.java.dir}" /> |
| </copy> |
| |
| <!-- use original to get pre-filtered text --> |
| <copy todir="${dist.dir}/src/test/"> |
| <fileset dir="${test.java.dir}" /> |
| </copy> |
| |
| <!-- use original to get pre-filtered text --> |
| <copy todir="${dist.dir}/src/parser/"> |
| <fileset dir="${src.parser.dir}" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/lib"> |
| <fileset dir="${build.lib}" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/lib/test"> |
| <fileset dir="${build.test.lib}" /> |
| </copy> |
| |
| <copy todir="${dist.dir}/build"> |
| <fileset dir="${velocity.dir}/build"> |
| <include name="**"/> |
| <exclude name="velocity.log"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}/convert"> |
| <fileset dir="${velocity.dir}/convert"> |
| <include name="**"/> |
| </fileset> |
| </copy> |
| |
| <!-- Copy docs, exclude API docs --> |
| <copy todir="${dist.dir}/docs"> |
| <fileset dir="${build.docs}"> |
| <include name="**"/> |
| <exclude name="docs/api/**"/> |
| </fileset> |
| </copy> |
| |
| <!-- Add freshly built Java docs --> |
| <copy todir="${dist.dir}/docs/api"> |
| <fileset dir="${build.javadoc}"> |
| <include name="**"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}/examples"> |
| <fileset dir="${example.dir}"> |
| <include name="**"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}/src"> |
| <fileset dir="${velocity.dir}/src"> |
| <include name="**"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}/test"> |
| <fileset dir="${velocity.dir}/test"> |
| <include name="**"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}/xdocs"> |
| <fileset dir="${xdocs.dir}"> |
| <include name="**"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${dist.dir}"> |
| <fileset dir="${velocity.dir}"> |
| <include name="LICENSE" /> |
| <include name="NOTICE" /> |
| <include name="README.txt" /> |
| <include name="CONTRIBUTORS" /> |
| <include name="WHY_TWO_JARS.txt" /> |
| </fileset> |
| </copy> |
| |
| <copy |
| file="${build.dir}/${final.name}.jar" |
| tofile="${dist.dir}/${final.name}.jar" |
| /> |
| |
| <copy |
| file="${build.dir}/${project}-${version}-dep.jar" |
| tofile="${dist.dir}/${project}-${version}-dep.jar" |
| /> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Packages the distribution with ZIP --> |
| <!-- ================================================================== --> |
| <target name="package-zip" |
| depends="build-package-tree"> |
| |
| <!-- .zip built for Windows --> |
| <fixcrlf srcdir="${dist.dir}" eol="crlf" eof="asis" encoding="ISO-8859-1"> |
| <include name="**/*.html" /> |
| <include name="**/*.java" /> |
| <include name="**/*.properties" /> |
| <include name="**/*.txt" /> |
| <include name="**/*.wm" /> |
| <include name="**/*.xml" /> |
| </fixcrlf> |
| |
| <delete file="${build.dir}/${final.name}.zip" quiet="true"/> |
| <zip zipfile="${build.dir}/${final.name}.zip" basedir="${dist.root}" |
| includes="**/${final.name}/**"/> |
| |
| <checksum file="${build.dir}/${final.name}.zip" algorithm="md5" property="checksum.zip.md5"/> |
| <checksum file="${build.dir}/${final.name}.zip" algorithm="sha1" property="checksum.zip.sha1"/> |
| <echo message="${checksum.zip.md5} *${final.name}.zip" file="${build.dir}/${final.name}.zip.md5" /> |
| <echo message="${checksum.zip.sha1} *${final.name}.zip" file="${build.dir}/${final.name}.zip.sha1" /> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Packages the distribution with TAR-GZIP --> |
| <!-- ================================================================== --> |
| <target name="package-tgz" |
| depends="build-package-tree"> |
| |
| <!-- .tar.gz built for Unix --> |
| <fixcrlf srcdir="${dist.dir}" eol="lf" eof="remove" encoding="ISO-8859-1"> |
| <include name="**/*.html" /> |
| <include name="**/*.java" /> |
| <include name="**/*.properties" /> |
| <include name="**/*.txt" /> |
| <include name="**/*.wm" /> |
| <include name="**/*.xml" /> |
| </fixcrlf> |
| |
| <delete file="${build.dir}/${final.name}.tar.gz" quiet="true"/> |
| <tar tarfile="${build.dir}/${final.name}.tar.gz" basedir="${dist.root}" |
| includes="**/${final.name}/**" longfile="gnu" compression="gzip" /> |
| |
| <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="md5" property="checksum.tgz.md5"/> |
| <checksum file="${build.dir}/${final.name}.tar.gz" algorithm="sha1" property="checksum.tgz.sha1"/> |
| <echo message="${checksum.tgz.md5} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.md5" /> |
| <echo message="${checksum.tgz.sha1} *${final.name}.tar.gz" file="${build.dir}/${final.name}.tar.gz.sha1" /> |
| </target> |
| |
| <!-- ================================================================== --> |
| <!-- Internal targets for Release Manager to ensure that the right --> |
| <!-- JDK is used for building the release. --> |
| <!-- ================================================================== --> |
| <target name="release" |
| description="Build the packages as release manager, does additional checks over the package target" |
| depends="package-java-check, clean, package, pom" /> |
| |
| <!-- ================================================================== --> |
| <!-- Packages the distribution with ZIP and TAR-GZIP --> |
| <!-- ================================================================== --> |
| <target name="package" |
| depends="package-zip,package-tgz" |
| description="Generates the Velocity distribution files"> |
| </target> |
| |
| <target name="package-java-check"> |
| <condition property="correct-java-version"> |
| <equals arg1="${ant.java.version}" arg2="${dist.required.java.version}"/> |
| </condition> |
| |
| <fail unless="correct-java-version"> |
| Could not run create distribution package: |
| *********************************************************** |
| ** |
| ** In order to create a distribution package, you must be |
| ** using Java version ${dist.required.java.version} instead |
| ** of Java version ${java.version} |
| ** |
| *********************************************************** |
| </fail> |
| |
| <echo> |
| *********************************************************** |
| ** |
| ** Creating a distribution package. Compiling with |
| ** Java version ${java.version} |
| ** |
| *********************************************************** |
| </echo> |
| |
| </target> |
| |
| <!-- ======================================================================= --> |
| <!-- Cleans up the build directory. Leave Libs unharmed to avoid re-download --> |
| <!-- ======================================================================= --> |
| <target name="clean" depends="examples-clean" |
| description="Cleans all generated files except downloaded libs"> |
| <delete includeEmptyDirs="true" quiet="true"> |
| <fileset dir="${build.dir}" defaultexcludes="no"> |
| <exclude name="lib/**" /> |
| <exclude name="test-lib/**" /> |
| </fileset> |
| </delete> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Really cleans up the build directory --> |
| <!-- =================================================================== --> |
| <target name="real-clean" depends="examples-clean" |
| description="Cleans all generated files"> |
| <delete includeEmptyDirs="true" quiet="true" dir="${build.dir}" /> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Make HTML version of Velocity documentation --> |
| <!-- =================================================================== --> |
| |
| <target name="docs" depends="build-prepare,jar" |
| description="Generates the Velocity HTML documentation"> |
| |
| <taskdef name="anakia" |
| classname="org.apache.velocity.anakia.AnakiaTask" |
| classpathref="velocity.run.classpath"/> |
| |
| <echo> |
| ####################################################### |
| # |
| # Now using Anakia to transform the XML documentation |
| # to HTML. |
| # |
| # using project file: ${docs.project} |
| # |
| # Note: set property "docs.project" to "project.xml" |
| # for distribution and "project-website.xml" for |
| # website. |
| ####################################################### |
| </echo> |
| |
| <anakia basedir="${xdocs.dir}/docs" destdir="${build.docs}" |
| extension=".html" style="site.vsl" |
| projectFile="../stylesheets/${docs.project}" |
| includes="**/*.xml" |
| lastModifiedCheck="true" |
| templatePath="${xdocs.dir}/stylesheets"> |
| </anakia> |
| |
| <copy todir="${build.docs}/images" filtering="no"> |
| <fileset dir="${xdocs.dir}/images"> |
| <include name="**/*.gif"/> |
| <include name="**/*.jpeg"/> |
| <include name="**/*.jpg"/> |
| <include name="**/*.png"/> |
| </fileset> |
| </copy> |
| |
| <copy todir="${build.docs}" filtering="no"> |
| <fileset dir="${xdocs.dir}"> |
| <include name="**/*.css"/> |
| <include name="**/.htaccess"/> |
| </fileset> |
| </copy> |
| |
| </target> |
| |
| |
| <!-- =================================================================== --> |
| <!-- Cleans up the docs directory --> |
| <!-- =================================================================== --> |
| <target name="docs-clean"> |
| <delete dir="${build.docs}" quiet="true"/> |
| </target> |
| |
| |
| <!-- ========== Publish Targets ======================================== --> |
| |
| <target name="publish.check"> |
| <condition property="release.signed"> |
| <and> |
| <available file="${build.dir}/${final.name}.tar.gz.asc"/> |
| <available file="${build.dir}/${final.name}.zip.asc"/> |
| <available file="${build.dir}/${final.name}.jar.asc"/> |
| <available file="${build.dir}/${final.name}.pom.asc"/> |
| <available file="${build.dir}/${project}-${version}-dep.jar.asc"/> |
| <available file="${build.dir}/${final.name}-src.jar.asc"/> |
| <available file="${build.dir}/${final.name}-javadoc.jar.asc"/> |
| </and> |
| </condition> |
| </target> |
| |
| <target name="publish.sigs" unless="release.signed" |
| depends="publish.check"> |
| <echo> |
| !!NOT READY TO PUBLISH!! |
| You must first execute "release" target, then sign the distribution |
| files with your pgp key (creating the needed '.asc'signature files). |
| To override this (only when uploading development snapshots not meant |
| for public release), add the property "release.signed=true" to your |
| build.properties. |
| You may also need to add the Jsch jar to Ant's classpath to enable the |
| optional 'scp' task. |
| </echo> |
| </target> |
| |
| <target name="publish.user" unless="username"> |
| <input message="Type your username and hit enter:" addproperty="username"/> |
| </target> |
| |
| <target name="publish.pass" unless="password"> |
| <input message="Type your password and hit enter:" addproperty="password"/> |
| </target> |
| |
| <target name="publish.auth" if="release.signed" |
| depends="publish.user,publish.pass"> |
| <condition property="have.auth"> |
| <and> |
| <isset property="username"/> |
| <isset property="password"/> |
| </and> |
| </condition> |
| </target> |
| |
| <target name="prepare.publish" |
| depends="publish.sigs,publish.auth"> |
| <condition property="ready"> |
| <and> |
| <isset property="release.signed"/> |
| <isset property="have.auth"/> |
| </and> |
| </condition> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- Uploads the distribution files after checking that they're ready. --> |
| <!-- =================================================================== --> |
| <target name="publish" depends="prepare.publish" if="ready" |
| description="Uploads distribution files to the distribution server"> |
| <echo> |
| Uploading distribution files from |
| ${build.dir} |
| to |
| ${username}:${password}@${publish.server}:${publish.dir} |
| </echo> |
| <scp todir="${username}:${password}@${publish.server}:${publish.dir}" |
| verbose="true" failonerror="true" trust="yes"> |
| <fileset dir="${build.dir}"> |
| <include name="*.tar.gz"/> |
| <include name="*.zip"/> |
| <include name="*.jar"/> |
| <include name="*.md5"/> |
| <include name="*.sha1"/> |
| <include name="*.asc"/> |
| <include name="*.pom"/> |
| </fileset> |
| </scp> |
| <echo> |
| ***** RELEASE INSTRUCTIONS ***** |
| |
| * SSH to ${publish.server} and verify the checksums and signatures of the uploaded |
| files with a script like: |
| #!/bin/csh |
| foreach fn ( *.tar.gz *.zip *.jar *.pom ) |
| echo Verifying $fn... |
| echo GPG signature should be "Good" |
| gpg --verify $fn.asc |
| echo MD5s should be identical |
| cat $fn.md5 |
| md5 -q $fn |
| echo SHA1s should be identical |
| cat $fn.sha1 |
| sha1 -q $fn |
| echo |
| end |
| |
| * Announce the availability of the test build on the dev@velocity.apache.org list. |
| |
| * Allow a couple days for people to test the test build. |
| |
| * Call for a release vote on private@velocity.apache.org and dev@velocity.apache.org |
| |
| * Once the release vote has passed, these files should all be copied to |
| /www/www.apache.org/dist/velocity/engine/${version} |
| and the non-dep jar, source jar, javadoc jar, pom and respective md5, sha1 and asc files should be copied into |
| /www/people.apache.org/repo/m2-ibiblio-rsync-repository/org/apache/velocity/velocity/${version}/ |
| |
| * Remove older releases of the same grade as this one (alpha, beta, final) from |
| /www/www.apache.org/dist/velocity/engine |
| |
| * Tag the release in SVN with a command such as: |
| svn copy -m "Release Engine ${version}" https://svn.apache.org/repos/asf/velocity/engine/trunk \ |
| https://svn.apache.org/repos/asf/velocity/engine/tags/${version} |
| |
| * Publish the documentation for this release on the website |
| |
| * Update the download and news pages on the website |
| |
| * Send an announcement email to all Velocity lists and announce@apache.org |
| once most of the mirrors have been updated with the distribution files. |
| |
| * Review http://wiki.apache.org/velocity/ReleaseProcess for more details. |
| </echo> |
| </target> |
| |
| <!-- =================================================================== --> |
| <!-- JUnit Tests for Velocity --> |
| <!-- =================================================================== --> |
| <target name="test" depends="build-prepare,compile-test" |
| description="Run the Velocity testcases"> |
| |
| <mkdir dir="${build.test.reports}"/> |
| <junit dir="${velocity.dir}" |
| fork="true" |
| printSummary="yes" |
| haltonerror="${test.haltonerror}" |
| haltonfailure="${test.haltonfailure}" |
| showoutput="true" |
| > |
| |
| <!-- Don't use the run classpath, test using the exploded class tree --> |
| <classpath> |
| <path refid="velocity.build.classpath" /> |
| <path refid="velocity.test.classpath" /> |
| <pathelement path="${build.dest}"/> |
| <pathelement path="${build.test.dest}"/> |
| </classpath> |
| |
| <batchtest todir="${build.test.reports}"> |
| <fileset dir="${build.test.src}"> |
| <include name="**/*TestCase.java"></include> |
| |
| <exclude name="**/BaseTestCase.java"></exclude> |
| |
| <exclude name="**/TexenTestCase.java"></exclude> |
| <exclude name="**/TexenClasspathTestCase.java"></exclude> |
| <exclude name="**/AnakiaTestCase.java"></exclude> |
| <exclude name="**/MultiLoaderTestCase.java"></exclude> |
| <exclude name="**/ClasspathResourceTestCase.java"></exclude> |
| </fileset> |
| </batchtest> |
| <formatter type="plain"/> |
| </junit> |
| |
| <!-- Run the legacy tests for anakia, texen... --> |
| <ant antfile="${velocity.build.dir}/testcases.xml" |
| target="test-all"/> |
| </target> |
| |
| <target name="test-clean"> |
| <delete dir="${build.test.dest}" quiet="true"/> |
| <delete dir="${build.test}" quiet="true"/> |
| <delete dir="${build.test.reports}" quiet="true"/> |
| |
| <ant antfile="${velocity.build.dir}/testcases.xml" |
| target="test-clean"/> |
| </target> |
| |
| |
| <!-- =================================================================== --> |
| <!-- Analyze code with FindBugs --> |
| <!-- =================================================================== --> |
| <target name="findbugs" depends="jar"> |
| <echo>Working with FindBugs at: ${findbugs.home}</echo> |
| <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"> |
| <classpath> |
| <fileset dir="${findbugs.home}/lib"> |
| <include name="findbugs-ant.jar"/> |
| </fileset> |
| </classpath> |
| </taskdef> |
| <echo>Analyzing ${build.dir}/${final.name}.jar built from ${build.src}</echo> |
| <findbugs home="${findbugs.home}" |
| output="html" |
| jvmargs="-Xmx400m" |
| outputFile="${build.test.reports}\findbugs-report.html" |
| reportLevel="low" |
| effort="max" |
| excludeFilter="${velocity.build.dir}/findbugs-exclude.xml" |
| failOnError="true"> |
| <auxClasspath> |
| <fileset dir="${build.lib}"> |
| <include name="**/*.jar"/> |
| </fileset> |
| </auxClasspath> |
| <sourcePath path="${build.src}" /> |
| <class location="${build.dir}/${final.name}.jar" /> |
| </findbugs> |
| </target> |
| |
| |
| <!-- =================================================================== --> |
| <!-- Analyze code with PMD --> |
| <!-- =================================================================== --> |
| <target name="pmd" depends="compile"> |
| <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask"> |
| <classpath> |
| <fileset dir="${pmd.home}/lib"> |
| <include name="*.jar"/> |
| </fileset> |
| </classpath> |
| </taskdef> |
| <echo>Analyzing ${build.src}...</echo> |
| <pmd shortFilenames="true" |
| failonerror="true"> |
| <!-- To minimize noise keep rulesets that you are done checking here... |
| --> |
| <ruleset>unusedcode</ruleset> |
| <ruleset>imports</ruleset> |
| <!-- ... and rulesets you're not ready to check here. |
| <ruleset>braces</ruleset> |
| <ruleset>basic</ruleset> |
| <ruleset>strings</ruleset> |
| <ruleset>design</ruleset> |
| <ruleset>codesize</ruleset> |
| --> |
| <formatter type="html" |
| toFile="${build.test.reports}\pmd_report.html"/> |
| <fileset dir="${build.src}"> |
| <include name="**/*.java"/> |
| </fileset> |
| </pmd> |
| <echo>Generated report is at ${build.test.reports}\pmd_report.html</echo> |
| </target> |
| </project> |