-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
263 lines (223 loc) · 11.5 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
<project name="mozilla-extension" default="umo">
<property file="extension.properties"/>
<xmlproperty file="extension.xml" semanticAttributes="true" />
<property name="dist.dir" value="dist"/>
<property name="bin.dist.dir" value="${dist.dir}/bin"/>
<property name="src.dist.dir" value="${dist.dir}/src"/>
<property name="tmp.dir" value="tmp"/>
<property name="src.dir" value="src"/>
<property name="src.main.dir" value="${src.dir}/main"/>
<property name="src.install.dir" value="${src.dir}/install"/>
<property name="src.update.dir" value="${src.dir}/update"/>
<property name="jar.name" value="${extension.name}.jar"/>
<property name="dist.name" value="${extension.name}-${extension.version}"/>
<property name="site.src.dir" value="sourceforge.site"/>
<property name="site.dist.dir" value="${tmp.dir}"/>
<property name="replacement.output.dir" value="${tmp.dir}/${extension.name}/install"/>
<property name="migrate.exclude.files" value="profile/** tmp/** svn/** dist/**" />
<property name="style.dir" value="xsl/install" />
<target name="bin-dist" depends="jar, apply-replacement" description="Build distribution XPI">
<mkdir dir="${bin.dist.dir}" />
<zip destfile="${bin.dist.dir}/${dist.name}.xpi">
<zipfileset dir="${tmp.dir}/${extension.name}/main" includes="${jar.name}" prefix="chrome"/>
<zipfileset dir="${tmp.dir}/${extension.name}/install"/>
</zip>
</target>
<target name="umo" description="Build distribution XPI for UMO (leave updateURL blank) and dafizilla">
<delete dir="${tmp.dir}/${extension.name}"/>
<antcall target="bin-dist">
<param name="generate.updateurl" value="true"/>
</antcall>
<antcall target="sign-update-rdf" />
<copy todir="${website.dest.dir}" file="${bin.dist.dir}/${dist.name}.xpi" />
<antcall target="bin-dist">
<param name="bin.dist.dir" value="${bin.dist.dir}/umo"/>
<param name="generate.updateurl" value=""/>
</antcall>
</target>
<target name="bin-dist-debug" description="Build debug XPI">
<mkdir dir="${bin.dist.dir}" />
<delete dir="${tmp.dir}/${extension.name}"/>
<copy todir="${tmp.dir}/${extension.name}/chrome/plainfiles">
<fileset dir="${src.main.dir}"/>
</copy>
<antcall target="apply-replacement">
<param name="use.exploded.chrome" value="true"/>
<param name="exclude-updaterdf" value="true"/>
</antcall>
<zip destfile="${bin.dist.dir}/${dist.name}-debug.xpi">
<zipfileset dir="${tmp.dir}/${extension.name}/chrome" prefix="chrome"/>
<zipfileset dir="${tmp.dir}/${extension.name}/install"/>
</zip>
</target>
<target name="apply-replacement" depends="apply-install-js, apply-install-rdf, apply-chrome-manifest, apply-prefs-js, apply-update-rdf, apply-content-rdf, apply-instruct-xml">
<!--<copy todir="${tmp.dir}/${extension.name}/install/components" failonerror="false">-->
<!-- <fileset dir="${src.dir}/components" />-->
<!--</copy>-->
<!--<copy todir="${tmp.dir}/${extension.name}/install/platform" failonerror="false">-->
<!-- <fileset dir="${src.dir}/platform" />-->
<!--</copy>-->
<copy todir="${replacement.output.dir}/defaults" failonerror="false" overwrite="true">
<fileset dir="${src.dir}/defaults" />
</copy>
<copy todir="${replacement.output.dir}/modules" failonerror="false" overwrite="true">
<fileset dir="${src.dir}/modules" />
</copy>
</target>
<target name="apply-install-js" unless="exclude.installjs">
<xslt in="extension.xml"
out="${replacement.output.dir}/install.js"
force="true"
style="${style.dir}/install.js.xsl">
<param name="generate-updateurl" expression="${generate.updateurl}"/>
<param name="use-exploded-chrome" expression="${use.exploded.chrome}"/>
</xslt>
</target>
<target name="apply-install-rdf" unless="exclude.installrdf">
<xslt in="extension.xml"
out="${replacement.output.dir}/install.rdf"
force="true"
style="${style.dir}/install.rdf.xsl">
<param name="generate-updateurl" expression="${generate.updateurl}"/>
<param name="use-exploded-chrome" expression="${use.exploded.chrome}"/>
</xslt>
</target>
<target name="apply-chrome-manifest" unless="exclude.chromemanifest">
<xslt in="extension.xml"
out="${replacement.output.dir}/chrome.manifest"
force="true"
style="${style.dir}/chrome.manifest.xsl">
<param name="generate-updateurl" expression="${generate.updateurl}"/>
<param name="use-exploded-chrome" expression="${use.exploded.chrome}"/>
</xslt>
</target>
<target name="apply-prefs-js" unless="exclude.prefsjs">
<xslt in="extension.xml"
out="${replacement.output.dir}/defaults/preferences/${extension.prefs.pref}"
force="true"
style="${style.dir}/defaults/preferences/prefs.js.xsl">
<param name="generate-updateurl" expression="${generate.updateurl}"/>
<param name="use-exploded-chrome" expression="${use.exploded.chrome}"/>
</xslt>
</target>
<target name="apply-update-rdf" unless="exclude.updaterdf">
<xslt in="extension.xml"
out="${tmp.dir}/update/update.rdf"
force="true"
style="${style.dir}/../update/update.rdf.xsl">
<param name="generate-updateurl" expression="${generate.updateurl}"/>
<param name="use-exploded-chrome" expression="${use.exploded.chrome}"/>
</xslt>
</target>
<target name="apply-content-rdf" unless="exclude.contentrdf">
<xslt in="extension.xml"
out="src/main/content/${extension.chrome-extension-directory}/contents.rdf"
force="true"
style="${style.dir}/contents.rdf.xsl">
<param name="generate-updateurl" expression="${generate.updateurl}"/>
<param name="use-exploded-chrome" expression="${use.exploded.chrome}"/>
</xslt>
</target>
<target name="apply-instruct-xml" unless="exclude.instructxml">
<xslt in="extension.xml"
out="${tmp.dir}/instruct.xml"
force="true"
style="${style.dir}/../ohloh/instruct.xsl">
<param name="generate-updateurl" expression="${generate.updateurl}"/>
<param name="use-exploded-chrome" expression="${use.exploded.chrome}"/>
</xslt>
</target>
<target name="jar">
<mkdir dir="${tmp.dir}/${extension.name}/main"/>
<!-- Generates a locale path list containing the 'all files' pattern '/**'
(ie 'it-IT' became 'it-IT/**') -->
<script language="javascript">
propname = project.getProperty("extension.locales.locale.code");
project.setNewProperty("locales", propname.replace(",", "/**,") + "/**");
</script>
<!-- Include only locales specified in config file -->
<copy todir="${tmp.dir}/${extension.name}/jarfiles">
<fileset dir="${src.main.dir}" excludes="locale/**" />
</copy>
<copy todir="${tmp.dir}/${extension.name}/jarfiles/locale">
<fileset dir="${src.main.dir}/locale/" includes="${locales}" />
</copy>
<zip destfile="${tmp.dir}/${extension.name}/main/${jar.name}" basedir="${tmp.dir}/${extension.name}/jarfiles" compress="false"/>
</target>
<target name="sign-update-rdf" description="Sign the update.rdf using spock">
<exec executable="${spock.executable}">
<arg value="${src.update.rdf.path}"/>
<arg value="${mccoy.path}"/>
<arg value="${extension.uuid}"/>
<arg value="${extension.version}"/>
<arg value="${dest.update.rdf.path}"/>
<arg value="${bin.dist.dir}/${dist.name}.xpi"/>
</exec>
</target>
<target name="sign-update-rdf-no-good" description="Sign the update.rdf">
<exec executable="${sign-update.executable}">
<arg value="${src.update.rdf.path}"/>
<arg value="${mccoy.path}"/>
<arg value="${extension.uuid}"/>
<arg value="${extension.version}"/>
<arg value="${dest.update.rdf.path}"/>
<arg value="${bin.dist.dir}/${dist.name}.xpi"/>
<arg value="${extension.updateLink}"/>
</exec>
</target>
<target name="clean" description="Clean dist and tmp" >
<delete dir="${dist.dir}"/>
<delete dir="${tmp.dir}"/>
</target>
<target name="rebuild" depends="clean,bin-dist" description="Clean and build dist"/>
<target name="migrate" description="Migrate to new directory">
<input
message="Migration version"
addproperty="migrate.version"
/>
<condition property="do.abort">
<equals arg1="" arg2="${migrate.version}"/>
</condition>
<fail if="do.abort">Invalid version</fail>
<property name="migrate.dir" value="../${extension.name}-${migrate.version}" />
<copy todir="${migrate.dir}">
<fileset dir="." excludes="${migrate.exclude.files}" />
</copy>
<copy tofile="${migrate.dir}/extension.properties" overwrite="true">
<fileset file="extension.properties" />
<filterset begintoken="version" endtoken="${extension.version}">
<filter token="=" value="version=${migrate.version}"/>
</filterset>
</copy>
<mkdir dir="${migrate.dir}/profile" />
</target>
<target name="upload" depends="bin-dist, upload-ohloh, upload-sfnet" description="Upload to web sites host application"/>
<target name="upload-sfnet" if="upload.sfnet">
<echo message="Uploading ${dist.name}.xpi to frs.sourceforge.net" />
<!-- If sfnet.directory is not defined then set it to extension.name -->
<condition property="sfnet.directory" value="${extension.name}">
<not>
<isset property="${sfnet.directory}"/>
</not>
</condition>
<!-- Get file from ${website.dest.dir} to be sure it contains update url -->
<exec executable="rsync">
<arg value="-e"/>
<arg value="ssh"/>
<arg value="${website.dest.dir}/${dist.name}.xpi"/>
<arg value="dafi,[email protected]:/home/frs/project/d/da/dafizilla/${sfnet.directory}/v${extension.version}/"/>
</exec>
</target>
<target name="upload-ohloh" if="upload.ohloh">
<echo message="Uploading ${dist.name}.xpi to upload.ohloh.net" />
<exec executable="scp">
<arg value="${website.dest.dir}/${dist.name}.xpi"/>
<arg value="[email protected]:${extension.ohloh-project-name}/files"/>
</exec>
<echo message="Uploading instruct.xml to upload.ohloh.net" />
<exec executable="scp">
<arg value="${tmp.dir}/instruct.xml"/>
<arg value="[email protected]:${extension.ohloh-project-name}/instructs"/>
</exec>
</target>
</project>