forked from hyphanet/fred
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
273 lines (236 loc) · 9.77 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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
<?xml version="1.0" encoding="UTF-8"?>
<!-- ant build file for Freenet -->
<project name="Freenet" default="dist" basedir=".">
<description>
This file builds Freenet: What is Freenet?
Freenet is free software which lets you publish and obtain information on the Internet without fear of censorship. To achieve this freedom, the network is entirely decentralized and publishers and consumers of information are anonymous. Without anonymity there can never be true freedom of speech, and without decentralization the network would be vulnerable to attack.
Possible targets: compile, dist (default), clean
</description>
<!-- Give user a chance to override without editing this file
(and without typing -D each time it compiles it) -->
<property file="build.properties" />
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="build" location="build"/>
<property name="build-test" location="build-test"/>
<property name="lib" location="lib"/>
<property name="freenet-ext.location" location="${lib}/freenet-ext.jar"/>
<property name="javadoc" location="javadoc"/>
<property name="minExtVersion" value="-1"/>
<property name="recommendedExtVersion" value="-1"/>
<property name="GWT.generatedjs" value="${src}/freenet/clients/http/staticfiles/freenetjs"/>
<property name="GWT.lib" value="generator/js/lib"/>
<property name="GWT.lib.dev" value="${GWT.lib}/gwt-dev.jar"/>
<property name="GWT.lib.user" value="${GWT.lib}/gwt-user.jar"/>
<property name="version.src" value="freenet/node/Version.java" />
<property name="version.build" value="freenet/node/Version.class" />
<property name="junit.location" value="/usr/share/java/junit.jar"/>
<available file="${junit.location}" property="junit.present"/>
<path id="lib.path">
<pathelement location="${freenet-ext.location}"/>
<pathelement location="gnu-crypto.jar"/>
<pathelement location="javax-security.jar"/>
<pathelement location="javax-crypto.jar"/>
</path>
<assertions>
<enable/>
</assertions>
<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="${lib}"/>
</target>
<target name="env" depends="mkdir" description="Learn about the environment">
<available file="${lib}/freenet-ext.jar" property="freenet-ext.present"/>
<!-- available file="${junit.location}" property="junit.present"/ -->
<available file="${GWT.generatedjs}" type="dir" property="generatedjs.present"/>
<echo level="verbose">Javascript generation present:${generatedjs.present}</echo>
<available file="${GWT.lib.dev}" property="GWT.lib.dev.present"/>
<echo level="verbose">gwt-dev-linux.jar present:${GWT.lib.dev.present}</echo>
<available file="${GWT.lib.user}" property="GWT.lib.user.present"/>
<echo level="verbose">gwt-user.jar present:${GWT.lib.user.present}</echo>
</target>
<target name="get-GWT-lib-dev" depends="env" unless="GWT.lib.dev.present">
<mkdir dir="${GWT.lib}"/>
<get src="http://localhost/gwt-dev.jar"
dest="${GWT.lib}/gwt-dev.jar"
verbose="true"
usetimestamp="true"/>
<property name="GWT.lib.dev.present" value="true"/>
</target>
<target name="get-GWT-lib-user" depends="env" unless="GWT.lib.user.present">
<mkdir dir="${GWT.lib}"/>
<get src="http://localhost/gwt-user.jar"
dest="${GWT.lib}/gwt-user.jar"
verbose="true"
usetimestamp="true"/>
<property name="GWT.lib.user.present" value="true"/>
</target>
<target name="get-GWT-libs" unless="generatedjs.present">
<antcall target="get-GWT-lib-dev"/>
<antcall target="get-GWT-lib-user"/>
</target>
<target name="generate-js" depends="env,get-GWT-libs" unless="generatedjs.present">
<ant antfile="build.xml" dir="generator/js"/>
</target>
<target name="get-extjar" depends="env" unless="freenet-ext.present"
description="Download some external libraries which Freenet relies on">
<mkdir dir="${lib}"/>
<get src="http://checksums.freenetproject.org/cc/freenet-ext.jar"
dest="${freenet-ext.location}"
verbose="true"
usetimestamp="true"/>
<property name="freenet-ext.present" value="true"/>
</target>
<condition property="do.junit" value="true">
<and>
<isfalse value="${skip_tests}" />
<isset property="junit.present" />
</and>
</condition>
<!-- ================================================== -->
<target name="compile" depends="get-extjar, generate-js">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the Version file with patched revision number in ${build} -->
<copy file="${src}/${version.src}" tofile="${build}/${version.src}" overwrite="true" />
<delete file="${build}/${version.build}" quiet="true" />
<replace file="${build}/${version.src}">
<replacefilter token="@custom@" value="${git.revision}"/>
</replace>
<echo message="Updated build version to ${git.revision} in ${build}/${version.src}"/>
<!-- Create the build directory structure used by compile -->
<javac srcdir="${src}" destdir="${build}" debug="on" optimize="on" source="1.5" target="1.5">
<compilerarg value="-Xlint"/>
<!-- tell javac to find Version.java in ${build}, not ${src} -->
<sourcepath>
<pathelement path="${build}"/>
</sourcepath>
<classpath>
<path refid="lib.path"/>
</classpath>
<!-- following a very temporary list of files to be build -->
<include name="freenet/**/*.java"/>
<include name="net/i2p/util/*.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}/freenet/clients/http/staticfiles">
<fileset dir="${src}/freenet/clients/http/staticfiles"/>
</copy>
<!-- Copy translation files to the build dir -->
<copy todir="${build}/freenet/l10n">
<fileset dir="${src}/freenet/l10n">
<include name="freenet.l10n.*.properties"/>
</fileset>
</copy>
</target>
<!-- ================================================== -->
<target name="dist" depends="compile,unit" description="generate the distribution" >
<!-- Create the distribution directory -->
<jar jarfile="${lib}/freenet-cvs-snapshot.jar" basedir="${build}">
<manifest>
<attribute name="Main-Class" value="freenet/node/Node"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Required-Ext-Version" value="${minExtVersion}"/>
<attribute name="Recommended-Ext-Version" value="${recommendedExtVersion}"/>
<section name="common">
<attribute name="Specification-Title" value="Freenet"/>
<attribute name="Specification-Version" value="0.7.5"/>
<attribute name="Specification-Vendor" value="freenetproject.org"/>
<attribute name="Implementation-Title" value="Freenet"/>
<attribute name="Implementation-Version" value="0.7.5 ${TODAY} ${git.revision}"/>
<attribute name="Implementation-Vendor" value="Freenetproject.org"/>
</section>
</manifest>
<exclude name="${version.src}"/>
</jar>
</target>
<!-- ================================================== -->
<target name="unit-build" depends="compile" if="do.junit">
<delete dir="${build-test}"/>
<mkdir dir="${build-test}"/>
<javac srcdir="${test}" destdir="${build-test}" debug="on" optimize="on" source="1.5" target="1.5">
<classpath>
<path refid="lib.path"/>
<pathelement path="${build}"/>
<pathelement location="${junit.location}"/>
</classpath>
<compilerarg value="-Xlint"/>
<include name="**/*.java"/>
<exclude name="*.java"/>
</javac>
<copy todir="${build-test}/freenet/client/filter/png">
<fileset dir="${test}/freenet/client/filter/png"/>
</copy>
</target>
<target name="unit" depends="unit-build" if="do.junit">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath>
<path refid="lib.path"/>
<pathelement path="${build}"/>
<pathelement path="${build-test}"/>
<pathelement location="${junit.location}"/>
</classpath>
<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}" />
<!-- It appears we need to specify this here explicitly -->
<assertions>
<enable />
</assertions>
</junit>
</target>
<!-- ================================================== -->
<target name="clean" description="Delete class files and docs dir.">
<delete dir="${build}"/>
<delete dir="${build-test}"/>
</target>
<target name="distclean" description="Delete class files, lib dir and docs dir.">
<delete dir="${build}"/>
<delete dir="${build-test}"/>
<delete dir="${lib}"/>
<delete dir="${javadoc}"/>
<ant antfile="build.xml" target="deleteGenerated" dir="generator/js"/>
<!--<delete dir="${GWT.lib}"/>
Don't delete GWT dir -->
</target>
<target name="javadoc">
<javadoc sourcepath="${src}" destdir="${javadoc}" use="true">
<fileset dir="${src}" includes="**/*.java" />
<classpath>
<pathelement location="${freenet-ext.location}"/>
</classpath>
<link href="http://java.sun.com/j2se/1.5.0/docs/api"/>
</javadoc>
</target>
</project>