forked from JonathanAquino/git-time-lapse-view
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
107 lines (94 loc) · 4.2 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<!-- Based on http://www.mkyong.com/ant/ant-create-a-fat-jar-file/ -->
<project name="git-time-lapse-view" default="main" basedir=".">
<description>
Built git-time-lapse-view.
</description>
<property name="projectName" value="git-time-lapse-view" />
<property name="src.dir" location="src" />
<property name="test.dir" location="test" />
<property name="build.dir" location="bin" />
<property name="build.src.dir" location="bin/src" />
<property name="build.test.dir" location="bin/test" />
<property name="dist.dir" location="dist" />
<property name="dist.lib.dir" location="dist/lib" />
<property name="lib.dir" value="lib" />
<property name="main-class" value="com.jonathanaquino.gittimelapseview.Application" />
<target name="init">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.test.dir}" />
</target>
<path id="classpath">
<pathelement location="lib/test/junit-4.12.jar" />
<pathelement location="lib/test/hamcrest-core-1.3.jar" />
<fileset dir="${basedir}/">
<include name="${lib.dir}/*.jar" />
</fileset>
<pathelement location="${build.dir}"/>
</path>
<target name="prompt-version">
<input message="Please enter version number (e.g., v1.0):" addproperty="version"/>
</target>
<!-- Copy src to bin/src, replace v0.0 with ${version}, then generate classes to bin. -->
<target name="compile" depends="prompt-version, init" description="compile the source ">
<copy todir="${build.src.dir}">
<fileset dir="${src.dir}"/>
</copy>
<replace file="${build.src.dir}/com/jonathanaquino/gittimelapseview/LoadPanel.java" token="v0.0" value="${version}"/>
<javac includeantruntime="false" srcdir="${build.src.dir}"
destdir="${build.dir}" classpathref="classpath" />
<javac includeantruntime="false" srcdir="${test.dir}"
destdir="${build.test.dir}" classpathref="classpath" />
<delete dir="${build.src.dir}"/>
</target>
<target name="junit" depends="compile">
<junit printsummary="yes">
<classpath>
<path refid="classpath"/>
<pathelement location="${build.test.dir}"/>
</classpath>
<batchtest fork="yes">
<fileset dir="${src.dir}" includes="*Test.java"/>
</batchtest>
</junit>
</target>
<!-- Zip up lib/*.jar into dist/lib/dependencies-all.jar -->
<target name="copy-dependencies">
<mkdir dir="${dist.lib.dir}" />
<jar jarfile="${dist.lib.dir}/dependencies-all.jar">
<zipgroupfileset dir="${lib.dir}">
<include name="**/*.jar" />
</zipgroupfileset>
</jar>
</target>
<!-- Generate dist/git-time-lapse-view.jar -->
<target name="jar" depends="compile, copy-dependencies" description="package, output to JAR">
<mkdir dir="${dist.dir}" />
<mkdir dir="${dist.lib.dir}" />
<jar jarfile="${dist.dir}/${projectName}.jar" basedir="${build.dir}">
<manifest>
<attribute name="Main-Class" value="${main-class}" />
</manifest>
<zipfileset src="${dist.lib.dir}/dependencies-all.jar" excludes="META-INF/*.SF" />
</jar>
</target>
<target name="run" depends="jar" description="Run the app.">
<java classname="com.jonathanaquino.gittimelapseview.Application" fork="true">
<classpath>
<pathelement location="${dist.dir}/${projectName}.jar"/>
</classpath>
</java>
</target>
<target name="clean" description="clean up">
<delete dir="${build.dir}" />
<delete dir="${dist.dir}" />
</target>
<target name="zip" depends="prompt-version, jar" description="Create final zip file">
<zip destfile="${dist.dir}/${projectName}-${version}.zip">
<fileset dir="." includes="README.md"/>
<fileset dir="." includes="gpl-2.0.txt"/>
<fileset dir="dist" includes="${projectName}.jar"/>
</zip>
</target>
<!-- Default, run this -->
<target name="main" depends="prompt-version, clean, compile, junit, jar, zip" />
</project>