Parent Directory
|
Revision Log
Update checkstyle target, remove obsolete targets
<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.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.dc-filter.dir" location="${build.dir}/filterdocchk"/>
<property name="build.checkstyle.dir" location="${build.dir}/checkstyle"/>
<!-- Source locations -->
<property name="src.dir" location="${basedir}/src/main"/>
<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 -->
<patternset id="docs.exclusion">
<exclude name="java/util/Random.*"/>
<exclude name="sun/misc/Unsafe.*"/>
</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}"/>
<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="${build.args}"/>
</javac>
</target>
<target name="jar"
depends="init-jar, native-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-3.1.jar"/>
<mkdir dir="${build.checkstyle.dir}"/>
<checkstyle config="etc/checkstyle/sun_checks.xml"
failOnViolation="false">
<formatter type="xml" toFile="${build.checkstyle.dir}/checkstyle-report.xml"/>
<fileset dir="${build.filter.src.dir}" includes="**/*.java"/>
</checkstyle>
<style in="${build.checkstyle.dir}/checkstyle-report.xml"
out="${build.checkstyle.dir}/checkstyle-report.html"
style="${stylesheet.dir}/checkstyle-frames.xsl"/>
</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.dc-filter.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:"/>
<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.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="-help"/> -->
<!-- <arg value="-verbose"/> -->
<!-- <arg value="-link"/> <arg value="http://java.sun.com/j2se/1.4.1/docs/api"/> -->
<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="java.lang"/>
<arg value="java.util"/>
<arg value="java.util.concurrent"/>
<arg value="java.util.concurrent.atomic"/>
<arg value="java.util.concurrent.locks"/>
</java>
</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">
<property name="release.jar" value="dist/jsr166-${version}-dist.jar"/>
<jar basedir="${basedir}" destfile="${release.jar}">
<!-- <exclude name="build/**"/> -->
<exclude name="${release.jar}"/>
<exclude name="user.properties"/>
<exclude name="etc/notes/**"/>
<exclude name="src/emulation/**"/>
<exclude name="**/SyntaxTest.java"/>
<exclude name="**/SuperfluousAbstract.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">
<jar destfile="${product.jar}">
<fileset dir="${build.classes.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="docs.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>
</filterchain>
</copy>
</target>
<target name="filter-doccheck"
depends="filter-src">
<mkdir dir="${build.dc-filter.dir}"/>
<copy todir="${build.dc-filter.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.dc-filter.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}"/>
<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="${build.args}"/>
<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.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="unchecked.option" value="-Xlint:unchecked"/>
<condition property="warnunchecked.arg" value="${unchecked.option}">
<istrue value="${build.warnunchecked}"/>
</condition>
<property name="warnunchecked.arg" value=""/>
<condition property="prepare.src.dir" value="${build.dir}/prepare-src">
<istrue value="${build.nothreads}"/>
</condition>
<!-- Common options in javac invocations -->
<property name="build.args" value="${warnunchecked.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-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="${junit.jar}"/>
<pathelement location="${build.testcases.dir}"/>
</path>
<path id="test.bootclasspath">
<path refid="test.classpath"/>
</path>
<!-- Flatten test classpaths into platform-appropriate strings -->
<property name="test.classpath" refid="test.classpath"/>
<property name="test.bootclasspath" refid="test.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.bootclasspath}"/>
</java>
</target>
</project>
| Doug Lea | ViewVC Help |
| Powered by ViewVC 1.0.8 |