-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
71 lines (63 loc) · 3.3 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<project name="txtutils" default="jar">
<property name="version" value="0.1"/>
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="src.dir" value="src"/>
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<path id="classpath">
<fileset dir="${lib.dir}" includes="**/*.jar"/>
</path>
<target name="compile">
<mkdir dir="${build.dir}/classes"/>
<javac srcdir="${src.dir}/java" destdir="${build.dir}/classes" classpathref="classpath" debug="true" debuglevel="lines,vars,source"/>
</target>
<target name="jar" depends="compile, git.revision">
<copy file="LICENSE" todir="${build.dir}/classes/"/>
<copy file="INCLUDES" todir="${build.dir}/classes/"/>
<copy file="${src.dir}/images/Venn2.svg" todir="${build.dir}/classes/io/compgen/txtutils/text"/>
<copy file="${src.dir}/images/Venn3.svg" todir="${build.dir}/classes/io/compgen/txtutils/text"/>
<copy file="${src.dir}/images/Venn4.svg" todir="${build.dir}/classes/io/compgen/txtutils/text"/>
<copy file="${src.dir}/images/Venn5.svg" todir="${build.dir}/classes/io/compgen/txtutils/text"/>
<delete file="${build.dir}/classes/VERSION"/>
<echo file="${build.dir}/classes/VERSION" message="${ant.project.name}-${version}-${repository.version}"/>
<mkdir dir="${dist.dir}"/>
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${lib.dir}/jarjar-1.4.jar"/>
<jar destfile="${dist.dir}/${ant.project.name}-${version}-${repository.version}.jar" basedir="${build.dir}/classes"/>
<jarjar jarfile="${dist.dir}/${ant.project.name}.jar.tmp">
<manifest>
<attribute name="Main-Class" value="io.compgen.txtutils.Main"/>
</manifest>
<zipfileset src="${lib.dir}/compgen-cmdline-0.4.1.jar"/>
<zipfileset src="${lib.dir}/lanterna-2.1.7.jar"/>
<zipfileset src="${lib.dir}/ngsutilsj-0.3.jar"/>
<fileset dir="${build.dir}/classes"/>
</jarjar>
<delete file="${dist.dir}/${project.name}"/>
<concat destfile="${dist.dir}/${ant.project.name}" binary="true">
<fileset file="${src.dir}/scripts/stub.sh" />
<fileset file="${dist.dir}/${ant.project.name}.jar.tmp" />
</concat>
<delete file="${dist.dir}/${ant.project.name}.jar.tmp"/>
<chmod file="${dist.dir}/${ant.project.name}" perm="755"/>
</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>