forked from hyphanet/fred
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
232 lines (201 loc) · 8.45 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
<?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>
<!-- 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="version.src" value="freenet/node/Version.java" />
<property name="version.build" value="freenet/node/Version.class" />
<property name="CSSTokenizerFilter.relative.jflex" value="freenet/clients/http/filter/CSSTokenizerFilter.jflex"/>
<property name="CSSTokenizerFilter.java" value="${src}/freenet/clients/http/filter/CSSTokenizerFilter.java"/>
<property name="junit.location" value="/usr/share/java/junit.jar"/>
<condition property="executable" value="jflex.bat" else="jflex">
<os family="windows"/>
</condition>
<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="${CSSTokenizerFilter.java}" property="CSSTokenizerFilter.present"/>
<available file="${junit.location}" property="junit.present"/>
</target>
<target name="generate-CSSTokenizerFilter" depends="env" unless="CSSTokenizerFilter.present">
<echo message="Generating CSSTokenizerFilter.java"/>
<exec dir="${src}" executable="${executable}" failonerror="true" resolveexecutable="true">
<arg value="-q"/>
<arg value="--nobak"/>
<arg value="${CSSTokenizerFilter.relative.jflex}"/>
</exec>
</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>
<!-- ================================================== -->
<target name="compile" depends="get-extjar, generate-CSSTokenizerFilter">
<!-- 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="junit.present" unless="skip_tests">
<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/clients/http/filter/png">
<fileset dir="${test}/freenet/clients/http/filter/png"/>
</copy>
</target>
<target name="unit" depends="unit-build" if="junit.present" unless="skip_tests">
<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}" />
</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 file="${CSSTokenizerFilter.java}"/>
<delete dir="${build}"/>
<delete dir="${build-test}"/>
<delete dir="${lib}"/>
<delete dir="${javadoc}"/>
</target>
<target name="javadoc">
<javadoc sourcepath="${src}" destdir="${javadoc}">
<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>