Parent Directory
|
Revision Log
Provide default for anthill-build target to avoid having to get value into clean automatic build.
<project name="jsr166" default="usage"> <description> ------------------------------------------------------------------------------ Build file for JSR-166 Usage: ant [target] User-specific settings are read from user.properties. See user.properties.sample for an explanation of some useful settings. ------------------------------------------------------------------------------ </description> <target name="usage" description="Advises user to run with -projecthelp"> <echo>Run "ant -projecthelp" for full usage information.</echo> </target> <!-- User-specific settings --> <property file="user.properties"/> <!-- Compilation options --> <property name="build.sourcelevel" value="1.5"/> <property name="build.docsourcelevel" value="1.4"/> <property name="build.debug" value="true"/> <property name="build.debuglevel" value="source,lines,vars"/> <property name="build.deprecation" value="false"/> <!-- Build locations --> <property name="build.dir" location="build"/> <property name="build.classes.dir" location="${build.dir}/classes"/> <property name="build.emulation.dir" location="${build.dir}/emulation"/> <property name="build.testcases.dir" location="${build.dir}/testcases"/> <property name="build.lib.dir" location="${build.dir}/lib"/> <property name="build.ant.dir" location="${build.dir}/ant"/> <property name="build.javadocs.dir" location="${build.dir}/javadocs"/> <property name="build.sinjdocs.dir" location="${build.dir}/sinjdocs"/> <property name="build.stripped.dir" location="${build.dir}/stripped"/> <property name="build.reports.dir" location="${build.dir}/reports"/> <property name="build.doccheck.dir" location="${build.dir}/doccheck"/> <property name="build.filter.src.dir" location="${build.dir}/filtersrc"/> <property name="build.filter.doccheck.dir" location="${build.dir}/filterdocchk"/> <!-- Source locations --> <property name="src.dir" location="${basedir}/src/main"/> <property name="emulation.src.dir" location="${basedir}/src/emulation"/> <property name="test.src.dir" location="${basedir}/src/test"/> <property name="ant.src.dir" location="${basedir}/etc/ant"/> <property name="stylesheet.dir" location="${basedir}/etc/xsl"/> <property name="lib.dir" location="${basedir}/lib"/> <property name="dist.dir" location="${basedir}/dist"/> <!-- Distribution locations --> <property name="dist.javadocs.dir" location="${dist.dir}/docs"/> <!-- Jar locations --> <property name="product.jar" location="${build.lib.dir}/jsr166.jar"/> <property name="junit.jar" location="${lib.dir}/junit.jar"/> <property name="rt.jar" location="${java.home}/lib/rt.jar"/> <property name="sinjdoc.jar" location="${lib.dir}/sinjdoc.jar"/> <!-- Files excluded from dist-docs and emulation jar --> <patternset id="unsafe.exclusion"> <exclude name="java/util/Random.*"/> <exclude name="sun/misc/Unsafe.*"/> </patternset> <!-- Files excludes from emulation jar --> <patternset id="atomic.exclusion"> <exclude name="java/util/concurrent/atomic/AtomicBoolean*"/> <exclude name="java/util/concurrent/atomic/AtomicInteger*"/> <exclude name="java/util/concurrent/atomic/AtomicLong*"/> <exclude name="java/util/concurrent/atomic/AtomicReference*"/> <exclude name="java/util/concurrent/locks/LockSupport*"/> <exclude name="java/util/concurrent/locks/ReentrantLock*"/> </patternset> <!-- Main targets --> <target name="compile" depends="init, configure-compiler, prepare-src" description="Compiles main sources to build folder"> <property name="prepare.src.dir" value="${src.dir}"/> <mkdir dir="${build.classes.dir}"/> <!-- <echo>javac ${gjc.args}</echo> <echo>bootclasspath=${compile.bootclasspath}</echo> --> <javac srcdir="${prepare.src.dir}" destdir="${build.classes.dir}" debug="${build.debug}" debuglevel="${build.debuglevel}" deprecation="${build.deprecation}" source="${build.sourcelevel}" fork="true"> <compilerarg line="${gjc.args}"/> <!-- <bootclasspath refid="compile.bootclasspath"/> --> </javac> </target> <target name="jar" depends="configure-emulation, init-jar, native-jar, emulation-jar" description="Builds library jar from compiled sources"/> <target name="test" depends="init, configure-tests, report-tests" description="Runs all tests (requires JUnit 3.8.1 in ${ant.home}/lib)" /> <target name="checkstyle" depends="filter-src" description="Reports on style errors in Java source (verbose, mostly chaff)"> <taskdef resource="checkstyletask.properties" classpath="${lib.dir}/checkstyle-all-2.4.jar"/> <checkstyle> <formatter type="plain"/> <!-- also available: type="xml" --> <fileset dir="${build.filter.src.dir}" includes="**/*.java"/> </checkstyle> </target> <target name="doccheck" depends="filter-doccheck" description="Reports on javadoc style errors"> <delete dir="${build.doccheck.dir}"/> <mkdir dir="${build.doccheck.dir}"/> <javadoc doclet="com.sun.tools.doclets.doccheck.DocCheck" docletpath="${lib.dir}/doccheck.jar" destdir="${build.doccheck.dir}"> <packageset dir="${build.filter.doccheck.dir}"/> </javadoc> <echo>DocCheck output is in ${build.doccheck.dir}</echo> </target> <target name="docs" depends="filter-src" description="Builds javadocs with custom tags to build folder"> <delete dir="${build.javadocs.dir}"/> <mkdir dir="${build.javadocs.dir}"/> <javadoc destdir="${build.javadocs.dir}" link="http://java.sun.com/j2se/1.4.1/docs/api" overview="${src.dir}/intro.html" source="${build.docsourcelevel}"> <tag name="revised" description="Last revised:"/> <tag name="spec" description="Specified by:"/> <tag name="editor" description="Last edited by:"/> <tag name="fixme" description="FIX ME:"/> <packageset dir="${build.filter.src.dir}"/> </javadoc> </target> <target name="sinjdocs" depends="configure-tests" description="Builds javadocs with custom tags to build folder"> <delete dir="${build.sinjdocs.dir}"/> <mkdir dir="${build.sinjdocs.dir}"/> <java classname="net.cscott.sinjdoc.Main" fork="true"> <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/> <classpath> <pathelement location="${sinjdoc.jar}"/> <pathelement location="${lib.dir}/jutil.jar"/> <pathelement location="${lib.dir}/cup.jar"/> <path refid="test.classpath"/> </classpath> <arg value="-d"/> <arg value="${build.sinjdocs.dir}"/> <arg value="-sourcepath"/> <arg value="${src.dir}"/> <arg value="-overview"/> <arg value="${src.dir}/intro.html"/> <arg value="-source"/> <arg value="${build.sourcelevel}"/> <!-- <arg value="-verbose"/> --> <!-- <arg value="-link"/> <arg value="http://java.sun.com/j2se/1.4.1/docs/api"/> --> <arg value="java.lang"/> <arg value="java.util"/> <arg value="java.util.concurrent"/> <arg value="java.util.concurrent.atomic"/> <arg value="java.util.concurrent.locks"/> <!-- <arg value="-help"/> --> </java> </target> <target name="strip" depends="init, configure-compiler" description="Strip generics from java source (not working yet)"> <mkdir dir="${build.stripped.dir}"/> <!-- # javac -s doesn't reliably generate compilable code. It generates # bridge methods (marked as "synthetic") that can have identical # signatures to existing methods except for the return value. --> <javac srcdir="${src.dir}" destdir="${build.stripped.dir}" debug="${build.debug}" debuglevel="${build.debuglevel}" deprecation="${build.deprecation}" source="${build.sourcelevel}" fork="true"> <compilerarg line="${gjc.args} -s"/> <!-- <bootclasspath refid="compile.bootclasspath"/> --> </javac> </target> <target name="dist" depends="init, dist-clean, dist-jar, dist-docs" description="Puts all distributable products in single hierarchy"/> <target name="release" depends="dist" description="Puts entire CVS tree, plus distribution productions, in a jar"> <!-- #keep build dir? - dl <delete dir="${build.dir}"/> --> <property name="release.jar" value="dist/jsr166-${version}-dist.jar"/> <jar basedir="${basedir}" destfile="${release.jar}"> <exclude name="${release.jar}"/> <exclude name="user.properties"/> <exclude name="etc/notes/**"/> <exclude name="lib/gjc/2.1/**"/> <exclude name="**/SyntaxTest.java"/> </jar> </target> <target name="clean" description="Removes all build products"> <delete dir="${build.dir}"/> <delete dir="${build.classes.dir}"/> <delete dir="${build.lib.dir}"/> </target> <target name="dist-clean" description="Removes all build and distribution products"> <delete dir="${dist.dir}"/> </target> <target name="dist-docs" depends="filter-src" description="Builds javadocs without custom tags to dist folder"> <delete dir="${dist.javadocs.dir}"/> <mkdir dir="${dist.javadocs.dir}"/> <javadoc destdir="${dist.javadocs.dir}" link="http://java.sun.com/j2se/1.4.1/docs/api" overview="${src.dir}/intro.html" source="${build.docsourcelevel}"> <packageset dir="${build.filter.src.dir}"/> </javadoc> </target> <!-- Internal targets --> <target name="init"> <!-- Version is kept in a separate file --> <loadfile property="version" srcFile="version.properties"/> <echo>Building JSR-166 version ${version}</echo> <echo>java.home is ${java.home}</echo> </target> <target name="init-jar"> <mkdir dir="${build.lib.dir}"/> </target> <target name="native-jar" depends="compile" unless="build.emulation.true"> <jar destfile="${product.jar}"> <fileset dir="${build.classes.dir}"/> </jar> </target> <target name="compile-emulation" depends="init, configure-compiler" if="build.emulation.true"> <mkdir dir="${build.emulation.dir}"/> <javac srcdir="${emulation.src.dir}" destdir="${build.emulation.dir}" debug="${build.debug}" debuglevel="${build.debuglevel}" deprecation="${build.deprecation}" source="${build.sourcelevel}" fork="true"> <compilerarg line="${gjc.args}"/> <!-- <bootclasspath refid="compile.bootclasspath"/> --> </javac> </target> <target name="emulation-jar" depends="compile-emulation" if="build.emulation.true"> <jar destfile="${product.jar}" duplicate="add"> <fileset dir="${build.classes.dir}"> <patternset refid="atomic.exclusion"/> <patternset refid="unsafe.exclusion"/> </fileset> <fileset dir="${build.emulation.dir}"/> </jar> </target> <target name="dist-jar" depends="clean, jar"> <copy file="${product.jar}" todir="${dist.dir}"/> </target> <target name="compile-ant-filter" depends="init"> <mkdir dir="${build.ant.dir}"/> <javac srcdir="${ant.src.dir}" destdir="${build.ant.dir}" source="1.4" /> </target> <target name="filter-src" depends="compile-ant-filter"> <mkdir dir="${build.filter.src.dir}"/> <copy todir="${build.filter.src.dir}"> <fileset dir="${src.dir}"> <include name="**/*.html"/> </fileset> </copy> <copy todir="${build.filter.src.dir}"> <fileset dir="${src.dir}"> <exclude name="**/*.html"/> <patternset refid="unsafe.exclusion"/> </fileset> <filterchain> <!-- # This filter gets rid of angle-bracketed type parameters # so that javadoc can run on the result. The following # heuristic seems to work: # # For all lines not starting with space(s)-asterisk-space(s), # replace <something> with a space, where there may be more # than one right angle bracket at the end, and "something" # must not contain parens or pipes. (This may need some # tweaking.) --> <filterreader classname="jsr166.ant.filters.ReplaceFilter" classpath="${build.ant.dir}"> <param name="notmatching" value="^\s+\*\s.*$"/> <param name="pattern" value="<[^|>()]+?>+"/> <param name="replacement" value=" "/> </filterreader> <!-- # This filter uncomments lines beginning with "//@" so that # javadoc can see imports that are needed to resolve links # but that shouldn't be in the compiled code. --> <filterreader classname="jsr166.ant.filters.ReplaceFilter" classpath="${build.ant.dir}"> <param name="matching" value="^//@.*$"/> <param name="pattern" value="^//@"/> <param name="replacement" value=""/> </filterreader> </filterchain> </copy> </target> <target name="filter-doccheck" depends="filter-src"> <mkdir dir="${build.filter.doccheck.dir}"/> <copy todir="${build.filter.doccheck.dir}"> <fileset dir="${build.filter.src.dir}"> <include name="**/*.html"/> </fileset> </copy> <property name="generic.declarations" value="/** Fake type parameter. */ public interface E {} /** Fake type parameter. */ public interface T {} /** Fake type parameter. */ public interface K {} /** Fake type parameter. */ public interface V {}" /> <copy todir="${build.filter.doccheck.dir}"> <fileset dir="${build.filter.src.dir}"> <exclude name="**/*.html"/> </fileset> <filterchain> <!-- # These two filters try to make the source look like # something that doccheck can process. The first removes # -source 1.4 assertions and the second adds in a bunch # of single letter public nested marker interfaces so that # the generic type parameters are recognized. --> <filterreader classname="jsr166.ant.filters.ReplaceFilter" classpath="${build.ant.dir}"> <param name="matching" value="^\s*assert[\s ].*$"/> <param name="pattern" value="assert"/> <param name="replacement" value="//assert"/> </filterreader> <filterreader classname="jsr166.ant.filters.ReplaceFilter" classpath="${build.ant.dir}"> <param name="matching" value="^([^*]*(class|interface|implements) .*|)\{.*$"/> <param name="pattern" value="$"/> <param name="replacement" value=" ${generic.declarations}"/> </filterreader> </filterchain> </copy> </target> <target name="compile-tests" depends="jar"> <mkdir dir="${build.testcases.dir}"/> <!-- <echo>javac ${gjc.args}</echo> <echo>bootclasspath=${test.compile.bootclasspath}</echo> <echo>classpath="${test.classpath}"</echo> --> <javac srcdir="${test.src.dir}" destdir="${build.testcases.dir}" debug="${build.debug}" debuglevel="${build.debuglevel}" deprecation="${build.deprecation}" source="${build.sourcelevel}" fork="true"> <compilerarg line="${gjc.args}"/> <!-- <bootclasspath refid="test.compile.bootclasspath"/> --> <classpath refid="test.classpath"/> <include name="java/**"/> <include name="jsr166/**"/> </javac> </target> <target name="run-tests" depends="compile-tests"> <!-- May be overridden by user.properties --> <property name="testcase" value="*"/> <mkdir dir="${build.reports.dir}"/> <junit printsummary="true" showoutput="true" errorProperty="junit.failed" failureProperty="junit.failed" dir="${build.reports.dir}" fork="true"> <jvmarg value="-Xbootclasspath:${test.run.bootclasspath}"/> <formatter type="xml"/> <batchtest todir="${build.reports.dir}"> <fileset dir="${test.src.dir}"> <include name="java/**/${testcase}Test.java"/> <include name="jsr166/**/${testcase}Test.java"/> </fileset> </batchtest> </junit> </target> <target name="report-tests" depends="run-tests"> <!-- Sets junit.report.format to frames if redirection is present, otherwise sets it to noframes. --> <available property="junit.report.format" value="frames" classname="org.apache.xalan.lib.Redirect" /> <property name="junit.report.format" value="noframes"/> <junitreport todir="${build.reports.dir}"> <fileset dir="${build.reports.dir}"> <include name="TEST-*.xml"/> </fileset> <report styledir="${stylesheet.dir}" format="${junit.report.format}" todir="${build.reports.dir}" /> </junitreport> <fail message="Test Cases Failed" if="junit.failed"/> </target> <target name="configure-compiler"> <property name="gjc.version" value="2.2"/> <condition property="novariance.arg" value="-novariance"> <and> <equals arg1="${gjc.version}" arg2="2.0"/> <or> <not><isset property="gjc.novariance"/></not> <istrue value="${gjc.novariance}"/> </or> </and> </condition> <property name="novariance.arg" value=""/> <property name="gjc.dir" value="${lib.dir}/gjc"/> <property name="javac.jar" location="${gjc.dir}/${gjc.version}/javac.jar"/> <property name="collect.jar" location="${gjc.dir}/${gjc.version}/collect${novariance.arg}.jar"/> <!-- <property name="unchecked.option" value="-warnunchecked"/> --> <property name="unchecked.option" value="-Xlint:unchecked"/> <condition property="warnunchecked.arg" value="${unchecked.option}"> <istrue value="${gjc.warnunchecked}"/> </condition> <property name="warnunchecked.arg" value=""/> <condition property="prepare.src.dir" value="${build.dir}/prepare-src"> <istrue value="${build.nothreads}"/> </condition> <!-- ! Bootclasspath munging for source compilation. --> <path id="pre.bootclasspath"> <!-- <pathelement location="${javac.jar}"/> --> </path> <path id="compile.bootclasspath"> <pathelement location="${build.classes.dir}"/> <!-- <pathelement location="${collect.jar}"/> --> <pathelement location="${rt.jar}"/> </path> <!-- Flatten paths into platform-appropriate strings --> <property name="pre.bootclasspath" refid="pre.bootclasspath"/> <property name="compile.bootclasspath" refid="compile.bootclasspath"/> <!-- Common options in javac invocations --> <!-- <property name="gjc.args" value="-J-Xbootclasspath/p:${pre.bootclasspath} ${warnunchecked.arg} ${novariance.arg}" /> --> <property name="gjc.args" value="${warnunchecked.arg} ${novariance.arg}"/> </target> <target name="prepare-src" depends="configure-compiler" if="prepare.src.dir"> <mkdir dir="${prepare.src.dir}"/> <copy todir="${prepare.src.dir}"> <fileset dir="${src.dir}"> <exclude name="java/lang/**"/> </fileset> </copy> </target> <target name="configure-emulation"> <condition property="build.emulation.true"> <or> <and> <os family="windows"/> <not> <isset property="build.emulation"/> </not> </and> <istrue value="${build.emulation}"/> </or> </condition> </target> <target name="configure-tests" depends="configure-compiler"> <!-- junit.framework.Protectable is in JUnit 3.8.1 but not in 3.7 --> <available property="junit.available" classname="junit.framework.Protectable"/> <fail message="Need JUnit 3.8.1 in ${ant.home}${file.separator}lib to run tests" unless="junit.available"/> <!-- Xalan --> <available property="xalan.available" classname="org.apache.xalan.Version"/> <fail message="Need Xalan 2.5.1 jar in ${ant.home}${file.separator}lib to run tests" unless="xalan.available"/> <!-- ! Bootclasspath munging for testing, so JUnit can test our local ! modifications to java.*. --> <path id="test.classpath"> <pathelement location="${product.jar}"/> <pathelement location="${rt.jar}"/> <pathelement location="${build.testcases.dir}"/> <pathelement location="${junit.jar}"/> </path> <path id="test.compile.bootclasspath"> <pathelement location="${javac.jar}"/> <pathelement location="${collect.jar}"/> <pathelement location="${rt.jar}"/> </path> <path id="test.run.bootclasspath"> <!-- <pathelement location="${javac.jar}"/> --> <path refid="test.classpath"/> </path> <!-- Flatten test classpaths into platform-appropriate strings --> <property name="test.classpath" refid="test.classpath"/> <property name="test.compile.bootclasspath" refid="test.compile.bootclasspath"/> <property name="test.run.bootclasspath" refid="test.run.bootclasspath"/> </target> <!-- Anthill targets --> <target name="anthill-build"> <!-- Override this in user.properties --> <property name="tiger.home" location="e:/j2sdk1.5.0"/> <exec resultproperty="result.property" dir="${basedir}" executable="${tiger.home}/bin/java"> <arg value="-Xmx256000000"/> <!-- classpath of new JVM --> <arg value="-classpath"/> <arg path="${java.class.path}"/> <!-- location of Ant home directory --> <arg value="-Dant.home=${ant.home}"/> <!-- the Ant main class --> <arg value="org.apache.tools.ant.Main"/> <!-- The build file --> <arg value="-buildfile"/> <arg value="build.xml"/> <!-- the target to build on the new Ant instance --> <arg value="-DJAVA_HOME=${tiger.home}"/> <arg value="do-anthill-build"/> </exec> </target> <target name="do-anthill-build" depends="jar, test, docs, dist-docs"/> <target name="anthill-publish"> <copy todir="${deployDir}/docs/private"> <fileset dir="${build.javadocs.dir}"/> </copy> <copy todir="${deployDir}/docs/public"> <fileset dir="${dist.javadocs.dir}"/> </copy> <copy tofile="${deployDir}/index.html" file="${basedir}/etc/anthill-index.html"/> <copy todir="${deployDir}/notes"> <fileset dir="${basedir}/etc/notes"/> </copy> </target> <target name="ng" depends="test"> <java classname="SuperfluousAbstract" fork="true"> <jvmarg value="-Xbootclasspath/p:${test.run.bootclasspath}"/> </java> </target> </project>
Doug Lea | ViewVC Help |
Powered by ViewVC 1.0.8 |