|
| 1 | +<project name="example-lib" default="jar" basedir="."> |
| 2 | + <!-- verify that all parameters were passed --> |
| 3 | + <fail unless="aya.classpath"/> |
| 4 | + |
| 5 | + <!-- re-define the parameters, so that they can be used with autocompletion --> |
| 6 | + <property name="aya.classpath" value="ALREADY_DEFINED"/> |
| 7 | + |
| 8 | + <property name="target.dir" location="${basedir}/target/"/> |
| 9 | + <property name="target.manifest.file" location="${target.dir}/manifest.mf"/> |
| 10 | + <property name="target.jar.file" location="${target.dir}/example.jar"/> |
| 11 | + |
| 12 | + <target name="check_modified"> |
| 13 | + <!-- if the source files were not modified after the jar file, set 'is_uptodate' --> |
| 14 | + <uptodate targetfile="${target.jar.file}" property="is_uptodate"> |
| 15 | + <srcfiles dir="${basedir}"> |
| 16 | + <include name="aya.instruction.named.NamedInstructionStore"/> |
| 17 | + <include name="build.xml"/> |
| 18 | + <include name="ExampleStore.java"/> |
| 19 | + </srcfiles> |
| 20 | + </uptodate> |
| 21 | + </target> |
| 22 | + |
| 23 | + <target name="jar" depends="check_modified" unless="is_uptodate"> |
| 24 | + <!-- reset the target directory --> |
| 25 | + <delete failonerror="false" dir="${target.dir}"/> |
| 26 | + <mkdir dir="${target.dir}"/> |
| 27 | + |
| 28 | + <!-- compile and jar the example library --> |
| 29 | + <javac destdir="${target.dir}" debug="true" target="11" source="11" |
| 30 | + srcdir="${basedir}" includeantruntime="false" includes="ExampleStore.java" classpathref="${aya.classpath}"> |
| 31 | + </javac> |
| 32 | + |
| 33 | + <manifest file="${target.manifest.file}"/> |
| 34 | + <copy file="aya.instruction.named.NamedInstructionStore" todir="${target.dir}/META-INF/services/"/> |
| 35 | + <jar jarfile="${target.jar.file}" manifest="${target.manifest.file}"> |
| 36 | + <fileset dir="${target.dir}"> |
| 37 | + <include name="**/*.class"/> |
| 38 | + <include name="META-INF/**"/> |
| 39 | + </fileset> |
| 40 | + </jar> |
| 41 | + </target> |
| 42 | + |
| 43 | +</project> |
0 commit comments