-
Notifications
You must be signed in to change notification settings - Fork 12
/
build.xml
773 lines (694 loc) · 31.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
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
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
<project name="chickenfoot" default="build" basedir=".">
<!-- user must define firefox.properties -->
<property file="build.properties" />
<property file="firefox.properties" />
<property name="fennec.propertiesfile" value="fennec.properties" />
<property file="${fennec.propertiesfile}" />
<property name="srcdir" value="src" />
<property name="java.src.dir" value="${srcdir}/core/java" />
<property name="java.bin.dir" value="${basedir}/build/java" />
<property name="firefox.platform.dir" value="${basedir}/platform/firefox" />
<property name="fennec.platform.dir" value="${basedir}/platform/fennec" />
<property name="setup.dir" value="${srcdir}/chickenscratch/setup" />
<property name="libraries.dir" value="${srcdir}/chickenscratch/libraries" />
<property name="tests.dir" value="${srcdir}${file.separator}tests" />
<property name="core.dir" value="${srcdir}/core" />
<property name="closure.dir" value="${srcdir}/closure" />
<property name="bespin.dir" value="${srcdir}/bespin" />
<property name="firefox.ui.dir" value="${srcdir}/ui/firefox" />
<property name="fennec.ui.dir" value="${srcdir}/ui/fennec" />
<property name="locale.dir" value="${firefox.platform.dir}/locale" />
<property name="skin.dir" value="${firefox.platform.dir}/skin" />
<property name="fennec.locale.dir" value="${fennec.platform.dir}/locale" />
<property name="fennec.skin.dir" value="${fennec.platform.dir}/skin" />
<property name="html.dir" value="${basedir}${file.separator}web" />
<property name="build.dir" value="${basedir}${file.separator}build" />
<property name="jar.dir" value="${build.dir}/jar" />
<property name="xpi.dir" value="${build.dir}${file.separator}xpi" />
<property name="export.dir" value="${xpi.dir}/export" />
<property name="closure-compiler.jar" value="${basedir}/closure/compiler.jar" />
<property name="closure.outputmode" value="compiled" />
<property name="fennec.build.dir" value="${basedir}${file.separator}platform${file.separator}fennec${file.separator}build" />
<property name="fennec.xpi.dir" value="${fennec.build.dir}${file.separator}xpi" />
<property name="fennec.export.dir" value="${fennec.xpi.dir}/export" />
<property name="xpi.name" value="${ant.project.name}-${version.value}.xpi" />
<property name="source.zip.name" value="${ant.project.name}-source-${version.value}.zip" />
<property name="xpidl.dir" value="${basedir}/xpidl" />
<property name="webbuild.dir" value="${build.dir}/web" />
<property name="mccoy.dir" value="${firefox.platform.dir}/mccoy" />
<property name="mccoy.profile.dir" value="${firefox.platform.dir}/mccoy-profile" />
<property name="chickenfoot.guid" value="896b34a4-c83f-4ea7-8ef0-51ed7220ac94" />
<property name="extension.dir" value="${firefox.profile.dir}/extensions/{${chickenfoot.guid}}" />
<property name="fennec.extension.dir" value="${fennec.profile.dir}/extensions/{${chickenfoot.guid}}" />
<property name="version.pattern" value="<version/>" />
<filterset id="chickenfootMacros">
<!--
These variables are declared verbatim in chrome.manifest.
The build process needs to be fixed to have a parameterized
chrome.template.manifest a la install.template.rdf so that
exporting of Chickenfoot scripts as extensions works correctly.
-->
<filter token="CHICKENFOOT_CONTRACT_ID" value="@uid.csail.mit.edu/Chickenfoot/;1" />
<filter token="CHICKENFOOT_GUID" value="7a2ad1d0-29a8-4e2a-97bd-ad6324c0a753" />
<filter token="CHICKENFOOT_COMMAND_LINE_HANDLER_GUID" value="e2f9f917-a54e-4e9c-83c3-174fa65ecd25" />
<filter token="CHICKEN_BYPASS_GUID" value="f8940eee-2e3b-4682-a5d1-71ca80aeeeee" />
<filter token="EXTENSION_NAME" value="chickenfoot" />
<filter token="IS_EXPORTED_XPI" value="false" />
<filter token="GUID" value="${chickenfoot.guid}" />
</filterset>
<target name="build"
depends="xpi"
description="Builds the extension." />
<target name="install"
depends="xpi"
description="Installs XPI file in Firefox.">
<fail>
<condition>
<not>
<available file="${basedir}/firefox.properties" />
</not>
</condition>
.
The install target requies you to create
firefox.properties. Use firefox-default.properties
as a template, and customize it for your Firefox installation.
</fail>
<exec executable="${firefox.dir}${firefox.executable}">
<env key="MOZ_NO_REMOTE" value="1"/>
<arg value="-P" />
<arg value="${firefox.profile}" />
<arg value="file://${build.dir}/${xpi.name}" />
</exec>
</target>
<target name="run"
depends="install,run-chickenfoot-profile"
description="Runs Firefox after installing the XPI file.">
</target>
<!--
The run-debug-no-install target is just like the
run-no-install target, except that it also runs unjar-chrome. The
biggest issue with this is that time is wasted zipping up and then
unzipping the jar file, when it should ideally never be created in
the first place.
-->
<target name="run-debug-no-install"
depends="xpi-dir,unjar-chrome,point-firefox-to-xpi-dir,run-chickenfoot-profile"
description="Runs Firefox by pointing it directly at build/xpi. Chrome directory is not jarred.">
</target>
<target name="run-no-install"
depends="xpi-dir,point-firefox-to-xpi-dir,run-chickenfoot-profile"
description="Runs Firefox by pointing it directly at build/xpi.">
</target>
<target name="run-tests-no-install"
depends="xpi-dir,point-firefox-to-xpi-dir,run-tests-chickenfoot-profile,check-test-results"
description="Runs test suite in the style of run-no-install.">
</target>
<target name="run-tests-release"
depends="create-new-firefox-profile"
description="Runs test suite on the release XPI file.">
<antcall inheritall="false">
<param name="new.firefox.profile" value="${new.firefox.profile}" />
<param name="new.firefox.profile.dir" value="${new.firefox.profile.dir}" />
<param name="firefox.profile" value="${new.firefox.profile}" />
<param name="firefox.profile.dir" value="${new.firefox.profile.dir}" />
<target name="download-and-install-release" />
<target name="run-tests-chickenfoot-profile" />
<target name="delete-new-firefox-profile" />
<target name="check-test-results" />
</antcall>
</target>
<target name="download-and-install-release">
<fail unless="firefox.profile">
.
The download-and-install-release target requires a Firefox profile.
</fail>
<tempfile property="release.xpi" prefix="chickenfoot" suffix=".xpi" />
<get src="http://groups.csail.mit.edu/uid/chickenfoot/chickenfoot.xpi"
dest="${release.xpi}" />
<echo>
Firefox is running and will prompt you to install the extension.
Please: 1. Click Install
2. Quit Firefox when installation is complete
</echo>
<exec executable="${firefox.dir}${firefox.executable}">
<env key="MOZ_NO_REMOTE" value="1"/>
<arg value="-P" />
<arg value="${firefox.profile}" />
<arg value="file://${release.xpi}" />
</exec>
<delete file="${release.xpi}" />
</target>
<target name="create-new-firefox-profile">
<fail unless="firefox-properties-has-profile-dir">
.
Creating a new Firefox profile requires you to fill in
firefox.properties, even though the profile referenced
there will not be used.
</fail>
<pathconvert property="firefox.profiles-ini">
<path>
<fileset dir="${firefox.profile.dir}${file.separator}..${file.separator}..">
<include name="**/profiles.ini" />
</fileset>
</path>
</pathconvert>
<copy file="${firefox.profiles-ini}" tofile="${firefox.profiles-ini}.bak" />
<tstamp>
<format property="new.firefox.profile.time" pattern="yyyyMMdd-HHmmss" />
</tstamp>
<property name="new.firefox.profile"
value="chickenfoot-temp-${new.firefox.profile.time}" />
<tempfile property="new.firefox.profile.dir" destdir="${firefox.profile.dir}${file.separator}.." />
<exec executable="${firefox.dir}${firefox.executable}">
<env key="MOZ_NO_REMOTE" value="1" />
<arg value="-CreateProfile" />
<arg value="${new.firefox.profile} ${new.firefox.profile.dir}" />
</exec>
</target>
<target name="delete-new-firefox-profile">
<fail unless="new.firefox.profile.dir">
.
No new Firefox profile to delete.
</fail>
<pathconvert property="firefox.profiles-ini">
<path>
<fileset dir="${firefox.profile.dir}${file.separator}..${file.separator}..">
<include name="**/profiles.ini" />
</fileset>
</path>
</pathconvert>
<move file="${firefox.profiles-ini}.bak" tofile="${firefox.profiles-ini}" />
<delete dir="${new.firefox.profile.dir}" />
</target>
<condition property="firefox-already-points-to-xpi-dir">
<available file="${extension.dir}" type="file"/>
</condition>
<target name="point-firefox-to-xpi-dir"
unless="firefox-already-points-to-xpi-dir">
<echo message="Deleting old Chickenfoot and redirecting it to ${xpi.dir}"/>
<delete dir="${extension.dir}"/>
<echo message="${xpi.dir}" file="${extension.dir}"/>
</target>
<condition property="firefox-properties-has-profile-dir">
<and>
<available file="${basedir}/firefox.properties" />
<isset property="firefox.profile.dir" />
</and>
</condition>
<target name="run-chickenfoot-profile">
<fail unless="firefox-properties-has-profile-dir">
.
The run-no-install target requies you to create
firefox.properties. Use firefox-default.properties
as a template, and customize it for your Firefox installation.
</fail>
<exec executable="${firefox.dir}${firefox.executable}">
<env key="MOZ_NO_REMOTE" value="1"/>
<arg value="-P" />
<arg value="${firefox.profile}" />
</exec>
</target>
<target name="run-tests-chickenfoot-profile">
<fail unless="firefox-properties-has-profile-dir">
.
This testing target requies firefox.properties.
</fail>
<tempfile property="tests.output" prefix="tests.output" suffix=".txt" />
<exec executable="${firefox.dir}${firefox.executable}">
<env key="MOZ_NO_REMOTE" value="1"/>
<arg value="-P" />
<arg value="${firefox.profile}" />
<arg value="-cf-run" />
<arg value="${tests.dir}${file.separator}allTestsCfRunner.js" />
<arg value="${tests.dir}${file.separator}allTests.js" />
<arg value="${tests.output}" />
</exec>
</target>
<target name="check-test-results">
<fail>
<condition><not><available file="${tests.output}" /></not></condition>
.
Tests did not run.
</fail>
<loadfile property="tests.result" srcfile="${tests.output}" />
<condition property="tests.failure">
<!-- contains string="${tests.result}" substring="FAIL" / -->
<!-- use isfileselected instead in case we want fancier conditions -->
<isfileselected file="${tests.output}">
<or>
<contains text="FAIL" />
<not><contains text="succeeded" /></not>
</or>
</isfileselected>
</condition>
<delete file="${tests.output}" />
<echo level="info">
.
${tests.result}
</echo>
<fail if="tests.failure">
.
One or more tests FAILED, or the tests did not run.
Please review the test output above.
</fail>
</target>
<target name="clean"
description="Removes all generated files.">
<delete dir="${build.dir}" />
</target>
<target name="clean-lite"
description="Removes all generated files except Java classes and jars.">
<delete dir="${jar.dir}" />
<delete includeemptydirs="true">
<fileset dir="${xpi.dir}" excludes="java/${ant.project.name}-java.jar" />
</delete>
<delete file="${build.dir}/${ant.project.name}.xpi" />
</target>
<target name="java"
description="Compiles the Chickenfoot Java code.">
<mkdir dir="${java.bin.dir}" />
<javac srcdir="${java.src.dir}"
destdir="${java.bin.dir}"
target="1.5"
source="1.5">
</javac>
<mkdir dir="${xpi.dir}" />
<mkdir dir="${xpi.dir}/java" />
<jar destfile="${xpi.dir}/java/${ant.project.name}-java.jar" update="true">
<fileset dir="${java.bin.dir}" />
</jar>
</target>
<target name="closure">
<mkdir dir="${build.dir}" />
<exec executable="python"
failonerror="true">
<arg value="${closure.dir}/calcdeps.py" />
<arg line="--input=${closure.dir}/all-includes.js" />
<arg line="--input=${closure.dir}/closure-version.js" />
<arg line="--path=${closure.dir}/goog" />
<arg line="--output_mode=script" />
<arg line='--output_file="${build.dir}/closure.js"' />
</exec>
</target>
<target name="jar"
depends="closure"
description="Creates a JAR of the resources for the extension.">
<!-- setup -->
<mkdir dir="${build.dir}" />
<mkdir dir="${jar.dir}" />
<!-- content folder -->
<mkdir dir="${jar.dir}/content" />
<closure-compile outputfile="${jar.dir}/content/sidebar.js">
<extrapaths>
<arg line='-p "${basedir}/src/closure/goog"' />
<arg line='-i "${firefox.ui.dir}"' />
<arg line='-e "${firefox.ui.dir}/chickenscratch.js"' />
<arg line='-i "${core.dir}/util/instanceof.js"' />
<arg line='-i "${core.dir}/dom/treeWalker.js"' />
<arg line='-i "${core.dir}/firefox/SidebarState.js"' />
<arg line='-i "${core.dir}/packager/xpi-tie.js"' />
</extrapaths>
</closure-compile>
<copy todir="${jar.dir}/content" overwrite="true">
<fileset dir="${firefox.ui.dir}"
includes="*.xul,*.html,chickenscratch.js" />
<filterset refid="chickenfootMacros" />
</copy>
<mkdir dir="${jar.dir}/content/bespin" />
<copy file="${bespin.dir}/BespinEmbedded.css"
tofile="${jar.dir}/content/bespin/BespinEmbedded.css"
overwrite="true" />
<closure-compile
outputfile="${jar.dir}/content/bespin/BespinEmbedded.js">
<!-- Unfortunately, calcdeps.py insists on including closure/base.js -->
<extrapaths>
<arg line='-p "${closure.dir}"' />
<arg line='-i "${bespin.dir}/BespinEmbedded.js"' />
</extrapaths>
</closure-compile>
<!-- libraries folder -->
<mkdir dir="${jar.dir}/content/libraries" />
<copy todir="${jar.dir}/content/libraries" overwrite="true">
<fileset dir="${libraries.dir}" />
</copy>
<copy file="${build.dir}/closure.js"
tofile="${jar.dir}/content/libraries/closure-lite.js"
overwrite="true" />
<!-- skin folder -->
<mkdir dir="${jar.dir}/skin" />
<copy todir="${jar.dir}/skin" overwrite="true">
<fileset dir="${skin.dir}" />
</copy>
<!-- locale folder -->
<mkdir dir="${jar.dir}/locale" />
<copy todir="${jar.dir}/locale" overwrite="true">
<fileset dir="${locale.dir}" />
</copy>
<!-- create the JAR -->
<mkdir dir="${xpi.dir}" />
<mkdir dir="${xpi.dir}/chrome" />
<jar basedir="${jar.dir}"
destfile="${xpi.dir}/chrome/${ant.project.name}.jar"
update="true" />
</target>
<macrodef name="closure-compile">
<attribute name="outputfile" />
<attribute name="compilationlevel" default="SIMPLE_OPTIMIZATIONS" />
<attribute name="outputmode" default="${closure.outputmode}" />
<element name="extraflags" optional="yes" />
<element name="extrapaths" optional="yes" />
<element name="debuginfo" optional="yes" />
<sequential>
<exec executable="python" failonerror="true" logError="true">
<arg value="${closure.dir}/calcdeps.py" />
<arg line='--output_file="@{outputfile}"' />
<extrapaths />
<arg line="-o @{outputmode}" />
<arg line='-c "${closure-compiler.jar}"' />
<arg line='-f "--compilation_level=@{compilationlevel}"' />
<extraflags />
</exec>
</sequential>
</macrodef>
<target name="chickenfoot_xpcom_component">
<mkdir dir="${export.dir}" />
<closure-compile outputfile="${export.dir}/Chickenfoot.js"
compilationlevel="SIMPLE_OPTIMIZATIONS"
outputmode="${closure.outputmode}">
<extrapaths>
<!-- TODO(mbolin): Remove unnecessary includes from this list. -->
<!-- Ideally, goog.provide and goog.require would be used -->
<!-- everywhere and then calcdeps.py would do the right thing. -->
<arg line='-p "${basedir}/src/closure/goog"' />
<arg line='-i "${core.dir}/commands"' />
<arg line='-i "${core.dir}/dom"' />
<arg line='-i "${core.dir}/java"' />
<arg line='-i "${core.dir}/packager"' />
<arg line='-i "${core.dir}/patterns"' />
<arg line='-i "${core.dir}/recorder"' />
<arg line='-i "${core.dir}/triggers"' />
<arg line='-i "${core.dir}/util"' />
<arg line='-i "${core.dir}/firefox"' />
<arg line='-e "${core.dir}/firefox/Chicken-bypass.js"' />
<arg line='-e "${core.dir}/firefox/ChickenfootCommandLineHandler.js"'
/>
<arg line='-i "${firefox.ui.dir}/Buffer.js"' />
<arg line='-e "${core.dir}/packager/xpi-tie/"' />
</extrapaths>
<debuginfo><![CDATA[
Note: This special section was created to work around escaping issues in
traditional XML comments. It is not a true input to <closure-compile>.
When debugging Chickenfoot.js, it may be helpful to remove the
minification provided by the compiler. One thing that will help is
changing the compilationlevel to WHITESPACE_ONLY.
Another tip is to use the formatting options provided by the Compiler by
adding an <extraflags> element:
<extraflags>
<arg line='-f "--formatting=PRETTY_PRINT"' />
</extraflags>
To see the list of files (in order) that are being passed to the
Closure Compiler, change the value of the outputmode attribute to
"list" and the list of files will be written to Chickenfoot.js instead
of the code.
]]></debuginfo>
</closure-compile>
</target>
<target name="xpi-dir"
depends="java, jar, closure, chickenfoot_xpcom_component"
description="Generates the build/xpi directory.">
<!-- components folder (XPCOM) -->
<mkdir dir="${xpi.dir}" />
<mkdir dir="${xpi.dir}/components" />
<copy todir="${export.dir}" overwrite="true">
<fileset dir="${core.dir}/firefox">
<include name="Chicken-bypass.js"/>
<include name="ChickenfootCommandLineHandler.js"/>
</fileset>
</copy>
<copy todir="${xpi.dir}/components/" overwrite="true">
<fileset dir="${export.dir}">
<include name="Chickenfoot.js" />
<include name="Chicken-bypass.js"/>
<include name="ChickenfootCommandLineHandler.js"/>
</fileset>
<filterset refid="chickenfootMacros" />
</copy>
<!-- export folder -->
<mkdir dir="${export.dir}" />
<copy todir="${export.dir}" overwrite="true">
<fileset dir="${srcdir}/core/packager/xpi-tie" />
<fileset dir="${firefox.ui.dir}">
<include name="chickenscratch.xul" />
<include name="chickenscratch.js" />
</fileset>
</copy>
<!-- libraries folder -->
<copy todir="${xpi.dir}/libraries" overwrite="true">
<fileset dir="${libraries.dir}" />
</copy>
<copy file="${build.dir}/closure.js"
tofile="${xpi.dir}/libraries/closure-lite.js"
overwrite="true" />
<!-- setup folder -->
<mkdir dir="${xpi.dir}/setup" />
<copy todir="${xpi.dir}/setup" overwrite="true">
<fileset dir="${setup.dir}" />
</copy>
<!-- chrome manifest -->
<copy todir="${xpi.dir}" overwrite="true">
<fileset dir="${firefox.platform.dir}"
includes="chrome.manifest" />
<filterset refid="chickenfootMacros" />
</copy>
<!-- copy install.rdf file, filling in version number -->
<copy file="${firefox.platform.dir}/install.template.rdf"
tofile="${xpi.dir}/install.rdf"
overwrite="true" />
<replaceregexp match="${version.pattern}"
flags="g"
replace="${version.value}" >
<fileset dir="${xpi.dir}">
<include name="install.rdf" />
</fileset>
</replaceregexp>
</target>
<!--
The unjar-chrome target will unzip the previously created chickenfoot.jar
file, and modify the manifest file to use the expanded directories rather
than the jar file. This allows us to modify the .js and .xul files and
see the results simply by closing and re-opening the sidebar, or at worst
by restarting the browser. This is a lot better than doing a new build
whenever you want to try a simple change!
-->
<target name="unjar-chrome">
<unzip src="${xpi.dir}/chrome/${ant.project.name}.jar" dest="${xpi.dir}/chrome/" />
<replaceregexp file="${xpi.dir}/chrome.manifest"
match="jar:|chickenfoot.jar!/"
replace=""
flags="g" />
</target>
<target name="xpi"
depends="xpi-dir"
description="Generates the XPI file.">
<!-- create XPI -->
<zip basedir="${xpi.dir}"
destfile="${build.dir}/${xpi.name}"
update="true" />
</target>
<target name="zip"
description="Packages the project as a zip file.">
<mkdir dir="${build.dir}" />
<zip destfile="${build.dir}/${source.zip.name}">
<zipfileset prefix="${ant.project.name}-${version.value}"
dir="${basedir}"
>
<!-- must use build literally because ${build.dir} fails for some reason -->
<exclude name="build/**" />
<exclude name="web/**" />
<exclude name="${mccoy.dir}/**" />
<exclude name="${mccoy.profile.dir}/**" />
</zipfileset>
</zip>
</target>
<target name="release"
depends="build,zip"
description="Builds the HTML component of the website.">
<!-- add the latest XPI to the releases dir -->
<copy todir="${html.dir}/releases" overwrite="true">
<fileset file="${build.dir}/${xpi.name}"/>
<fileset file="${build.dir}/${source.zip.name}"/>
</copy>
<!-- include images from XUL, some of which are handy -->
<copy todir="${html.dir}/images" overwrite="true">
<fileset dir="${skin.dir}/classic">
<include name="*.png"/>
<include name="*.gif"/>
<include name="*.jpg"/>
</fileset>
</copy>
<!-- create a libraries directory -->
<copy todir="${html.dir}/libraries" overwrite="true">
<fileset dir="${libraries.dir}" />
</copy>
<!-- copy update.rdf file, filling in version number -->
<copy file="${firefox.platform.dir}/update.template.rdf"
tofile="${html.dir}/update.rdf"
overwrite="true" />
<replaceregexp match="${version.pattern}"
flags="g"
replace="${version.value}" >
<fileset dir="${html.dir}">
<include name="update.rdf" />
</fileset>
</replaceregexp>
<!-- sign update.rdf file using McCoy -->
<copy todir="${firefox.profile.dir}${file.separator}..${file.separator}..${file.separator}..${file.separator}McCoy"
overwrite="true">
<fileset dir="${mccoy.profile.dir}" />
</copy>
<exec executable="${mccoy.dir}/mccoy">
<arg value="-command"/>
<arg value="update"/>
<arg value="-updateRDF"/>
<arg value="${html.dir}${file.separator}update.rdf"/>
<arg value="-key"/>
<arg value="chickenfoot"/>
<arg value="-xpi"/>
<arg value="${html.dir}${file.separator}releases${file.separator}${xpi.name}"/>
</exec>
</target>
<target name="update-rss-feed"
description="Updates RSS feed on the Chickenfoot home page">
<!-- update new-release RSS feed from blog -->
<echo message="Fetching new-release RSS feed from blog..."/>
<exec executable="wget">
<arg value="http://groups.csail.mit.edu/uid/chickenfoot/blog/feed?category=New+Release" />
<arg value="-O" />
<arg value="${html.dir}/release-notes.xml" />
</exec>
</target>
<target name="download-stats"
description="Displays download statistics for Chickenfoot."
>
<exec executable="ssh">
<arg value="pink-panther.csail.mit.edu" />
<arg value="cd /var/log/apache ; echo -n 'last week: '; grep -c chickenfoot.xpi groups-access.log.1 ; echo -n 'so far this week: ' ; grep -c chickenfoot.xpi groups-access.log"/>
</exec>
</target>
<!-- FENNEC BUILD RULES -->
<target name="fennec-xpi-dir"
depends="closure"
description="Generates the Fennec build/xpi directory.">
<mkdir dir="${fennec.build.dir}" />
<mkdir dir="${fennec.xpi.dir}" />
<!-- content folder -->
<mkdir dir="${fennec.xpi.dir}/content" />
<copy todir="${fennec.export.dir}" overwrite="true">
<fileset dir="${core.dir}">
<!-- <exclude name="util/accessors.js" /> -->
<exclude name="firefox/ChickenfootCommandLineHandler.js" />
<!-- <exclude name="firefox/Chickenfoot.js" /> -->
<exclude name="firefox/Chicken-bypass.js" />
<exclude name="packager/xpi-tie/*.js" />
<include name="**/*.js" />
</fileset>
<filterset refid="chickenfootMacros" />
</copy>
<concat destfile="${fennec.xpi.dir}/content/overlay.js" fixlastline="yes">
<filelist dir="${build.dir}" files="closure.js" />
<fileset dir="${fennec.ui.dir}">
<include name="*.js" />
</fileset>
</concat>
<concat destfile="${fennec.xpi.dir}/components/Chickenfoot.js" fixlastline="yes">
<filelist dir="${build.dir}" files="closure.js" />
<fileset dir="${fennec.export.dir}">
<include name="**/*.js" />
</fileset>
</concat>
<copy todir="${fennec.xpi.dir}/components" overwrite="true">
<fileset dir="${core.dir}/firefox">
<include name="Chicken-bypass.js"/>
<include name="ChickenfootCommandLineHandler.js"/>
</fileset>
<filterset refid="chickenfootMacros" />
</copy>
<copy todir="${fennec.xpi.dir}/content" overwrite="true">
<fileset dir="${fennec.ui.dir}"
includes="*.xul" />
<fileset dir="${firefox.ui.dir}">
<include name="chickenscratch.xul"/>
<include name="chickenscratch.js"/>
</fileset>
<filterset refid="chickenfootMacros" />
</copy>
<!-- skin folder -->
<mkdir dir="${fennec.xpi.dir}/skin" />
<copy todir="${fennec.xpi.dir}/skin" overwrite="true">
<fileset dir="${fennec.skin.dir}" />
</copy>
<!-- locale folder -->
<mkdir dir="${fennec.xpi.dir}/locale" />
<copy todir="${fennec.xpi.dir}/locale" overwrite="true">
<fileset dir="${fennec.locale.dir}" />
</copy>
<!-- copy install.rdf file, filling in version number -->
<copy file="${fennec.platform.dir}/install.template.rdf"
tofile="${fennec.xpi.dir}/install.rdf"
overwrite="true" />
<replaceregexp match="${version.pattern}"
flags="g"
replace="${version.value}" >
<fileset dir="${fennec.xpi.dir}">
<include name="install.rdf" />
</fileset>
</replaceregexp>
<!-- chrome.manifest -->
<copy file="${fennec.platform.dir}/chrome.manifest"
tofile="${fennec.xpi.dir}/chrome.manifest"
overwrite="true" />
<!-- setup folder -->
<mkdir dir="${fennec.xpi.dir}/setup" />
<copy todir="${fennec.xpi.dir}/setup" overwrite="true">
<fileset dir="${setup.dir}" />
</copy>
</target>
<target name="run-fennec-no-install"
depends="fennec-xpi-dir,point-fennec-to-xpi-dir,run-fennec"
description="Runs Fennec by pointing it directly at build/xpi.">
</target>
<condition property="fennec-already-points-to-xpi-dir">
<available file="${fennec.extension.dir}" type="file"/>
</condition>
<target name="point-fennec-to-xpi-dir"
unless="fennec-already-points-to-xpi-dir">
<echo message="Deleting old Chickenfoot and redirecting it to ${xpi.dir}"/>
<delete dir="${fennec.extension.dir}"/>
<echo message="${fennec.xpi.dir}" file="${fennec.extension.dir}"/>
</target>
<condition property="fennec-properties-has-profile-dir">
<and>
<available file="${fennec.propertiesfile}" />
<isset property="fennec.profile.dir" />
</and>
</condition>
<target name="run-fennec">
<fail unless="fennec-properties-has-profile-dir">
.
The run-fennec-no-install target requies you to create
fennec.properties. Use fennec-default.properties
as a template, and customize it for your Fennec installation.
</fail>
<exec executable="${fennec.dir}${fennec.executable}">
<arg value="-jsconsole"/>
</exec>
</target>
<target name="fennec-build"
depends="run-fennec-no-install"
description="Builds the fennec chickenfoot extension.">
</target>
<target name="fennec-clean"
description="Removes all generated files.">
<delete dir="${fennec.build.dir}" />
</target>
</project>