forked from na-ka-na/ExcelCompare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
183 lines (157 loc) · 6.8 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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<?xml version="1.0" encoding="UTF-8"?>
<project name="ExcelCompare" default="build" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="load-props">
<loadproperties srcfile="cfg/build.properties" />
</target>
<target name="init" depends="load-props">
<mkdir dir="${class.dir}" />
<mkdir dir="${installer.staging}"/>
</target>
<target name="resolve-classpath" depends="init">
<!-- these will be packaged in fat-jar !-->
<fileset id="libs.classpath.fileset" dir="${lib.dir}">
<patternset includes="**/jar/*.jar"/>
</fileset>
<!-- classpath for compilation -->
<path id="lib.classpath">
<fileset refid="libs.classpath.fileset" />
</path>
<property name="jar.name" value="${project.name}-${full.version}.jar"/>
</target>
<!-- compile -->
<target name="compile" depends="resolve-classpath">
<!-- compile -->
<javac includeantruntime="false" srcdir="${src.dir}" destdir="${class.dir}"
debug="true" debuglevel="lines,vars,source" fork="true">
<compilerarg line="-J-Xmx4g" />
<classpath refid="lib.classpath" />
<classpath>
<pathelement location="${cfg.dir}" />
</classpath>
</javac>
<!-- copy other resources -->
<copy todir="${class.dir}">
<fileset dir="${src.dir}">
<include name="**/*.txt" />
<include name="**/*.tokens" />
<include name="**/*.list" />
<include name="**/*.xls*" />
</fileset>
</copy>
</target>
<!-- test-compile -->
<target name="test-compile" depends="resolve-classpath">
<javac includeantruntime="false" srcdir="${test.dir}" destdir="${class.dir}"
debug="true" debuglevel="lines,vars,source" fork="true">
<compilerarg line="-J-Xmx4g" />
<classpath refid="lib.classpath" />
<classpath>
<pathelement location="${testcfg.dir}" />
</classpath>
</javac>
<copy todir="${class.dir}">
<fileset dir="${test.dir}">
<include name="**/*.txt" />
<include name="**/*.tokens" />
<include name="**/*.list" />
<include name="**/*.xls*" />
</fileset>
</copy>
</target>
<!-- tests go here -->
<target name="test" depends="compile, test-compile">
<java classname="${test.mainclass}" fork="true" failonerror="true">
<jvmarg value="-Xmx4g" />
<classpath refid="lib.classpath" />
<classpath>
<pathelement location="${class.dir}" />
<pathelement location="${testcfg.dir}" />
</classpath>
</java>
</target>
<!-- create .jar -->
<target name="jar" depends="compile">
<jar jarfile="${basedir}/${installer.staging}/bin/dist/${jar.name}" basedir="${class.dir}">
<fileset dir="${cfg.dir}">
<include name="*" />
<exclude name="test" />
</fileset>
<manifest>
<attribute name="VERSION" value="${full.version}" />
<!-- attribute name="SVN-Revision" value="${svnversion}" / -->
<attribute name="Main-Class" value="${mainclass}" />
</manifest>
</jar>
</target>
<target name="java-version-check">
<fail message="Java version: ${ant.java.version}, required at most 1.6.">
<condition>
<not>
<or>
<equals arg1="${ant.java.version}" arg2="1.6" />
<equals arg1="${ant.java.version}" arg2="1.5" />
</or>
</not>
</condition>
</fail>
</target>
<target name="build" depends="java-version-check, jar, copy-jars, copy-readme, copy-legal, write-binaries, create-zip"/>
<target name="create-zip" depends="load-props">
<zip destfile="${project.name}-${full.version}.zip" basedir="${installer.staging}" />
</target>
<target name="write-binaries" depends="load-props">
<copy file="${basedir}/scripts/${binary_name}" tofile="${installer.staging}/bin/${binary_name}" />
<chmod file="${installer.staging}/bin/${binary_name}" perm="+x"/>
<copy file="${basedir}/scripts/${binary_name}.bat" tofile="${installer.staging}/bin/${binary_name}.bat" />
</target>
<target name="copy-jars" depends="load-props">
<copy todir="${basedir}/${installer.staging}/bin/dist" flatten="true">
<fileset refid="libs.classpath.fileset" />
</copy>
</target>
<target name="copy-legal" depends="load-props">
<copy todir="${basedir}/${installer.staging}/legal" flatten="false">
<fileset dir="${legal.dir}" />
</copy>
</target>
<target name="copy-readme" depends="load-props">
<copy todir="${basedir}/${installer.staging}" flatten="true">
<fileset file="${readme.file}" />
</copy>
</target>
<!-- removes all that has been built -->
<target name="clean" depends="load-props">
<delete dir="${installer.staging}" includeEmptyDirs="true"/>
<delete dir="${class.dir}" includeEmptyDirs="true" />
</target>
<!-- ========================= Ivy stuff ========================= -->
<target name="ivy-dir-check">
<property name="ivy.jar.dir" value="ivy" />
<condition property="ivy.dir.exists">
<available file="${ivy.jar.dir}" type="dir"/>
</condition>
</target>
<target name="ivy-init" depends="init, ivy-dir-check" if="ivy.dir.exists" >
<!-- try to load ivy here from local ivy dir, in case the user has not already dropped
it into ant's lib dir (note that the latter copy will always take precedence).
We will not fail as long as local lib dir exists (it may be empty) and
ivy is in at least one of ant's lib dir or the local lib dir. -->
<path id="ivy.lib.path">
<fileset dir="${ivy.jar.dir}" includes="*.jar"/>
</path>
<taskdef resource="org/apache/ivy/ant/antlib.xml"
uri="antlib:org.apache.ivy.ant" classpathref="ivy.lib.path"/>
</target>
<target name="deps" depends="ivy-init">
<ivy:retrieve pattern="${lib.dir}/ivy/[type]/[artifact]-[revision].[ext]" sync="true"/>
<ivy:report todir="${lib.dir}/ivy"/>
</target>
<target name="clean-deps" depends="ivy-init">
<delete includeemptydirs="true">
<fileset dir="${lib.dir}/ivy" defaultexcludes="true"/>
</delete>
</target>
<target name="clean-ivy-cache" depends="ivy-init" description="--> clean the ivy cache">
<ivy:cleancache />
</target>
</project>