diff options
Diffstat (limited to 'watchmaker/build.xml')
-rw-r--r-- | watchmaker/build.xml | 298 |
1 files changed, 298 insertions, 0 deletions
diff --git a/watchmaker/build.xml b/watchmaker/build.xml new file mode 100644 index 0000000..6292b47 --- /dev/null +++ b/watchmaker/build.xml @@ -0,0 +1,298 @@ +<!--=========================================================================== + Copyright 2006-2010 Daniel W. Dyer + + Licensed 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="watchmaker" + xmlns:uncommons="antlib:org.uncommons.antlib" + default="dist" + basedir="."> + <description>Ant build file for the Watchmaker framework.</description> + + +<!-- ================================================================== + GLOBAL BUILD PROPERTIES +=================================================================== --> + + <!-- Project-global locations. --> + <property name="conf.dir" value="etc" /> + <property name="lib.dir" value="lib" /> + <property name="lib.compiletime" value="${lib.dir}/compiletime" /> + <property name="lib.runtime" value="${lib.dir}/runtime" /> + <property name="dist.dir" value="dist" /> + <property name="docs.dir" value="docs" /> + <property name="checkstyle-results.dir" value="${docs.dir}/checkstyle" /> + <property name="release.dir" value="release" /> + <!-- The "website" directory is a symlink to a copy of the Git repository + at http://github.com/dwdyer/watchmaker-website. --> + <property name="web.dir" value="website" /> + <property name="temp.dir" value="temp" /> + + <!-- Per-module locations. --> + <property name="src.dir" value="src" /> + <property name="java.dir" value="${src.dir}/java" /> + <property name="build.dir" value="build"/> + + + <!-- Classpath for compilation and tests. --> + <path id="tool.path"> + <fileset dir="${lib.dir}" includes="**/*.jar" /> + </path> + + <taskdef uri="antlib:org.uncommons.antlib" + resource="org/uncommons/antlib/antlib.xml" + classpathref="tool.path"/> + + + <property name="version" value="0.7.2"/> + <property name="artifact.identifier" value="watchmaker-framework-${version}"/> + + <!-- This is the minimum coverage percentage (for both lines and + branches) that will be tolerated. This is used to prevent + regressions in coverage. The threshold will be raised as + test coverage improves. --> + <property name="minimum.coverage" value="80" /> + + +<!-- ================================================================== + TARGETS FOR BUILDING THE SOFTWARE +=================================================================== --> + + <!-- Builds everything from scratch. --> + <target name="all" + depends="clean, dist, test, docs" + description="Builds everything, excluding docs, from scratch."/> + + + <!-- Deletes all directories and files created by the build process. --> + <target name="clean" + description="Remove all files created by the build process." > + <delete dir="${docs.dir}" /> + <delete dir="${dist.dir}" /> + <delete dir="${release.dir}" /> + <delete dir="${temp.dir}" /> + <uncommons:clean module="examples" /> + <uncommons:clean module="framework" /> + <uncommons:clean module="swing" /> + <uncommons:clean module="book" /> + </target> + + + <!-- Builds the core framework JAR. --> + <target name="framework" + description="Build the framework module."> + <uncommons:compile module="framework" /> + <uncommons:jar module="framework" jarfile="${artifact.identifier}.jar" /> + </target> + + + <!-- Builds the GUI module. --> + <target name="swing" + depends="framework" + description="Build the GUI module."> + <uncommons:compile module="swing" /> + <uncommons:jar module="swing" jarfile="watchmaker-swing-${version}.jar" /> + </target> + + + <!-- Builds the examples JAR, which depends on each of the other modules. --> + <target name="examples" + depends="framework, swing" + description="Build the examples."> + <uncommons:compile module="examples" /> + <uncommons:jar module="examples" + jarfile="watchmaker-examples-${version}.jar" + classpath="${artifact.identifier}.jar lib/uncommons-maths-1.2.2.jar lib/google-collect-1.0.jar watchmaker-swing-${version}.jar lib/jfreechart-1.0.13.jar lib/jcommon-1.0.16.jar" + mainclass="org.uncommons.watchmaker.examples.Launcher" /> + </target> + + + <!-- Copy all necessary files to distribution directory. --> + <target name="dist" + depends="framework, swing, examples" + description="Generate the project distribution." > + <uncommons:dist /> + <mkdir dir="${dist.dir}/src" /> + <copy todir="${dist.dir}/src" flatten="true"> + <fileset dir="." includes="**/${build.dir}/*-src.jar"/> + </copy> + </target> + + + <!-- Build source JAR files for inclusion in the release. --> + <target name="source" description="Build source JARs."> + <uncommons:source module="framework" jarfile="${artifact.identifier}-src.jar" /> + <uncommons:source module="swing" jarfile="watchmaker-swing-${version}-src.jar" /> + </target> + + + <!-- Create the release artifacts. --> + <target name="release" + depends="clean, source, dist, test, checkstyle, docs" + description="Creates the release archives."> + <uncommons:release name="${artifact.identifier}"> + <additionalcontents> + <tarfileset dir="examples/${java.dir}/main" + prefix="${artifact.identifier}/examples/src" + includes="**/*" /> + </additionalcontents> + </uncommons:release> + </target> + + + <target name="release-maven" + depends="clean, dist" + description="Deploys the software to the Java.net Maven repository."> + <uncommons:maven-deploy module="framework" + version="${version}" + username="${maven.user}" + password="${maven.password}"/> + <uncommons:maven-deploy module="swing" + version="${version}" + username="${maven.user}" + password="${maven.password}"/> + </target> + + + +<!-- ================================================================== + TARGETS FOR GENERATING TEST REPORTS & DOCUMENTATION + =================================================================== --> + + <!-- Runs unit tests for all modules. --> + <target name="test" + depends="dist" + description="Run the unit test suite."> + <!-- Don't run FEST tests in a headless environment (they will fail) --> + <condition property="tests.file" value="testng-headless.xml" else="testng.xml"> + <isset property="headless" /> + </condition> + <uncommons:test suites="${conf.dir}/${tests.file}" + headless="${headless}" + title="Watchmaker Framework Unit Test Report" + mincoverage="${minimum.coverage}" /> + </target> + + + <target name="checkstyle" + depends="dist" + description="Check that coding standard are adhered to."> + <taskdef resource="checkstyletask.properties" classpathref="tool.path"/> + <mkdir dir="${checkstyle-results.dir}" /> + + <!-- Compiled classes must be available on the classpath to work-around this + bug (http://jira.codehaus.org/browse/MPCHECKSTYLE-20). That is why this + target depends on the 'dist' target. --> + <path id="checkstyle.path"> + <fileset dir="${dist.dir}" includes="**/*.jar" /> + </path> + + <checkstyle config="${conf.dir}/checks.xml" + failonviolation="false" + classpathref="checkstyle.path"> + <fileset dir="." defaultexcludes="yes"> + <include name="**/${java.dir}/main/org/uncommons/**/*.java"/> + </fileset> + <formatter type="xml" tofile="${checkstyle-results.dir}/checkstyle_report.xml"/> + </checkstyle> + <xslt in="${checkstyle-results.dir}/checkstyle_report.xml" + out="${checkstyle-results.dir}/checkstyle_report.html" + style="${conf.dir}/checkstyle-noframes-sorted.xsl" /> + </target> + + + <!-- Generates API documentation for all modules. --> + <target name="docs" + description="Generates Javadoc API documentation for all modules."> + <uncommons:javadoc title="Watchmaker Framework for Evolutionary Computation API" + version="${version}" + excludes="examples/**/*,framework/${java.dir}/main/org/uncommons/util/**/*"> + <additionalconfig> + <group title="Watchmaker Evolution Framework" packages="org.uncommons.watchmaker.framework:org.uncommons.watchmaker.framework.*"/> + <group title="Watchmaker Swing Classes" packages="org.uncommons.swing:org.uncommons.swing.*:org.uncommons.watchmaker.swing:org.uncommons.watchmaker.swing.*"/> + <link href="http://maths.uncommons.org/api/"/> + </additionalconfig> + </uncommons:javadoc> + </target> + + + <target name="book" description="Generates the PDF user guide."> + <mkdir dir="book/${build.dir}" /> + <uncommons:docbook classpathref="tool.path" + source="book/${src.dir}/xml/book.xml" + format="pdf" + outputDir="book/${build.dir}" > + <parameter name="paper.type" value="A4" /> + <parameter name="highlight.source" value="1" /> + <parameter name="img.src.path" value="./book/src/resources/" /> + </uncommons:docbook> + </target> + + +<!-- ================================================================== + TARGETS FOR UPDATING THE PROJECT WEBSITE + =================================================================== --> + + <target name="website-docs" + description="Re-builds the website Javadocs." + depends="dist"> + <!-- Delete all existing HTML files and then regenerate the docs over the top. --> + <delete> + <fileset dir="${web.dir}"> + <include name="api/**/*.html" /> + <include name="manual/**/*" /> + </fileset> + </delete> + + <!-- Refresh the API documentation tree for the Watchmaker Framework website. --> + <uncommons:javadoc dir="${web.dir}/api" + title="Watchmaker Framework for Evolutionary Computation API" + version="${version}" + excludes="examples/**/*,framework/${java.dir}/main/org/uncommons/util/**/*"> + <additionalconfig> + <group title="Watchmaker Evolution Framework" packages="org.uncommons.watchmaker.framework:org.uncommons.watchmaker.framework.*"/> + <group title="Watchmaker Swing Classes" packages="org.uncommons.swing:org.uncommons.swing.*:org.uncommons.watchmaker.swing:org.uncommons.watchmaker.swing.*"/> + <link href="http://maths.uncommons.org/api/"/> + </additionalconfig> + </uncommons:javadoc> + + <copy todir="${web.dir}" file="./CHANGELOG.txt"> + <filterset> + <filter token="VERSION" value="${version}"/> + </filterset> + </copy> + + <!-- Copy latest jars into website examples directory. --> + <copy todir="${web.dir}/examples"> + <fileset dir="${dist.dir}" includes="*.jar" /> + </copy> + <copy todir="${web.dir}/examples/lib"> + <fileset dir="${dist.dir}/${lib.dir}" includes="*.jar" /> + </copy> + + <!-- Generate user manual from DocBook source. --> + <uncommons:docbook classpathref="tool.path" + source="book/${src.dir}/xml/website.xml" + format="html" + chunked="true" + outputDir="${web.dir}/manual" > + <parameter name="highlight.source" value="1" /> + <parameter name="img.src.path" value="./" /> + <parameter name="html.stylesheet" value="docbook.css" /> + </uncommons:docbook> + <copy todir="${web.dir}/manual"> + <fileset dir="book/${src.dir}/resources" includes="**/*"/> + </copy> + </target> + +</project> |