-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
420 lines (366 loc) · 18.7 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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See harness/README in the NetBeans platform -->
<!-- for some information on what you could do (e.g. targets to override). -->
<!-- If you delete this file and reopen the project it will be recreated. -->
<project name="visage" basedir="." default="default-build">
<description>Builds the module suite visage.</description>
<available file="../nbbuild/netbeans/harness" type="dir" property="harness.dir.default" value="${basedir}/../nbbuild/netbeans/harness"/>
<import file="nbproject/build-impl.xml"/>
<property name="jarpack-task.jar" value="${basedir}/pack200task.jar"/>
<target name="jarpack-tasks">
<taskdef name="pack200"
classname="com.sun.tools.apache.ant.pack200.Pack200Task"
classpath="${jarpack-task.jar}" />
<taskdef name="unpack200"
classname="com.sun.tools.apache.ant.pack200.Unpack200Task"
classpath="${jarpack-task.jar}" />
</target>
<property name="nbroot" location="."/>
<property name="onlycurrplat" value="false"/>
<!-- Determine current OS -->
<condition property="isWin">
<or>
<isfalse value="${onlycurrplat}"/>
<os family="windows"/>
</or>
</condition>
<condition property="isLin">
<or>
<isfalse value="${onlycurrplat}"/>
<and>
<os family="unix"/>
<os name="Linux"/>
</and>
</or>
</condition>
<condition property="isMacOSX">
<or>
<isfalse value="${onlycurrplat}"/>
<os family="mac"/>
</or>
</condition>
<condition property="isSol">
<or>
<isfalse value="${onlycurrplat}"/>
<and>
<os family="unix"/>
<os name="Solaris"/>
</and>
</or>
</condition>
<target name="-is-local-netbeans" depends="-init-build-properties">
<available file="../nbbuild/netbeans" type="dir" property="local-netbeans-is-available"/>
</target>
<target name="-copy-local-netbeans" if="local-netbeans-is-available" depends="-is-local-netbeans">
<mkdir dir="build/netbeans"/>
<copy todir="build/netbeans">
<fileset dir="../nbbuild/netbeans"/>
</copy>
<property name="netbeans.binaries.url" value="do not need to calculate"/>
</target>
<target name="-calculate-netbeans-url" unless="netbeans.binaries.url" depends="-copy-local-netbeans">
<echo message="Calculating Netbeans URL" />
<get src="${netbeans.base.url}" dest="netbeans.html" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
<loadfile srcfile="netbeans.html" property="netbeans.binaries.url">
<filterchain>
<tokenfilter>
<containsregex pattern=".*href="(netbeans-[a-z0-9-.]*javase\.zip)".*" replace="${netbeans.base.url}/\1" flags="im"/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="netbeans.html" property="netbeans.testdist.url">
<filterchain>
<tokenfilter>
<containsregex pattern=".*href="(testdist[a-z0-9-]*\.zip)".*" replace="${netbeans.base.url}/\1" flags="im"/>
</tokenfilter>
</filterchain>
</loadfile>
<echo message="netbeans.binaries.url resolved to ${netbeans.binaries.url}"/>
<echo message="netbeans.testdist.url resolved to ${netbeans.testdist.url}"/>
</target>
<target name="-check-ergonomics">
<condition property="no.ergonomics">
<or>
<istrue value="${local-netbeans-is-available}"/>
<isfalse value="${with.ergonomics}"/>
</or>
</condition>
</target>
<target name="-calculate-ergonomics-url" unless="ergonomics.binaries.url">
<get src="${netbeans.base.url}/moduleclusters" dest="moduleclusters.html" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
<loadfile srcfile="moduleclusters.html" property="ergonomics.binaries.url">
<filterchain>
<tokenfilter>
<containsregex pattern=".*href="(netbeans-[a-z0-9-.]*ergonomics\.zip)".*" replace="${netbeans.base.url}/moduleclusters/\1" flags="im"/>
</tokenfilter>
</filterchain>
</loadfile>
<echo>ergonomics.binaries.url resolved to ${ergonomics.binaries.url}</echo>
</target>
<target name="-get-ergonomics-url" unless="no.ergonomics" depends="-calculate-ergonomics-url"/>
<target name="get-ergonomics" unless="no.ergonomics" depends="-check-ergonomics,-get-ergonomics-url">
<get src="${ergonomics.binaries.url}" dest="ergonomics.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
<unzip src="ergonomics.zip" dest="builpre-buid/netbeans"/>
</target>
<target name="get-netbeans" unless="local-netbeans-is-available" depends="jarpack-tasks,-calculate-netbeans-url">
<parallel failonany="true">
<sequential>
<!-- <get src="${netbeans.binaries.url}" dest="netbeans.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}" maxtime="0"/>-->
<unzip src="netbeans.zip" dest="build"/>
</sequential>
<sequential>
<!-- <get src="${netbeans.testdist.url}" dest="testdist.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>-->
<unzip src="testdist.zip" dest="build/testdist"/>
</sequential>
<sequential>
<!-- TODO: get visage.zip -->
<!-- <get src="${visage.binaries.url}" dest="visage.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/> -->
<unzip src="visage.zip" dest="build/netbeans/visage/visage-sdk"/>
</sequential>
<sequential>
<get src="${pack200task.jar}" dest="pack200task.jar" usetimestamp="{use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
<get src="${junit4-nbm}" dest="onl-junit4.nbm" usetimestamp="{use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
<unzip src="onl-junit4.nbm" dest="build/tmp"/>
<copy todir="build/netbeans/platform">
<fileset dir="build/tmp/netbeans"/>
</copy>
<copy file="junit-4.8.2.jar" todir="build/netbeans/platform/modules/ext" />
<unpack200 src="build/netbeans/platform/modules/org-netbeans-libs-junit4.jar.pack.gz" dest="build/netbeans/platform/modules/org-netbeans-libs-junit4.jar" />
<delete dir="build/tmp"/>
<!-- <get src="${ant-nbm}" dest="onl-nbi-ant.nbm" usetimestamp="{use.timestamp}" verbose="true" ignoreerrors="${offline}"/>-->
<unzip src="onl-nbi-ant.nbm" dest="build/tmp"/>
<copy todir="build/netbeans/harness">
<fileset dir="build/tmp/netbeans"/>
</copy>
</sequential>
</parallel>
<antcall target="get-ergonomics"/>
</target>
<target name="get-sdk-win" if="isWin">
<mkdir dir="visage.sdk.win/external"/>
<get src="${visage-sdk.win.url}" dest="visage.sdk.win/external/visage_sdk.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
</target>
<target name="get-sdk-mac" if="isMacOSX">
<mkdir dir="visage.sdk.mac/external"/>
<get src="${visage-sdk.mac.url}" dest="visage.sdk.mac/external/visage_sdk.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
</target>
<target name="get-sdk-lin" if="isLin">
<mkdir dir="visage.sdk.lin/external"/>
<get src="${visage-sdk.lin.url}" dest="visage.sdk.lin/external/visage_sdk.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
</target>
<target name="get-sdk-sol" if="isSol">
<mkdir dir="visage.sdk.sol/external"/>
<get src="${visage-sdk.sol.url}" dest="visage.sdk.sol/external/visage_sdk.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
</target>
<target name="files-init" depends="-release.files,-pre-build"/>
<target name="update-harness" depends="-init-build-properties">
<get src="${netbeans.base.url}/moduleclusters" dest="netbeans.html" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
<loadfile srcfile="netbeans.html" property="netbeans.harness.url">
<filterchain>
<tokenfilter>
<containsregex pattern=".*href="(netbeans-[a-z0-9-.]*harness\.zip)".*" replace="${netbeans.base.url}/moduleclusters/\1" flags="im"/>
</tokenfilter>
</filterchain>
</loadfile>
<echo>netbeans.harness.url=${netbeans.harness.url}</echo>
<get src="${netbeans.harness.url}" dest="harness.zip" usetimestamp="${use.timestamp}" verbose="true" ignoreerrors="${offline}"/>
<fail message="harness zip was not downloaded, update harness failed">
<condition>
<not>
<available file="harness.zip"/>
</not>
</condition>
</fail>
<unzip src="harness.zip" dest="${basedir}">
<patternset>
<include name="harness/*.xml"/>
<include name="harness/*.jar"/>
<include name="harness/antlib/**"/>
<include name="harness/testcoverage/**"/>
<include name="harness/README"/>
</patternset>
</unzip>
<!--<delete file="harness.zip"/>-->
</target>
<target name="-init-build-properties">
<property name="build.config" value="promoted"/>
<property file="build-${build.config}.properties"/>
<property environment="env"/>
<condition property="catalog.base.url" value="${env.HUDSON_URL}job/${env.JOB_NAME}/${env.BUILD_NUMBER}/artifact/build/updates">
<isset property="env.HUDSON_URL"/>
</condition>
<property name="use.timestamp" value="true"/>
<property name="offline" value="false"/>
</target>
<target name="-pre-build" depends="-init-build-properties">
<delete dir="build"/>
<mkdir dir="build"/>
<parallel failonany="true">
<antcall target="get-netbeans"/>
<antcall target="get-sdk-lin" />
<!--
<antcall target="get-sdk-win" />
<antcall target="get-sdk-mac" />
<antcall target="get-sdk-sol" />
-->
</parallel>
<concat>
<filelist dir="build/netbeans/visage/visage-sdk" files="timestamp"/>
</concat>
</target>
<target name="-pre-clean">
<mkdir dir="${nbplatform.active.dir}/apisupport"/>
<mkdir dir="${nbplatform.active.dir}/harness"/>
<mkdir dir="${nbplatform.active.dir}/ide"/>
<mkdir dir="${nbplatform.active.dir}/java"/>
<mkdir dir="${nbplatform.active.dir}/nb"/>
<mkdir dir="${nbplatform.active.dir}/platform"/>
<mkdir dir="${nbplatform.active.dir}/profiler"/>
<mkdir dir="${nbplatform.active.dir}/websvccommon"/>
</target>
<target name="clean" depends="-init,testuserdir-delete,-pre-clean" description="Clean everything.">
<delete dir="${dist.dir}"/>
<delete failonerror="false" includeemptydirs="true">
<fileset dir="build">
<exclude name="testuserdir/"/>
</fileset>
</delete>
<mkdir dir="build/netbeans"/>
<antcall target="-pre-clean"/>
<subant target="clean" buildpath="${modules.sorted}" inheritrefs="false" inheritall="false"/>
<delete failonerror="false" includeemptydirs="true">
<fileset dir="build">
<exclude name="testuserdir/"/>
</fileset>
</delete>
</target>
<target name="l10n-kit">
<zip destfile="build/l10n.zip" basedir="." compress="true" level="9" excludesfile="l10n.excludes" includesfile="l10n.includes"/>
</target>
<target name="jar-windows" if="isWin">
<jar destfile="build/clusters/windows.jar" compress="true" level="9">
<zipfileset dir="build/netbeans/visage" prefix="visage">
<exclude name="visage-sdk/**"/>
<include name="**/*-win.*"/>
</zipfileset>
<zipfileset dir="visage.sdk.win/release" prefix="visage"/>
</jar>
</target>
<target name="jar-linux" if="isLin">
<property prefix="visagesdk.lin." file="visage.sdk.lin/nbproject/project.properties"/>
<jar destfile="build/clusters/linux.jar" compress="true" level="9">
<zipfileset dir="build/netbeans/visage" prefix="visage">
<exclude name="visage-sdk/**"/>
<include name="**/*-lin.*"/>
</zipfileset>
<zipfileset dir="visage.sdk.lin/release" filemode="755" prefix="visage" includes="${visagesdk.lin.nbm.executable.files}"/>
<zipfileset dir="visage.sdk.lin/release" prefix="visage" excludes="${visagesdk.lin.nbm.executable.files}"/>
</jar>
</target>
<target name="jar-solaris" if="isSol">
<property prefix="visagesdk.sol." file="visage.sdk.sol/nbproject/project.properties"/>
<jar destfile="build/clusters/solaris.jar" compress="true" level="9">
<zipfileset dir="build/netbeans/visage" prefix="visage">
<exclude name="visage-sdk/**"/>
<include name="**/*-sol.*"/>
</zipfileset>
<zipfileset dir="visage.sdk.sol/release" filemode="755" prefix="visage" includes="${visagesdk.sol.nbm.executable.files}"/>
<zipfileset dir="visage.sdk.sol/release" prefix="visage" excludes="${visagesdk.sol.nbm.executable.files}"/>
</jar>
</target>
<target name="jar-macosx" if="isMacOSX">
<property prefix="visagesdk.mac." file="visage.sdk.mac/nbproject/project.properties"/>
<jar destfile="build/clusters/mac.jar" compress="true" level="9">
<zipfileset dir="build/netbeans/visage" prefix="visage">
<exclude name="visage-sdk/**"/>
<include name="**/*-mac.*"/>
</zipfileset>
<zipfileset dir="visage.sdk.mac/release" filemode="755" prefix="visage" includes="${visagesdk.mac.nbm.executable.files}"/>
<zipfileset dir="visage.sdk.mac/release" prefix="visage" excludes="${visagesdk.mac.nbm.executable.files}"/>
</jar>
</target>
<target name="-init-zip-clusters" depends="-is-local-netbeans,-init-build-properties">
<condition property="do.zip.clusters">
<or>
<isset property="env.HUDSON_URL"/>
<isset property="local-netbeans-is-available"/>
</or>
</condition>
</target>
<target name="-zip-clusters" depends="-init-zip-clusters" if="do.zip.clusters">
<mkdir dir="build/clusters"/>
<jar destfile="build/clusters/common.jar" compress="true" level="9">
<zipfileset dir="build/netbeans/visage" prefix="visage">
<exclude name="visage-sdk/**"/>
<exclude name="**/*-mac.*"/>
<exclude name="**/*-sol.*"/>
<exclude name="**/*-win.*"/>
<exclude name="**/*-lin.*"/>
</zipfileset>
</jar>
<antcall target="jar-windows" />
<antcall target="jar-linux" />
<antcall target="jar-solaris" />
<antcall target="jar-macosx" />
</target>
<target name="runtests" description="Run Visage tests">
<subant buildpath="visage.editor:visage.lexer"
target="test"
inheritall="false"
inheritrefs="false">
<property name="continue.after.failing.tests" value="true"/>
</subant>
</target>
<target name="runtests-report" depends="runtests"
description="Run Visage tests and generates test report">
<!-- Collects JUnit results -->
<property name="visage.test.results" location="${nbroot}/build/test/results" />
<property name="module.results" value="build/test/unit/results/TEST-*.xml" />
<mkdir dir="${visage.test.results}"/>
<junitreport todir="${visage.test.results}">
<fileset dir="${nbroot}">
<include name="visage.editor/${module.results}"/>
<include name="visage.lexer/${module.results}"/>
</fileset>
<report format="frames" todir="${visage.test.results}"/>
</junitreport>
<echo message="Unit Test Results: ${nbroot}/build/test/results/index.html"/>
</target>
<target name="default-build" depends="clean,build,-zip-clusters"/>
<target name="full-build" depends="clean,nbms,-zip-clusters,l10n-kit"/>
<target name="build-installers" depends="full-build">
<ant dir="installer"/>
</target>
<target name="-enable-ergonomics">
<property name="with.ergonomics" value="true"/>
</target>
<target name="build-ergonomics" depends="-taskdefs">
<property name="cluster" value="build/netbeans/visage"/>
<property name="ergonomics.cluster" value="build/netbeans/ergonomics"/>
<property name="harness.dir" value="build/netbeans/harness"/>
<mkdir dir="tmp/ergonomics"/>
<property name="ergonomicsdir" location="tmp/ergonomics"/>
<property name="build.dir" location="${ergonomicsdir}/build"/>
<property name="anttasks.jar" location="${harness.dir}/tasks.jar"/>
<property name="ergonomics.jar" location="${ergonomics.cluster}/modules/org-netbeans-modules-ide-ergonomics.jar"/>
<copy file="${ergonomics.jar}" tofile="tmp/ergonomics.jar"/>
<taskdef classname="org.netbeans.modules.ide.ergonomics.ant.ExtractLayer" classpath="tmp/ergonomics.jar" name="extractlayer"/>
<delete dir="${build.dir}"/>
<unzip dest="${build.dir}" src="tmp/ergonomics.jar">
<mapper type="flatten"/>
<patternset>
<include name="**/common-ergonomics.xml"/>
</patternset>
</unzip>
<echo message="# repacked ${line.separator}" file="${build.dir}/empty"/>
<property name="cluster.properties" location="${build.dir}/empty"/>
<ant antfile="${build.dir}/common-ergonomics.xml" target="-disable-one-cluster">
<property name="xmldir" value="${ergonomics.cluster}/config/Modules/"/>
<property name="cluster.to.process" value="${cluster}"/>
</ant>
<ant antfile="${build.dir}/common-ergonomics.xml" target="-proxy-one-cluster"/>
<jar basedir="${ergonomicsdir}/build/classes" jarfile="${ergonomics.jar}" update="true" keepcompression="true"/>
<delete dir="tmp"/>
</target>
<target name="ergonomics-build" depends="-enable-ergonomics,clean,build,build-ergonomics,-zip-clusters"/>
</project>