forked from hyphanet/plugin-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
255 lines (232 loc) · 10.1 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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<?xml version="1.0"?>
<!-- ant build file for Freenet -->
<project name="plugins-Library" default="dist" basedir=".">
<property name="freenet-cvs-snapshot.location" location="../fred/dist/freenet.jar"/>
<property name="freenet-ext.location" location="../fred/lib/freenet/freenet-ext.jar"/>
<property name="source-version" value="1.6"/>
<property name="target-version" value="1.6"/>
<property name="build" location="build/"/>
<property name="build-test" location="build-test/"/>
<property name="run-test" location="run-test/"/>
<property name="tmp" location="tmp/"/>
<property name="dist" location="dist/"/>
<property name="javadoc" location="javadoc/"/>
<property name="junit.location" value="/usr/share/java/junit.jar"/>
<property name="packagebase" value="plugins.Library" />
<property name="minNodeVersion" value="1239"/>
<property name="version.src" value="plugins/Library/Version.java" />
<property name="version.build" value="plugins/Library/Version.class" />
<available file="src/${version.src}" property="version.present"/>
<available file="${junit.location}" property="junit.present"/>
<path id="lib.path">
<pathelement location="${freenet-ext.location}"/>
<pathelement location="${freenet-cvs-snapshot.location}"/>
<fileset dir="lib/">
<include name="**/*.jar"/>
</fileset>
</path>
<exec executable="git"
failifexecutionfails="false"
errorProperty="git.errror"
outputproperty="git.describe"
resultproperty="git.result">
<arg value="describe" />
<arg value="--always" />
<arg value="--abbrev=4" />
</exec>
<condition property="git.revision" value="${git.describe}" else="@unknown@">
<and>
<equals arg1="${git.result}" arg2="0" />
<isset property="git.describe" />
</and>
</condition>
<!-- ================================================== -->
<target name="mkdir">
<mkdir dir="${build}"/>
<mkdir dir="${build-test}"/>
<mkdir dir="${run-test}"/>
<mkdir dir="${dist}"/>
<echo message="Using ${freenet-cvs-snapshot.location} as freenet-cvs-snapshot.jar"/>
<echo message="Using ${freenet-ext.location} as freenet-ext.jar"/>
</target>
<!-- ================================================== -->
<target name="build-dep">
<mkdir dir="lib/"/>
<mkdir dir="${tmp}"/>
<ant target="SnakeYAML-get"/>
<!--<ant target="KeyExplorer-get"/>-->
<delete dir="${tmp}"/>
</target>
<property name="SnakeYAML.mirror" value="https://downloads.freenetproject.org/snakeyaml-1.5.jar" />
<property name="SnakeYAML.md5" value="1788db5d529a981b090632b8e49b8cd2" />
<property name="SnakeYAML.sha" value="a3654035d0b68db775034afa5425a62250de8184" />
<available property="SnakeYAML.exist" classname="org.yaml.snakeyaml.Yaml" classpathref="lib.path"/>
<target name="SnakeYAML-get" unless="SnakeYAML.exist">
<get verbose="true" src="${SnakeYAML.mirror}" dest="${tmp}/snakeyaml-1.5.jar" />
<checksum file="${tmp}/snakeyaml-1.5.jar" algorithm="MD5" property="${SnakeYAML.md5}" verifyProperty="SnakeYAMLMD5ok" />
<checksum file="${tmp}/snakeyaml-1.5.jar" algorithm="SHA" property="${SnakeYAML.sha}" verifyProperty="SnakeYAMLSHAok" />
<fail message="SnakeYAML.zip checksum mismatch">
<condition>
<or>
<equals arg1="${SnakeYAMLMD5ok}" arg2="false" />
<equals arg1="${SnakeYAMLSHAok}" arg2="false" />
</or>
</condition>
</fail>
<move file="${tmp}/snakeyaml-1.5.jar" todir="lib/" />
</target>
<!--<property name="KeyExplorer.mirror" value="http://cloud.github.com/downloads/freenet/plugin-Library-staging/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" />
<property name="KeyExplorer.md5" value="be5f1ec860fe71c55d029ebe0350f129" />
<property name="KeyExplorer.sha" value="12bf9bc1b4d436424e43c6b509b87690ac887de1" />
<available property="KeyExplorer.exist" classname="plugins.KeyExplorer.KeyExplorerUtils" classpathref="lib.path"/>
<target name="KeyExplorer-get" unless="KeyExplorer.exist">
<get verbose="true" src="${KeyExplorer.mirror}" dest="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" />
<checksum file="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" algorithm="MD5" property="${KeyExplorer.md5}" verifyProperty="KeyExplorerMD5ok" />
<checksum file="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" algorithm="SHA" property="${KeyExplorer.sha}" verifyProperty="KeyExplorerSHAok" />
<fail message="KeyExplorer.jar checksum mismatch">
<condition>
<or>
<equals arg1="${KeyExplorerMD5ok}" arg2="false" />
<equals arg1="${KeyExplorerSHAok}" arg2="false" />
</or>
</condition>
</fail>
<move file="${tmp}/KeyExplorer-dacfafecbc82aecdeffa56bef4a047a7f6c7f08d.jar" todir="lib/" />
</target>-->
<!-- ================================================== -->
<target name="setver" if="version.present">
<!-- Update the Version.java file in ${build}-->
<copy file="src/${version.src}" tofile="${build}/${version.src}" overwrite="true" />
<delete file="${build}/${version.build}"/>
<replace file="${build}/${version.src}">
<replacefilter token="@custom@" value="${git.revision}"/>
</replace>
<echo message="Updated build version to ${git.revision} in ${build}/${version.src}"/>
</target>
<!-- ================================================== -->
<target name="compile" depends="mkdir,build-dep,setver">
<tstamp/>
<javac srcdir="src/" destdir="${build}" debug="on" optimize="on" source="${source-version}" target="${target-version}">
<!--<compilerarg value="-Xlint"/>-->
<sourcepath>
<pathelement path="${build}"/>
</sourcepath>
<classpath>
<path refid="lib.path"/>
</classpath>
<include name="**/*.java"/>
<exclude name="**/package-info.java"/>
<exclude name="${version.src}"/>
</javac>
<!-- Force compile of Version.java in case compile of ${src} didn't trigger it -->
<javac srcdir="${build}" destdir="${build}" debug="on" optimize="on" source="1.5" target="1.5">
<classpath>
<path refid="lib.path"/>
</classpath>
<include name="${version.src}"/>
</javac>
<!-- Copy web interface static files to the build dir -->
<copy todir="${build}/plugins/Library/ui/staticfiles">
<fileset dir="src/plugins/Library/ui/staticfiles"/>
</copy>
<assertions><enable/></assertions>
</target>
<target name="compile-tester" depends="compile" if="tester">
<javac srcdir="test/" destdir="${build}" debug="on" optimize="on" source="1.5" target="1.5">
<classpath>
<path refid="lib.path"/>
<!-- Uses some code that uses junit -->
<pathelement location="${junit.location}"/>
</classpath>
<include name="plugins/Library/Tester.java"/>
</javac>
</target>
<target name="delete-tester" depends="compile" unless="tester">
<delete verbose="true">
<fileset dir="${build}" includes="plugins/Library/Tester.* plugins/Library/Tester$*" />
</delete>
</target>
<target name="run" depends="dist">
<java classname="${packagebase}.ui.TestInterface">
<classpath>
<path refid="lib.path"/>
<pathelement location="${dist}/Library.jar"/>
</classpath>
</java>
</target>
<!-- ================================================== -->
<target name="unit-build" depends="compile" if="junit.present" unless="skip_tests">
<javac srcdir="test/" destdir="${build-test}" debug="on" optimize="on" source="1.5">
<classpath>
<path refid="lib.path"/>
<pathelement path="${build}"/>
<pathelement location="${junit.location}"/>
</classpath>
<compilerarg value="-Xlint"/>
<include name="**/*.java"/>
</javac>
</target>
<target name="junit" depends="unit-build" if="junit.present" unless="skip_tests">
<delete dir="${run-test}"/>
<mkdir dir="${run-test}"/>
<junit printsummary="yes" fork="yes" haltonfailure="yes" dir="${run-test}" showoutput="yes">
<classpath>
<path refid="lib.path"/>
<pathelement path="${build}"/>
<pathelement path="${build-test}"/>
<pathelement location="${junit.location}"/>
</classpath>
<assertions><enable/></assertions>
<formatter type="plain" usefile="false"/>
<batchtest fork="yes">
<fileset dir="${build-test}">
<include name="**/*Test.class"/>
</fileset>
</batchtest>
<sysproperty key="benchmark" value="${benchmark}" />
<sysproperty key="extensiveTesting" value="${extensiveTesting}" />
</junit>
</target>
<!-- ================================================== -->
<target name="jar" depends="compile,compile-tester,delete-tester,junit" description="create a jar package">
<jar jarfile="${dist}/Library.jar" duplicate="fail">
<manifest>
<attribute name="Main-Class" value="${packagebase}.ui.TestInterface"/>
<attribute name="Plugin-Main-Class" value="${packagebase}.Main"/>
<attribute name="Required-Node-Version" value="${minNodeVersion}"/>
</manifest>
<fileset dir="src/" casesensitive="no">
<include name="**/*.txt"/>
<include name="**/*.properties"/>
</fileset>
<fileset dir="${build}/">
<exclude name="${version.src}"/>
</fileset>
<zipgroupfileset dir="lib/" includes="**/*.jar"/>
</jar>
</target>
<!-- ================================================== -->
<target name="javadoc" description="generate javadocs" depends="build-dep">
<delete dir="${javadoc}"/>
<javadoc classpathref="lib.path" destdir="${javadoc}" author="true" version="true" use="true" private="true">
<doclet name="info.bliki.doclet.standard.Standard" path="doc/bliki-doclet.jar"/>
<!--<doclet name="com.visural.doclets.markdown.standard.Standard" path="doc/MarkdownDoclet.jar"/>-->
<fileset dir="src/" defaultexcludes="yes">
<include name="**/*.java"/>
</fileset>
<link href="http://java.sun.com/j2se/1.5.0/docs/api"/>
<link href="http://freenet.github.com/fred-staging/api"/>
<link href="http://snakeyamlrepo.appspot.com/releases/1.5/site/apidocs"/>
</javadoc>
</target>
<!-- ================================================== -->
<target name="dist" depends="clean,jar" description="generate the distribution from scratch">
</target>
<!-- ================================================== -->
<target name="clean" description="Delete class files and docs dir.">
<delete dir="${build}"/>
<delete dir="${build-test}"/>
<delete dir="${run-test}"/>
<delete dir="${dist}"/>
</target>
</project>