-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathbuild.xml
168 lines (146 loc) · 6.62 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
<?xml version="1.0"?>
<project name="Freenet installer" default="dist" basedir=".">
<description>
This file builds the freenet installer...
</description>
<property environment="env"/>
<property name="keystore" value="${env.jarsignerStoreLocation}"/>
<property name="keystore_alias" value="${env.jarsignerAlias}"/>
<property name="keystore_pass" value="${env.jarsignerStorePassword}"/>
<property name="key_pass" value="${env.jarsignerCodeSigningKeyPassword}"/>
<!-- TODO: Allow separate configuration of these values. -->
<property name="config" value="install.xml"/>
<property name="dest" value="install.jar"/>
<property name="bundle_dir" value="Freenet.app"/>
<property name="bundle_file" value="${bundle_dir}.zip"/>
<property name="build" value="build"/>
<property name="izPack.lib" value="lib/standalone-compiler.jar"/>
<available file="${izPack.lib}" property="izPack_available" />
<property name="bundler.lib" value="lib/appbundler-1.0.jar" />
<property name="bundler.class" value="com.oracle.appbundler.AppBundlerTask"/>
<available file="${bundler.lib}" property="bundler_available" />
<!-- ================================================== -->
<target name="check-izpack">
<fail unless="izPack_available" status="1"
message="You need to download izPack and to put standalone-compiler.jar into lib/" />
</target>
<target name="check-bundler">
<fail unless="bundler_available" status="1"
message="You need to download bundler (http://java.net/projects/appbundler) and put it into ${bundler.lib}" />
</target>
<target name="dist" description="generate the distribution" depends="compile, check-izpack">
<echo message="Build the installer"/>
<taskdef name="izpack" classpath="${izPack.lib}" classname="com.izforge.izpack.ant.IzPackTask"/>
<izpack input="${config}" output="${dest}" baseDir="${basedir}"/>
<jar jarfile="${dest}" update="true">
<manifest>
<attribute name="Permissions" value="all-permissions"/>
<section name="common">
<attribute name="Application-Name" value="Freenet"/>
<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 ${git.revision}"/>
<attribute name="Implementation-Vendor" value="freenetproject.org"/>
</section>
</manifest>
</jar>
</target>
<target name="bundle" depends="dist, clean-bundle, check-bundler">
<taskdef name="bundleapp" classname="${bundler.class}" classpath="${bundler.lib}" />
<mkdir dir="${bundle_dir}"/>
<bundleapp outputdirectory="${bundle_dir}" name="Freenet"
displayname="Freenet Installer"
identifier="org.freenet.installer"
mainclassname="com.izforge.izpack.installer.Installer">
<classpath file="${dest}" />
</bundleapp>
<!-- For some reason the permissions are not kept ... so this is necessary -->
<chmod file="${bundle_dir}/${bundle_dir}/Contents/MacOS/JavaAppLauncher" perm="a+rx" />
<tar destfile="${bundle_dir}.tar">
<tarfileset dir="${bundle_dir}" filemode="755" username="freenet" group="freenet">
<include name="**"/>
</tarfileset>
</tar>
<zip destfile="${bundle_file}" preserve0permissions="true">
<tarfileset src="${bundle_dir}.tar"/>
</zip>
</target>
<target name="clean-bundle">
<delete file="${bundle_file}"/>
<delete file="${bundle_dir}.tar"/>
<delete dir="${bundle_dir}"/>
</target>
<!-- Note that this requires environment variables. They are set by the release-installer script. -->
<target name="sign" description="Sign the distribution" depends="dist">
<echo message="Signing the installer"/>
<signjar jar="${dest}" strict="false" tsaurl="http://timestamp.comodoca.com/rfc3161" alias="${keystore_alias}" keystore="${keystore}" storepass="${keystore_pass}" keypass="${key_pass}" sigalg="SHA256withRSA" digestalg="SHA-256"/>
<!-- TODO: Should have strict="true", but some versions of jarsigner do not support it. -->
<verifyjar jar="${dest}" alias="${keystore_alias}" keystore="${keystore}" storepass="${keystore_pass}" keypass="${key_pass}"/>
</target>
<!-- ================================================== -->
<target name="clean" description="Delete the installer" depends="clean-bundle">
<delete file="${dest}"/>
<delete dir="${build}"/>
</target>
<target name="compile" depends="compile_sha1test, compile_browser, compile_uncompress, compile_bindtest"/>
<target name="compile_sha1test" unless="skip_sha1test">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/sha1test"/>
<javac srcdir="./src" destdir="./${build}/sha1test" optimize="on" debug="on" source="1.7" includeantruntime="off">
<include name="gnu/**/*.java"/>
<include name="freenet/support/HexUtil"/>
<include name="Sha1Test.java"/>
</javac>
<jar jarfile="./res/bin/sha1test.jar" basedir="./${build}/sha1test">
<manifest>
<attribute name="Main-Class" value="Sha1Test"/>
</manifest>
</jar>
</target>
<target name="compile_browser">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/browser"/>
<javac srcdir="./src" destdir="./${build}/browser" optimize="on" debug="on" source="1.7" includeantruntime="off">
<include name="BareBonesBrowserLaunch.java"/>
</javac>
<jar jarfile="./res/bin/browser.jar" basedir="./${build}/browser">
<manifest>
<attribute name="Main-Class" value="BareBonesBrowserLaunch"/>
</manifest>
</jar>
</target>
<target name="compile_uncompress">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/uncompress"/>
<javac srcdir="./src" destdir="./${build}/uncompress" optimize="on" debug="on" source="1.7" includeantruntime="off">
<include name="Uncompress.java"/>
</javac>
<jar jarfile="./res/bin/uncompress.jar" basedir="./${build}/uncompress">
<manifest>
<attribute name="Main-Class" value="Uncompress$Test"/>
</manifest>
</jar>
</target>
<target name="compile_bindtest">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}/bindtest"/>
<javac srcdir="./src" destdir="./${build}/bindtest" optimize="on" debug="on" source="1.7" includeantruntime="off">
<include name="BindTest.java"/>
</javac>
<jar jarfile="./res/bin/bindtest.jar" basedir="./${build}/bindtest">
<manifest>
<attribute name="Main-Class" value="BindTest"/>
</manifest>
</jar>
</target>
</project>