This repository has been archived by the owner on Jan 1, 2021. It is now read-only.
forked from openstreetmap/potlatch2
-
Notifications
You must be signed in to change notification settings - Fork 23
/
build.xml
344 lines (289 loc) · 16.2 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
<project name="Potlatch 2" default="debug" xmlns:ac="antlib:net.sf.antcontrib">
<!-- load properties from the environment -->
<property environment="env" />
<!-- load previously defined configuration properties file -->
<property file="build.properties" />
<!-- flexTasks comes with flex, but apparently it's good practice to put in the libs folder -->
<taskdef resource="flexTasks.tasks" classpath="${basedir}/lib/flexTasks.jar"/>
<!-- ant-contrib to build multiple locales -->
<taskdef uri="antlib:net.sf.antcontrib" resource="net/sf/antcontrib/antlib.xml" classpath="${basedir}/lib/ant-contrib-1.0b3.jar"/>
<!-- if you are running git-svn, you need to run "git tag -a 0.4 0ac0de" where 0ac0de corresponds to the commitid of
potlatch2 v0.4 . You need to do this for each point release while we're still in SVN.
If you don't, then expect "git describe" to fail miserably.
Produces a build number of the form 0.4-1-g9692243 which means 1 commit later than 0.4, latest commit was 9692243 -->
<available file=".git" type="dir" property="git.present"/>
<target name="git-buildnumber" description="Store output from git-describe in ${buildnumber}" if="git.present">
<exec outputproperty="build_number" executable="git" dir="${basedir}">
<arg value="describe" />
<arg value="--tags" />
</exec>
</target>
<!-- if you are running svn ("I pity the fool", etc) then svnversion will give the svn revision number, and the
build number will be of the form 24041 -->
<available file=".svn" type="dir" property="svn.present"/>
<target name="svn-buildnumber" description="Store output from svnversion in ${buildnumber}" if="svn.present">
<exec outputproperty="build_number" executable="svnversion" dir="${basedir}" />
</target>
<!-- delete and create the DEPLOY dir again -->
<target name="build-number" depends="git-buildnumber,svn-buildnumber">
<echo>Build Number ${build_number}</echo>
<copy file="version.as.template" tofile="version.as" overwrite="true" />
<replace file="version.as" token="@@@buildnumber@@@" value="${build_number}" />
</target>
<target name="init" depends="build-number, deployLocales">
</target>
<target name="init-no-locales" depends="build-number">
</target>
<!-- Build and output potlatch2.swf in debug mode -->
<target name="debug" depends="init">
<mxmlc file="potlatch2.mxml">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<load-config filename="debug-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.debug>true</compiler.debug>
</mxmlc>
</target>
<target name="debug-no-locales" depends="init-no-locales">
<mxmlc file="potlatch2.mxml">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<load-config filename="debug-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.debug>true</compiler.debug>
</mxmlc>
</target>
<!-- Build and output potlatch2.swf in release mode -->
<target name="release" depends="init"> <!-- FIXME convention is dist not release -->
<mxmlc file="potlatch2.mxml">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.debug>false</compiler.debug>
</mxmlc>
</target>
<target name="release-no-locales" depends="init-no-locales"> <!-- FIXME convention is dist not release -->
<mxmlc file="potlatch2.mxml">
<load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
<source-path path-element="${FLEX_HOME}/frameworks"/>
<compiler.debug>false</compiler.debug>
</mxmlc>
</target>
<target name="halcyon">
<mxmlc file="halcyon_viewer.as" />
</target>
<!-- note that there's an asdoc target in Flex 4, if/when we move to that -->
<target name="docs" depends="manifests,makeLocalesList">
<exec executable="${ASDOC}" failonerror="true">
<arg line="-source-path=."/>
<arg line="-doc-sources=net/systemeD/"/>
<arg line="-external-library-path=lib/"/>
<arg line="-external-library-path=${FLEX_HOME}/frameworks/libs/"/>
<arg line="-external-library-path=${FLEX_HOME}/frameworks/libs/player/10.2/"/>
<arg line="-compiler.theme ${flexlib}/themes/Halo/halo.swc"/>
<arg line="-lenient"/>
<arg line="-target-player=10.2.0"/>
<arg line="-exclude-classes=${org_classes},${it_classes},${hxasm_classes},${com_classes}"/>
<arg line="-output=resources/docs/"/>
<arg line="-window-title='Halcyon and Potlatch2 Developer documentation'" />
<arg line="-main-title='Halcyon and Potlatch2 Developer documentation'" />
<arg line="-footer='Found an error? Help us fix it. http://wiki.openstreetmap.org/wiki/Potlatch2'"/>
<arg line="-package net.systemeD.controls 'Custom-built controls used in Potlatch2'" />
<arg line="-package net.systemeD.halcyon 'The AS3 rendering library'" />
<arg line="-package net.systemeD.halcyon.connection 'The connection to the main OSM server, and the entities'" />
<arg line="-package net.systemeD.halcyon.connection.actions 'The undoable actions that apply to OSM data'" />
<arg line="-package net.systemeD.halcyon.styleparser 'The logic for parsing MapCSS stylesheets'" />
<arg line="-package net.systemeD.potlatch2 'The OpenStreetMap editor'" />
<arg line="-package net.systemeD.potlatch2.collections 'Singletons for handling collections loaded from config files'" />
<arg line="-package net.systemeD.potlatch2.controller 'The various controller states that p2 can be in'" />
<arg line="-package net.systemeD.potlatch2.find 'The search dialog for jumping to another place'" />
<arg line="-package net.systemeD.potlatch2.help 'The Help dialog'" />
<arg line="-package net.systemeD.potlatch2.mapfeatures 'The engine behind the mapfeatures parsing'" />
<arg line="-package net.systemeD.potlatch2.mapfeatures.editors 'The various widgets used in the Simple panel'" />
<arg line="-package net.systemeD.potlatch2.mygpx 'The dialog for loading GPX files from the server'" />
<arg line="-package net.systemeD.potlatch2.options 'The options dialog'" />
<arg line="-package net.systemeD.potlatch2.panels 'The panels for the left-hand pane of p2'" />
<arg line="-package net.systemeD.potlatch2.save 'The save dialog and SaveManager'" />
<arg line="-package net.systemeD.potlatch2.tools 'Data manipulation tools'" />
<arg line="-package net.systemeD.potlatch2.utils 'Data loading utilities'" />
<arg line="-left-frameset-width=300" />
<arg line="-allow-source-path-overlap=true" />
</exec>
</target>
<target name="manifests">
<!-- Adapted from http://dreamingwell.com/articles/archives/2009/12/excluding-direc.php -->
<!-- Generating documentation for a class generates all the dependant documentation too. We
don't want to do this for certain projects like org.vanrijkom etc (.swc files are
automatically ignored). Unfortunately asdoc only has options for excluding particular
classes, and there's lots of them - so this stuff autogenerates the class lists that
we want to ignore. -->
<fileset id="com_sources" dir="${basedir}/com/" />
<!-- convert the names of excluded classes to packages with class names -->
<pathconvert property="com_classes" pathsep="," refid="com_sources">
<chainedmapper>
<globmapper from="${basedir}/*" to="*"/>
<mapper type="package" from="*.as" to="*"/>
</chainedmapper>
</pathconvert>
<!-- Get the list of all files in the org directory -->
<fileset id="org_sources" dir="${basedir}/org/" />
<!-- convert the names of excluded classes to packages with class names -->
<pathconvert property="org_classes" pathsep="," refid="org_sources">
<chainedmapper>
<globmapper from="${basedir}/*" to="*"/>
<mapper type="package" from="*.as" to="*"/>
</chainedmapper>
</pathconvert>
<fileset id="it_sources" dir="${basedir}/it/" />
<!-- convert the names of excluded classes to packages with class names -->
<pathconvert property="it_classes" pathsep="," refid="it_sources">
<chainedmapper>
<globmapper from="${basedir}/*" to="*"/>
<mapper type="package" from="*.as" to="*"/>
</chainedmapper>
</pathconvert>
<fileset id="hxasm_sources" dir="${basedir}/hxasm/" />
<!-- convert the names of excluded classes to packages with class names -->
<pathconvert property="hxasm_classes" pathsep="," refid="hxasm_sources">
<chainedmapper>
<globmapper from="${basedir}/*" to="*"/>
<mapper type="package" from="*.as" to="*"/>
</chainedmapper>
</pathconvert>
<!-- if we end up with third-party stuff in the net/ folder, then do something like this -->
<!-- <fileset id="net_sources" dir="${basedir}/net/">
<exclude name="**net.systemeD**"/>
</fileset> -->
<!-- echo the exlcusions for debugging purposes -->
<!--<echo message="manifests = ${org_classes} ${it_classes} ${hxasm_classes}"/>-->
</target>
<!-- ======================================= -->
<!-- Unit Test Targets -->
<!-- ======================================= -->
<target name="compileTestRunner" depends="init" description="Compiles the test runner application.">
<!-- Compile TestRunner MXML as a SWF -->
<mxmlc file="${test.src.dir}/${test.application.name}.mxml"
output="${test.bin.dir}/${test.application.name}.swf">
<!--<load-config filename="${FLEX_HOME}/frameworks/air-config.xml" />-->
<!-- we need to supply source paths for the real source and the test source. But passing
the potlatch2 top-level directory causes a problem since that also contains the test source.
We could move every source folder (net, org, it and hxasm) into a src/ folder, or alternatively
set up a fake root folder in the test folder with symlinks to the four directories concerned.
It's a bodge, but it works. -->
<source-path path-element="${test.fakeroot.dir}" />
<source-path path-element="${test.src.dir}" />
<!-- The TestRunner needs the flexunit libraries in the build/libs folder -->
<library-path dir="${LIBS_DIR}" append="true">
<include name="*.swc" />
</library-path>
<!-- Sets java.awt.headless=true so font compilation works in headless environments -->
<compiler.headless-server>true</compiler.headless-server>
<target-player>10.2.0</target-player>
</mxmlc>
<echo message="The ${test.application.name}.swf test runner has been created in ${test.bin.dir}" />
</target>
<target name="runTestsAndReport" depends="init" description="Launches the test runner, captures results, generates test report artifacts.">
<mkdir dir="${report.dir}" />
<mkdir dir="${report.html.dir}" />
<!-- Run FlexUnit Ant Task to execute the unit tests and capture reporting data -->
<!-- on linux, make sure that gflashplayer is in your PATH and launches a standalone flashplayer binary -->
<taskdef resource="flexUnitTasks.tasks" classpath="${LIBS_DIR}/flexUnitTasks-4.1.0_RC2-28.jar" />
<flexunit swf="${test.bin.dir}/${test.application.name}.swf" toDir="${report.dir}"
haltonfailure="false" verbose="false" localTrusted="true" player="flash" />
<!-- Generate html JUnit-style reports based on test results -->
<junitreport todir="${report.dir}">
<fileset dir="${report.dir}">
<include name="TEST-*.xml" />
</fileset>
<report format="frames" todir="${report.html.dir}" />
</junitreport>
<echo message="The unit test reports have been created in ${report.dir}" />
</target>
<target name="test" depends="init, compileTestRunner, runTestsAndReport" description="Compiles unit tests and generates test report artifacts." />
<!-- ======================================= -->
<!-- Locale Targets -->
<!-- ======================================= -->
<!-- Deploy compiled Localization Resource Bundles and resources. -->
<macrodef name="deployLocale" description="Deploying the compiled swfs">
<attribute name="locale" default="en_GB"/>
<sequential>
<echo>Copying @{locale}.swf to deploy directory...</echo>
<mkdir dir="${basedir}/resources/locales"/>
<copy file="${basedir}/l10n/locale/bundles/@{locale}.swf" tofile="${basedir}/resources/locales/@{locale}.swf" />
</sequential>
</macrodef>
<!-- Compiles Localization Resource Bundle. -->
<macrodef name="compileLocale" description="Compiles the Resource package for the given locale">
<attribute name="locale" default="en_GB"/>
<sequential>
<!--
Invoke MXMLC
- also include the MX Framework locale assets
Note: this requires user to invoke copyLocale.exe prior to running this script
-->
<mxmlc output="${basedir}/l10n/locale/bundles/@{locale}.swf">
<!-- <locale>@{locale}</locale> -->
<source-path path-element="${basedir}/l10n/locale/@{locale}"/>
<source-path path-element="${basedir}/l10n/locale/en_US"/>
<include-resource-bundles>help_dialog</include-resource-bundles>
<include-resource-bundles>p2_main</include-resource-bundles>
<!-- <source-path path-element="${src.dir}/locale/framework/bundles/{locale}/src"/>
<include-resource-bundles>collections</include-resource-bundles>
<include-resource-bundles>containers</include-resource-bundles>
<include-resource-bundles>controls</include-resource-bundles>
<include-resource-bundles>core</include-resource-bundles>
<include-resource-bundles>effects</include-resource-bundles>
<include-resource-bundles>formatters</include-resource-bundles>
<include-resource-bundles>logging</include-resource-bundles>
<include-resource-bundles>SharedResources</include-resource-bundles>
<include-resource-bundles>skins</include-resource-bundles>
<include-resource-bundles>states</include-resource-bundles>
<include-resource-bundles>styles</include-resource-bundles>
<include-resource-bundles>utils</include-resource-bundles>
<include-resource-bundles>validators</include-resource-bundles>-->
</mxmlc>
</sequential>
</macrodef>
<target name="makeLocalesList">
<ac:for param="dirname">
<path>
<dirset dir="${basedir}/l10n/locale/">
<include name="*"/>
<exclude name="bundles"/>
</dirset>
</path>
<sequential>
<ac:var name="localename" unset="true"/>
<basename property="localename" file="@{dirname}" />
<script language="javascript"><![CDATA[
if ((l = project.getProperty("locales.list")) != null) {
project.setUserProperty("locales.list", l+ "," +project.getProperty("localename"));
} else {
project.setUserProperty("locales.list", project.getProperty("localename"));
}
]]></script>
</sequential>
</ac:for>
</target>
<target name="buildLocales" depends="makeLocalesList">
<echo>Building Localization .swf's</echo>
<ac:for list="${locales.list}" keepgoing="true" param="localename">
<sequential>
<compileLocale locale="@{localename}" />
</sequential>
</ac:for>
</target>
<target name="deployLocales" depends="buildLocales">
<echo>Deploying the compiled swf and assets package for the given locales</echo>
<ac:for list="${locales.list}" keepgoing="true" param="localename">
<sequential>
<deployLocale locale="@{localename}" />
</sequential>
</ac:for>
</target>
<target name="clean"
description="clean up" >
<delete dir="${basedir}/resources/generated"/>
<delete dir="${basedir}/resources/locales"/>
<delete>
<fileset dir="${basedir}/resources" includes="potlatch2.swf*"/>
</delete>
</target>
</project>