/
build.xml
227 lines (176 loc) · 8.79 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
<?xml version="1.0" ?>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
* 1) In order to build Firebug (including tracing) xpi run: $ant
The final xpi + update.rdf file will be located in 'release' sub directory.
If GETFIREBUG is properly specified in content/firebug/branch.properties
(it assumes you have fbug and getfirebug.com directories at the same level)
The xpi + update.rdf will be also deployed for you there and so, you can just commit.
The release directory should contain two files:
- firebug<version>.xpi (including updateURL) for getfirebug.com
- firebug<version>-amo.xpi (disabled update) for AMO
* 2) In order to build Firebug final release (no tracing) run: $ant release
Again xpi files will be located in the 'release' directory.
* 3) To check GETFIREBUG value run: ant echo
* 4)To build xpi and generate JS doc (from source comments) run: $ant jsdoc
* 5)To build xpi for Babelzilla run: $ant bz
- All BZ locales should be stored in "bz-locale" directory.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<project name="firebug" basedir="." default="build">
<!-- Properties -->
<property file="content/firebug/branch.properties"/>
<!-- Directories -->
<property name="build.dir" value="./build"/>
<property name="release.dir" value="./release"/>
<property name="deploy-xpi.dir" value="${GETFIREBUG}/releases/firebug/${VERSION}"/>
<property name="deploy-jsdoc.dir" value="${GETFIREBUG}/developer/api/firebug${VERSION}"/>
<property name="bz-locale.dir" value="./bz-locale"/>
<available file="${GETFIREBUG}" property="deploy.dir.available"/>
<!-- echo -->
<target name="echo">
<echo message="Build directory: ${build.dir}"/>
<echo message="Deploy directory ${GETFIREBUG} available: ${deploy.dir.available}"/>
</target>
<!-- Clean -->
<target name="clean">
<delete dir="${build.dir}"/>
<delete dir="${release.dir}"/>
</target>
<!-- Build -->
<target name="build" depends="clean">
<antcall target="prepare-build" />
<!-- Copy install.rdf with updated release version info -->
<replace file="${build.dir}/install.rdf" propertyFile="content/firebug/branch.properties">
<replacefilter token="@VERSION@" property="VERSION"/>
<replacefilter token="@RELEASE@" property="RELEASE"/>
</replace>
<!-- Remove template for manifest file that is used for Babelzilla builds -->
<delete file="${build.dir}/chrome.bz.tpl.manifest"/>
<!-- Create XPI for getfirebug.com -->
<antcall target="createFirebugXPI">
<param name="file-name" value="firebug-${VERSION}${RELEASE}.xpi"/>
</antcall>
<antcall target="disableUpdate" />
<!-- Create XPI for AMO -->
<antcall target="createFirebugXPI">
<param name="file-name" value="firebug-${VERSION}${RELEASE}-amo.xpi"/>
</antcall>
<delete dir="${build.dir}"/>
<antcall target="deploy" />
<echo message="Firebug version: ${VERSION}${RELEASE} in ${release.dir}"/>
</target>
<!-- Build Babelzilla Release -->
<target name="bz" depends="clean">
<antcall target="prepare-build" />
<!-- Use Babelzila manifest file (with all locales) -->
<copy file="chrome.bz.tpl.manifest" tofile="${build.dir}/chrome.manifest"
overwrite="true"/>
<delete file="${build.dir}/chrome.bz.tpl.manifest"/>
<!-- Use all BZ locales -->
<copy todir="${build.dir}/locale" overwrite="true">
<fileset dir="${bz-locale.dir}">
<include name="**/*.properties"/>
<exclude name="en-US/*.properties"/>
</fileset>
</copy>
<!-- Modify version number (append BZ) -->
<replace file="${build.dir}/install.rdf" propertyFile="content/firebug/branch.properties">
<replacefilter token="@VERSION@" value="${VERSION}" />
<replacefilter token="@RELEASE@" value="${RELEASE}-bz" />
</replace>
<!-- Delete the helper dir with Babelzilla locales from the build directory -->
<delete dir="${build.dir}/${bz-locale.dir}" />
<!-- Create XPI for getfirebug.com -->
<antcall target="createFirebugXPI">
<param name="file-name" value="firebug-${VERSION}${RELEASE}-bz.xpi" />
</antcall>
<delete dir="${build.dir}" />
<echo message="Firebug Release for Babelzilla: ${VERSION}${RELEASE}-bz in ${release.dir}" />
</target>
<!-- Prepare build files -->
<target name="prepare-build">
<mkdir dir="${build.dir}" />
<mkdir dir="${release.dir}" />
<!-- Copy all files -->
<copy todir="${build.dir}">
<fileset dir=".">
<include name="**/*.js"/>
<include name="**/*.xul"/>
<include name="**/*.properties"/>
<include name="**/*.css"/>
<include name="**/*.html"/>
<include name="**/*.xml"/>
<include name="**/*.dtd"/>
<include name="**/*.png"/>
<include name="**/*.gif"/>
<include name="**/*.svg"/>
<include name="**/*.ico"/>
<include name="**/*.manifest"/>
<include name="**/*.txt"/>
</fileset>
</copy>
<!-- Copy install.rdf template into the build dir -->
<copy file="install.rdf.tpl.xml" tofile="${build.dir}/install.rdf"/>
<!-- Remove unnecessary *.xml files in the root directory (like e.g. this build file),
but not from sub directories. -->
<delete dir="${build.dir}" includes="*.xml" />
</target>
<!-- Create final firebug.xpi file -->
<target name="createFirebugXPI">
<!-- Compress files (ZIP) -->
<zip destfile="${release.dir}/${file-name}"
basedir="${build.dir}" update="true" />
<!-- Copy update.rdf file with updated release version info -->
<copy file="update.rdf.tpl.xml" tofile="${release.dir}/update.rdf"/>
<replace file="${release.dir}/update.rdf" propertyFile="content/firebug/branch.properties">
<replacefilter token="@VERSION@" property="VERSION"/>
<replacefilter token="@RELEASE@" property="RELEASE"/>
<replacefilter token="@LEAF@" value="firebug-${VERSION}${RELEASE}.xpi"/>
</replace>
</target>
<!-- Deploy xpi & update.rdf files - if target available -->
<target name="deploy" if="deploy.dir.available">
<copy file="${release.dir}/update.rdf" todir="${deploy-xpi.dir}" overwrite="true"/>
<copy file="${release.dir}/firebug-${VERSION}${RELEASE}.xpi" todir="${deploy-xpi.dir}" overwrite="true"/>
<copy file="${release.dir}/firebug-${VERSION}${RELEASE}-amo.xpi" todir="${deploy-xpi.dir}" overwrite="true"/>
<echo message="XPI deployed to: ${VERSION}${RELEASE} to ${deploy-xpi.dir}"/>
</target>
<!-- Deploy if target available -->
<target name="deploy-jsdoc" if="deploy.dir.available">
<!-- Deploy jsdoc -->
<copy todir="${deploy-jsdoc.dir}">
<fileset dir="${release.dir}/jsdoc"/>
</copy>
<echo message="JSDoc deployed to: ${VERSION}${RELEASE} to ${deploy-xpi.dir}"/>
</target>
<!-- Support for generating docs from Firebug source code using js-doc-toolkit
See the output in $svn/jsdoc/out directory -->
<target name="jsdoc" depends="build" description="Generate documentation">
<property name="jsdoc.dir" value="../../jsdoc/"/>
<property name="jsdoc-toolkit.dir" value="${jsdoc.dir}/jsdoc-toolkit-2.3.0/"/>
<property name="jsdoc-output.dir" value="${release.dir}/jsdoc/"/>
<path id="jsdoctoolkit">
<!-- Rhino js.jar 1.7.R2 must be used with jsdoctoolkit-ant-task-1.0.1.jar -->
<fileset dir="${jsdoc.dir}" includes="*.jar"/>
</path>
<taskdef name="jsdoctoolkit"
classpathref="jsdoctoolkit"
classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit"/>
<echo message="Generate doc from Firebug source."/>
<!-- Clean the output direcotory -->
<delete dir="${jsdoc-output.dir}"/>
<!-- Parse all source files -->
<jsdoctoolkit jsdochome="${jsdoc-toolkit.dir}"
template="firebug"
outputdir="${jsdoc-output.dir}"
inputdir="." />
<!-- Deploy -->
<antcall target="deploy-jsdoc" />
</target>
<!-- Remove update URL, this is necessary for AMO -->
<target name="disableUpdate">
<replaceregexp file="${build.dir}/install.rdf"
match="(.*)https://getfirebug.com/releases/firebug/${VERSION}/update.rdf(.*)"
replace=""
byline="true" />
</target>
</project>