-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.xml
258 lines (233 loc) · 10.4 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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." default="all" name="itoopie">
<property name="src" value="src"/>
<property name="lib" value="lib"/>
<property name="build" value="build"/>
<property name="dist" location="dist"/>
<property name="jar" value="itoopie.jar"/>
<property name="resources" value="resources"/>
<property name="temp" value="pkg-temp" />
<property name="javadoc" value="javadoc"/>
<property name="javac.compilerargs" value=""/>
<target name="init">
<mkdir dir="${build}"/>
<mkdir dir="${build}/${lib}"/>
<mkdir dir="${build}/${resources}"/>
<mkdir dir="${build}/${javadoc}"/>
<mkdir dir="${dist}"/>
<copy todir="${dist}/${lib}">
<fileset dir="${lib}" />
</copy>
</target>
<target name="clean" description="Clean up files created during build">
<delete dir="${build}"/>
<delete dir="${dist}"/>
<delete dir="{temp}" />
<delete file="installer.jar" failonerror="false" />
<delete file="itoopie-install.exe" failonerror="false" />
<delete file="itoopie.app.tar.bz2" failonerror="false" />
<delete file="itoopie-install.exe.sha512" failonerror="false" />
<delete dir="plugin/lib" />
<delete dir="plugin/lib" />
<delete>
<fileset dir="plugin/" excludes="clients.config" />
</delete>
<delete file="itoopie.su3" failonerror="false" />
<delete file="itoopie-update.su3" failonerror="false" />
<delete file="itoopie.xpi2p" failonerror="false" />
<ant dir="plugin-src" target="clean" />
</target>
<target name="compile" depends="clean,init">
<javac
debug="true"
deprecation="on"
includeAntRuntime="false"
encoding="UTF-8"
source="1.8"
target="1.8"
srcdir="${src}"
destdir="${build}">
<classpath>
<pathelement location="${lib}/commons-logging-1.1.1.jar" />
<pathelement location="${lib}/json-smart-1.0.6.4.jar" />
<pathelement location="${lib}/jchart2d-3.2.2.jar" />
<pathelement location="${lib}/xmlgraphics-commons-1.3.1.jar" />
</classpath>
</javac>
<copy todir="${build}/${resources}">
<fileset dir="${resources}" />
</copy>
</target>
<target name="jar" depends="compile">
<exec executable="sh" osfamily="unix" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
</exec>
<exec executable="sh" osfamily="mac" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
</exec>
<javac source="1.8" target="1.8"
includeAntRuntime="false"
encoding="UTF-8"
srcdir="build/messages-src" destdir="${build}">
<compilerarg line="${javac.compilerargs}" />
</javac>
<jar basedir="${build}" destfile="${dist}/${jar}" excludes="messages-src/**/*">
<manifest>
<attribute name="Main-Class" value="net.i2p.itoopie.Main"/>
<attribute name="Class-Path" value="${lib}/commons-logging-1.1.1.jar ${lib}/json-smart-1.0.6.4.jar ${lib}/jchart2d-3.2.2.jar ${lib}/xmlgraphics-commons-1.3.1.jar" />
</manifest>
</jar>
</target>
<target name="javadoc" description="build javadocs">
<mkdir dir="${build}" />
<mkdir dir="${build}/${javadoc}" />
<javadoc
sourcepath="${src}" destdir="${build}/${javadoc}"
packagenames="*"
use="true"
splitindex="true"
windowtitle="itoopie">
<classpath>
<pathelement location="${lib}/commons-logging-1.1.1.jar" />
<pathelement location="${lib}/json-smart-1.0.6.4.jar" />
<pathelement location="${lib}/jchart2d-3.2.2.jar" />
<pathelement location="${lib}/xmlgraphics-commons-1.3.1.jar" />
</classpath>
</javadoc>
</target>
<target name="poupdate" depends="init" description="update po files">
<exec executable="sh" osfamily="unix" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
<arg value="-p" />
</exec>
<exec executable="sh" osfamily="mac" failifexecutionfails="true" >
<arg value="./bundle-messages.sh" />
<arg value="-p" />
</exec>
</target>
<target name="installer" depends="jar" description="build multi-arch installer">
<ant target="doAppEXE" />
<taskdef name="izpack" classpath="${basedir}/installer/lib/izpack/standalone-compiler.jar" classname="com.izforge.izpack.ant.IzPackTask" />
<izpack input="${basedir}/installer/installer.xml"
output="${basedir}/installer.jar"
installerType="standard"
basedir="${basedir}"
compression="deflate"
compressionlevel="9" />
<ant target="installerexe" />
</target>
<target name="installerexe" unless="noExe">
<!--<condition property="noExe">
<os arch="x86_64" />
</condition>
<condition property="noExe">
<os arch="amd64" />
</condition>
<condition property="noExe">
<not>
<or>
<os name="Linux" />
<os family="windows" />
</or>
</not>
</condition>-->
<ant target="doInstallerEXE" />
</target>
<target name="doInstallerEXE" unless="noExe">
<!-- now the installer exe -->
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
<launch4j configFile="installer/itoopieinstaller.xml" />
<checksum file="itoopie-install.exe" algorithm="SHA-512" fileext=".sha512"/>
</target>
<!-- thazzit -->
<target name="doAppEXE" unless="noExe">
<taskdef name="launch4j"
classname="net.sf.launch4j.ant.Launch4jTask"
classpath="${basedir}/installer/lib/launch4j/launch4j.jar:${basedir}/installer/lib/launch4j/lib/xstream.jar" />
<launch4j configFile="installer/itoopiestandalone.xml" />
</target>
<target name="dist" depends="jar" description="create jars but don't create an installer"/>
<target name="all" depends="jar" />
<target name="osx" depends="makeOSXBundle" />
<target name="makeOSXBundle" depends="jar" description="build a OSX bundle">
<mkdir dir="${temp}/itoopie.app" />
<copy todir="${temp}/itoopie.app">
<fileset dir="installer/resources/itoopie.app" />
</copy>
<exec executable="chmod" osfamily="unix" failonerror="true">
<arg value="755" />
<arg value="${temp}/itoopie.app/Contents/MacOS/JavaApplicationStub" />
</exec>
<mkdir dir="${temp}/itoopie.app/Contents/Resources/Java" />
<copy todir="${temp}/itoopie.app/Contents/Resources/Java">
<fileset dir="${dist}" />
</copy>
<ant target="dotarbundle" />
</target>
<target name="dotarbundle" unless="notarbundle">
<exec executable="tar" osfamily="unix" failonerror="true">
<arg value="--owner=root" />
<arg value="--group=root" />
<arg value="-cjvf" />
<arg value="itoopie.app.tar.bz2" />
<arg value="-C" />
<arg value="${temp}" />
<arg value="itoopie.app" />
</exec>
</target>
<target name="plugin" depends="jar">
<ant dir="plugin-src" target="build" />
<delete>
<!-- in installer but not update -->
<fileset dir="plugin/" includes="itoopie.conf" />
</delete>
<!-- get version number -->
<buildnumber file="scripts/build.number" />
<property name="release.number" value="0.0.4" />
<!-- make the update xpi2p -->
<!-- this contains everything except i2ptunnel.config -->
<copy file="license.txt" tofile="plugin/LICENSE.txt" overwrite="true" />
<copy file="README" tofile="plugin/README.txt" overwrite="true" />
<copy file="scripts/plugin.config" todir="plugin/" overwrite="true" />
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
<arg value="update-only=true" />
</exec>
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
<arg value="version=${release.number}-b${build.number}" />
</exec>
<mkdir dir="plugin/lib" />
<copy file="plugin-src/build/itoopie-plugin.jar" todir="plugin/lib" overwrite="true" />
<copy file="lib/commons-logging-1.1.1.jar" tofile="plugin/lib/commons-logging.jar" overwrite="true" />
<copy file="lib/jchart2d-3.2.2.jar" tofile="plugin/lib/jchart2d.jar" overwrite="true" />
<copy file="lib/json-smart-1.0.6.4.jar" tofile="plugin/lib/json-smart.jar" overwrite="true" />
<copy file="lib/xmlgraphics-commons-1.3.1.jar" tofile="plugin/lib/xmlgraphics-commons.jar" overwrite="true" />
<copy file="lib/NOTICE-apache-xmlgraphics-commons" tofile="plugin/NOTICE-apache-xmlgraphics-commons.txt" overwrite="true" />
<copy todir="plugin">
<fileset dir="lib" includes="*.txt" />
</copy>
<copy file="${dist}/${jar}" todir="plugin/lib" />
<input message="Enter su3 signing key password:" addproperty="release.password.su3" />
<fail message="You must enter a password." >
<condition>
<equals arg1="${release.password.su3}" arg2=""/>
</condition>
</fail>
<!-- this will fail if no su3 keys exist, as it needs the password twice -->
<exec executable="scripts/makeplugin.sh" inputstring="${release.password.su3}" failonerror="true" >
<arg value="plugin" />
</exec>
<move file="itoopie.su3" tofile="itoopie-update.su3" overwrite="true" />
<!-- make the install xpi2p -->
<copy file="scripts/plugin.config" todir="plugin/" overwrite="true" />
<!-- Files in installer but not update. Be sure to Add to delete fileset above and clean target below -->
<copy file="scripts/itoopie.conf" todir="plugin/" overwrite="true" />
<exec executable="echo" osfamily="unix" failonerror="true" output="plugin/plugin.config" append="true">
<arg value="version=${release.number}-b${build.number}" />
</exec>
<exec executable="scripts/makeplugin.sh" inputstring="${release.password.su3}" failonerror="true" >
<arg value="plugin" />
</exec>
</target>
</project>