|
| 1 | +<?xml version="1.0" encoding="utf-8" ?> |
| 2 | +<project name="main.project" basedir="." default="dist.run.everything"> |
| 3 | + |
| 4 | + <!-- Get properties. --> |
| 5 | + <property file="build.properties"/> |
| 6 | + |
| 7 | + <!-- Define fileset containing repo files that should be distributed |
| 8 | + together with the source code. --> |
| 9 | + <fileset id="fs.repodocs" dir="."> |
| 10 | + <include name="*.md"/> |
| 11 | + </fileset> |
| 12 | + |
| 13 | + <!-- Define fileset containing license files that should be distributed |
| 14 | + together with both the source code and the class files. --> |
| 15 | + <fileset id="fs.licenses" dir="."> |
| 16 | + <include name="LICENSE"/> |
| 17 | + </fileset> |
| 18 | + |
| 19 | + <!-- Define fileset containing the source code and resources (no tests). --> |
| 20 | + <fileset id="fs.src" dir="."> |
| 21 | + <include name="${src.dir}/**"/> |
| 22 | + </fileset> |
| 23 | + |
| 24 | + <!-- Define fileset containing the test source code and resources. --> |
| 25 | + <fileset id="fs.tests" dir="."> |
| 26 | + <include name="${tests.dir}/**"/> |
| 27 | + </fileset> |
| 28 | + |
| 29 | + <!-- Define fileset containing the build files with their properties. --> |
| 30 | + <fileset id="fs.buildfiles" dir="."> |
| 31 | + <include name="build.xml"/> |
| 32 | + <include name="build.properties"/> |
| 33 | + </fileset> |
| 34 | + |
| 35 | + <!-- Delete and recreate the build folder. --> |
| 36 | + <target name="build.init"> |
| 37 | + <delete dir="${build.dir}"/> |
| 38 | + <mkdir dir="${build.dir}"/> |
| 39 | + </target> |
| 40 | + |
| 41 | + <!-- Delete and recreate the docs folder. --> |
| 42 | + <target name="docs.init"> |
| 43 | + <delete dir="${docs.dir}"/> |
| 44 | + <mkdir dir="${docs.dir}"/> |
| 45 | + </target> |
| 46 | + |
| 47 | + <!-- Create the dist folder (for the current version). --> |
| 48 | + <target name="dist.init"> |
| 49 | + <mkdir dir="${dist.dir}"/> |
| 50 | + </target> |
| 51 | + |
| 52 | + <!-- Compile the source code into class files. Also add licenses. --> |
| 53 | + <target name="build.run" depends="build.init"> |
| 54 | + <javac srcdir="${src.dir}" destdir="${build.dir}" |
| 55 | + includeantruntime="false"/> |
| 56 | + <copy todir="${build.dir}"> |
| 57 | + <fileset refid="fs.licenses"/> |
| 58 | + </copy> |
| 59 | + </target> |
| 60 | + |
| 61 | + <!-- Generate Javadoc. --> |
| 62 | + <target name="docs.run" depends="docs.init"> |
| 63 | + <javadoc sourcepath="${src.dir}" destdir="${docs.dir}"/> |
| 64 | + </target> |
| 65 | + |
| 66 | + <!-- Build a JAR file containing only the class files. --> |
| 67 | + <target name="dist.run.classfiles" depends="dist.init, build.run"> |
| 68 | + <jar destfile="${dist.dir}/${jar.classes.name}" basedir="${build.dir}"/> |
| 69 | + </target> |
| 70 | + |
| 71 | + <!-- Build a JAR file containing only the source code and the build files. |
| 72 | + Also add repo docs and licenses. --> |
| 73 | + <target name="dist.run.sources" depends="dist.init"> |
| 74 | + <jar destfile="${dist.dir}/${jar.src.name}"> |
| 75 | + <fileset refid="fs.src"/> |
| 76 | + <fileset refid="fs.buildfiles"/> |
| 77 | + <fileset refid="fs.repodocs"/> |
| 78 | + <fileset refid="fs.licenses"/> |
| 79 | + </jar> |
| 80 | + </target> |
| 81 | + |
| 82 | + <!-- Build a JAR file containing only the tests (source code). --> |
| 83 | + <target name="dist.run.tests" depends="dist.init"> |
| 84 | + <jar destfile="${dist.dir}/${jar.tests.name}"> |
| 85 | + <fileset refid="fs.tests"/> |
| 86 | + <fileset refid="fs.repodocs"/> |
| 87 | + <fileset refid="fs.licenses"/> |
| 88 | + </jar> |
| 89 | + </target> |
| 90 | + |
| 91 | + <!-- Build a JAR file containing only the Javadoc files. --> |
| 92 | + <target name="dist.run.docs" depends="dist.init, docs.run"> |
| 93 | + <jar destfile="${dist.dir}/${jar.docs.name}" basedir="${docs.dir}"/> |
| 94 | + </target> |
| 95 | + |
| 96 | + <!-- Build all JAR files at the same time (class files, sources, tests and |
| 97 | + Javadoc). --> |
| 98 | + <target name="dist.run.everything" depends="dist.run.classfiles, |
| 99 | + dist.run.sources, dist.run.tests, dist.run.docs"/> |
| 100 | + |
| 101 | +</project> |
0 commit comments