compile-and-jar-mixin.xml from SmartFrog at Krugle
Show compile-and-jar-mixin.xml syntax highlighted
<project name="compile-and-jar" default="">
<description>
These are a common set of targets to provide more actions between the states "ready-to-compile"
and "packaged". The output is a signed jar, unless "option.no.sign.jar" is set, in which
case the final signing step is skipped.
To use it, you must provide a target called compile-classpath that sets up the
compile.classpath path to the compile-time password.
</description>
<import file="macros-mixin.xml"/>
<import file="security-mixin.xml"/>
<!-- this is a stub target-->
<target name="compile-classpath" />
<target name="compile-set-debug-flags">
<condition property="build.debuglevel"
value="lines,source"
else="lines,vars,source">
<isset property="release.build"/>
</condition>
<echo level="verbose">debug level=${build.debuglevel}</echo>
</target>
<target name="ready-to-compile"
depends="state.ready-to-compile,compile-classpath,compile-set-debug-flags"/>
<target name="compile" depends="ready-to-compile"
xmlns:ext="http://antbook.org/d1/ext">
<fail>
The compile.classpath classpath is not set; this is needed for the
"compile" target.
<condition>
<not>
<isreference refid="compile.classpath" />
</not>
</condition>
</fail>
<ext:javac destdir="${build.classes.dir}"
srcdir="${src.dir}">
<classpath refid="compile.classpath"/>
</ext:javac>
<!-- pull in copied files -->
<ext:copy-useful-files
src="${src.dir}" dest="${build.classes.dir}" />
<ext:copy-useful-files
src="${src.dir}" dest="${build.classes.dir}"
pattern="${source.files.tocopy}"/>
</target>
<target
name="compiled"
depends="compile"
/>
<target name="manifest"
depends="ready-to-compile">
<property name="manifest.mf"
location="${build.dir}/manifest.mf"/>
<manifest file="${manifest.mf}">
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Sealed" value="true"/>
<attribute name="Built-On" value="${timestamp.isoformat}"/>
</manifest>
</target>
<target name="ready-to-package"
depends="manifest,compiled"
/>
<target name="jar"
depends="ready-to-package"
xmlns:ext="http://antbook.org/d1/ext">
<ext:jar destfile="${target.jar}"
duplicate="preserve"
manifest="${manifest.mf}">
<fileset dir="${build.classes.dir}"/>
</ext:jar>
</target>
<target name="ready-to-sign-jar" depends="jar,ready-to-sign-files" />
<!--sign a JAR. A property can turn this off if you want to skip signing something-->
<target name="sign-jar" depends="ready-to-sign-jar"
unless="option.no.sign.jar"
xmlns:ext="http://antbook.org/d1/ext">
<ext:sign jar="${target.jar}"/>
</target>
<target name="packaged" depends="sign-jar" />
<!-- here to expand any JAR we create -->
<target name="unjar" depends="packaged">
<unjar
src="${target.jar}"
dest="${unjar.dir}">
</unjar>
</target>
</project>
See more files for this project here