forked from nhnb/zipdiff
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
230 lines (204 loc) · 9.15 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<!-- $Header: /cvsroot/zipdiff/zipdiff/build.xml,v 1.14 2004/06/29 00:23:49 sullis Exp $ -->
<!-- ###################################################### -->
<!-- This is an Ant build file -->
<!-- -->
<!-- For details, see http://ant.apache.org/ -->
<!-- ###################################################### -->
<project name="zipdiff" default="help" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<property file="${user.home}/build.properties"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="src.dir" value="${basedir}/src"/>
<property name="java.src.dir" value="${src.dir}/main/java"/>
<property name="test.src.dir" value="${src.dir}/test/java"/>
<property name="metadata.dir" value="${src.dir}/main/resources"/>
<property name="site.dir" value="${src.dir}/site"/>
<property name="site.xdoc.dir" value="${src.dir}/site/xdoc"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="javadoc.build.dir" value="${build.dir}/doc/api"/>
<property name="site.build.dir" value="${build.dir}/doc/html"/>
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="junit.reports.dir" value="${build.dir}/junit-reports"/>
<property name="java.target" value="1.6"/>
<!-- Name and version -->
<property name="name" value="${ant.project.name}"/>
<property name="name.ant" value="${name}-ant"/>
<property name="major" value="0"/>
<property name="minor" value="5"/>
<property name="version" value="${major}.${minor}"/>
<property name="distrib.name" value="${name}-${version}"/>
<property name="distrib.jar.filename" value="${name}.jar"/>
<property name="distrib.jar.ant.filename" value="${name.ant}.jar"/>
<!-- Ivy -->
<property name="central.repo" value="http://repo1.maven.org/maven2"/>
<property name="ivy.version" value="2.4.0"/>
<property name="ivy.dir" value="${user.home}/.ivy2/cache/org.apache.ivy/jars"/>
<property name="ivy.jar.name" value="ivy-${ivy.version}.jar"/>
<available property="has.ivy" file="${ivy.dir}/${ivy.jar.name}" type="file"/>
<!-- ###################################################### -->
<!-- target definitions -->
<!-- ###################################################### -->
<target name="help">
<echo message="ant -projecthelp will display all targets"/>
</target>
<target name="all" depends="distrib"/>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="get.ivy" unless="has.ivy">
<mkdir dir="${ivy.dir}"/>
<get usetimestamp="true" src="https://repository.apache.org/content/repositories/releases/org/apache/ivy/ivy/${ivy.version}/${ivy.jar.name}"
skipexisting="true"
dest="${ivy.dir}/${ivy.jar.name}"/>
</target>
<target name="init" depends="get.ivy">
<taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.dir}/${ivy.jar.name}"/>
<ivy:settings file="${basedir}/ivy.settings.xml"/>
</target>
<target name="prepare" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${javadoc.build.dir}"/>
<mkdir dir="${classes.dir}"/>
<mkdir dir="${junit.reports.dir}"/>
</target>
<target name="resolve" depends="prepare">
<ivy:retrieve pattern="${lib.dir}/[conf]/[artifact].[ext]"
conf="core, doxia"
sync="true"/>
<path id="project.class.path">
<fileset dir="${lib.dir}/core" includes="*.jar"/>
</path>
<path id="doxia.class.path">
<fileset dir="${lib.dir}/doxia" includes="*.jar"/>
</path>
</target>
<target name="javadocs" depends="resolve">
<javadoc packagenames="zipdiff.*"
sourcepath="${java.src.dir}"
defaultexcludes="yes"
destdir="${javadoc.build.dir}"
author="true"
version="true"
use="true"
classpathref="project.class.path"
windowtitle="${name}"/>
</target>
<target name="site" depends="resolve">
<taskdef resource="net/sf/antcontrib/antlib.xml" classpath="${lib.dir}/doxia/ant-contrib.jar" onerror="ignore"/>
<for param="xdoc.source">
<path>
<fileset dir="${site.xdoc.dir}" includes="*.xml"/>
</path>
<sequential>
<propertyregex property="xdoc.html" input="@{xdoc.source}"
regexp=".*[\\/]xdoc[\\/](.*)\.xml$" replace="\1.html" override="true"/>
<echo>${xdoc.html}</echo>
<java classname="org.apache.maven.doxia.cli.ConverterCli" classpathref="doxia.class.path">
<arg line="-f -from xdoc -to xhtml"/>
<arg value="-in"/>
<arg file="@{xdoc.source}"/>
<arg value="-out"/>
<arg file="${site.build.dir}/${xdoc.html}"/>
</java>
</sequential>
</for>
<copy todir="${site.build.dir}">
<fileset dir="${site.dir}" includes="*.html"/>
</copy>
</target>
<target name="docs" depends="javadocs, site"/>
<target name="project.jarfile" depends="build">
<jar destfile="${build.dir}/${distrib.jar.filename}"
manifest="${metadata.dir}/META-INF/JAR-manifest.txt"
compress="true">
<manifest>
<section name="${name}">
<attribute name="Implementation-Title" value="${name}"/>
<attribute name="Implementation-Version" value="${version}"/>
</section>
</manifest>
<fileset dir="${classes.dir}"
includes="zipdiff/**/*.class" excludes="zipdiff/ant/*.class"/>
</jar>
</target>
<target name="ant.jarfile" depends="build">
<jar destfile="${build.dir}/${distrib.jar.ant.filename}"
manifest="${metadata.dir}/META-INF/Ant-JAR-manifest.txt"
compress="true">
<manifest>
<section name="${name.ant}">
<attribute name="Implementation-Title" value="${name.ant}"/>
<attribute name="Implementation-Version" value="${version}"/>
</section>
</manifest>
<fileset dir="${classes.dir}">
<include name="zipdiff/**/*.class"/>
<exclude name="zipdiff/**/Main.class"/>
</fileset>
<zipfileset dir="${metadata.dir}">
<include name="**/antlib.xml"/>
</zipfileset>
</jar>
</target>
<target name="build" depends="resolve">
<javac deprecation="on"
destdir="${classes.dir}"
includeAntRuntime="yes"
classpathref="project.class.path"
source="${java.target}"
target="${java.target}"
debug="on">
<src path="${java.src.dir}"/>
</javac>
</target>
<target name="buildTest" depends="build">
<javac deprecation="on"
destdir="${classes.dir}"
includeAntRuntime="yes"
classpathref="project.class.path"
debug="on">
<src path="${test.src.dir}"/>
</javac>
</target>
<target name="distrib" depends="ant.jarfile, project.jarfile, copylibraries, docs">
<delete file="${build.dir}/${distrib.name}.zip"/>
<zip destfile="${build.dir}/${distrib.name}.zip">
<zipfileset dir="${src.dir}" prefix="${distrib.name}/src">
<include name="**/*.java"/>
<include name="**/*.html"/>
<include name="**/*.txt"/>
<include name="**/*.xml"/>
<include name="**/*.properties"/>
</zipfileset>
<zipfileset dir="${basedir}" prefix="${distrib.name}">
<include name="build.xml"/>
<include name="ivy*.xml"/>
<include name="readme.txt"/>
<include name="*LICENSE*"/>
<include name="NOTICE.txt"/>
</zipfileset>
</zip>
</target>
<target name="copylibraries" depends="resolve">
<copy todir="${build.dir}">
<fileset dir="${lib.dir}/core">
<include name="*.jar"/>
</fileset>
</copy>
</target>
<target name="tests" depends="buildTest">
<junit printsummary="yes" haltonfailure="yes">
<classpath>
<path refid="project.class.path"/>
<pathelement location="${classes.dir}"/>
<pathelement path="${java.class.path}"/>
</classpath>
<formatter type="plain"/>
<batchtest fork="yes" todir="${junit.reports.dir}">
<fileset dir="${test.src.dir}">
<include name="**/*Test*.java"/>
<exclude name="**/AllTests.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>