forked from NiLuJe/KUAL_Booklet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
137 lines (119 loc) · 4.72 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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
<?xml version="1.0" encoding="UTF-8"?>
<project name="KUAL" default="dist">
<property file="build.properties"/>
<!-- local properties which are not committed to git. See build.properties for the keys which are expected to be found in there. -->
<property file="build-local.properties"/>
<path id="classpath.jdk14">
<fileset dir="${build.classpath.jdk14}" includes="**/*.jar"/>
</path>
<path id="classpath.lib">
<fileset dir="lib" includes="**/*.jar"/>
<fileset dir="${build.classpath.592}" includes="**/*.jar"/>
</path>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="prepare">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
<mkdir dir="dist"/>
</target>
<target name="compile" depends="prepare">
<javac source="1.4" target="1.4" includeantruntime="false" bootclasspathref="classpath.jdk14" classpathref="classpath.lib" srcdir="src" destdir="${build.dir}" debug="true" debuglevel="lines,vars,source">
<include name="com/mobileread/ixtab/**/KualBooklet.java"/>
<include name="com/mobileread/ixtab/**/KualLog.java"/>
</javac>
</target>
<target name="build-booklet" depends="compile, git.changelog">
<property name="file" value="${product.filename}Booklet.jar"/>
<delete file="${file}"/>
<jar destfile="${file}">
<manifest>
<attribute name="Main-Class" value="${product.bookletmainclass}"/>
</manifest>
<!-- actual program logic files -->
<fileset dir="${build.dir}">
<include name="**/KualBooklet.class"/>
<include name="**/KualBooklet*.class"/>
<include name="**/resources/KualLog.class"/>
</fileset>
</jar>
</target>
<target name="cleanup" description="Remove the files generated by the build system">
<delete file="src/com/mobileread/ixtab/kolauncher/resources/dist/ChangeLog.txt"/>
</target>
<!-- Get a pretty git version :). Cf. http://stackoverflow.com/questions/2974106 -->
<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">
<arg value="describe"/>
<arg value="--tags"/>
<arg value="--always"/>
<arg value="HEAD"/>
<!-- Replace the first dash by a dot -->
<redirector>
<outputfilterchain>
<tokenfilter>
<replaceregex pattern="-" replace="."/>
</tokenfilter>
</outputfilterchain>
</redirector>
</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>
<echo level="info">Got git revision</echo>
</target>
<!-- And the date of the last commit in our usual format... -->
<target name="git.date" description="Store date of last commit ${repository.rawdate}" if="git.present">
<exec executable="git" outputproperty="git.date" failifexecutionfails="false">
<arg value="show"/>
<arg value="-s"/>
<arg value="--format=%ct"/>
</exec>
<condition property="repository.rawdate" value="${git.date}" else="unknown">
<and>
<isset property="git.date"/>
<length string="${git.date}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<echo level="info">Got last commit date</echo>
</target>
<target name="date.date" depends="git.date" description="Format date of last commit in ${repository.date}">
<exec executable="date" outputproperty="date.date" failifexecutionfails="false">
<arg value="-d"/>
<arg value="@${repository.rawdate}"/>
<arg value="+%Y%m%d"/>
</exec>
<condition property="repository.date" value="${date.date}" else="unknown">
<and>
<isset property="date.date"/>
<length string="${date.date}" trim="yes" length="0" when="greater"/>
</and>
</condition>
<echo level="info">Formatted last commit date</echo>
</target>
<!-- Build a ChangeLog from git -->
<target name="git.changelog" description="Build a ChangeLog from git" if="git.present">
<exec executable="git" output="src/com/mobileread/ixtab/kolauncher/resources/dist/ChangeLog.txt" failifexecutionfails="false">
<arg value="log"/>
<arg value="--stat"/>
<arg value="--graph"/>
</exec>
<echo level="info">Built ChangeLog</echo>
</target>
<!-- Ship it! -->
<target name="dist" depends="build-booklet, clean, git.revision, date.date">
<exec executable="src/com/mobileread/ixtab/kolauncher/resources/tool/shipit.sh" failifexecutionfails="false" errorproperty="">
<arg value="${repository.version}"/>
<arg value="${repository.date}"/>
</exec>
<antcall target="cleanup"/>
<echo level="info">
Finished building version ${repository.version} (${repository.date}) :)
</echo>
</target>
</project>