-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
45 lines (40 loc) · 1.87 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<project name="compgen-cmdline" default="jar">
<property name="version" value="0.4.5"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="src.dir" value="src/main"/>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="compile">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}/java" destdir="${build.dir}/classes" debug="true" debuglevel="lines,vars,source" target="1.7" source="1.7"/>
</target>
<target name="jar" depends="compile, git.revision">
<copy file="LICENSE" todir="${build.dir}/classes/"/>
<delete file="${build.dir}/classes/VERSION"/>
<echo file="${build.dir}/classes/VERSION" message="${ant.project.name}-${version}-${repository.version}"/>
<mkdir dir="${dist.dir}"/>
<jar destfile="${dist.dir}/${ant.project.name}-${version}.jar">
<fileset dir="${build.dir}/classes"/>
<fileset dir="${src.dir}/java" includes="**/*.java"/>
</jar>
</target>
<!-- See http://stackoverflow.com/questions/2974106/how-to-lookup-the-latest-git-commit-hash-from-an-ant-build-script -->
<available file=".git" type="dir" property="git.present"/>
<target name="git.revision" description="Store git revision in ${repository.version}" if="git.present">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false" errorproperty="">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg value="HEAD"/>
</exec>
<condition property="repository.version" value="${git.revision}" else="unknown">
<and>
<isset property="git.revision"/>
<length string="${git.revision}" trim="yes" length="0" when="greater"/>
</and>
</condition>
</target>
</project>