source: subversion/applications/editors/potlatch2/build.xml @ 25426

Last change on this file since 25426 was 25363, checked in by gravitystorm, 9 years ago

Make the undo/redo buttons in the main application file translateable

File size: 13.4 KB
Line 
1<project name="Potlatch2 über compile system" default="debug">
2
3  <!-- load properties from the environment -->
4  <property environment="env" />
5
6  <!-- load previously defined configuration properties file -->
7  <property file="build.properties" />
8
9  <!-- flexTasks comes with flex, but apparently it's good practice to put in the libs folder -->
10  <taskdef resource="flexTasks.tasks" classpath="${basedir}/lib/flexTasks.jar"/>
11
12  <!-- if you are running git-svn, you need to run "git tag -a 0.4 0ac0de" where 0ac0de corresponds to the commitid of
13      potlatch2 v0.4 . You need to do this for each point release while we're still in SVN.
14      If you don't, then expect "git describe" to fail miserably.
15      Produces a build number of the form 0.4-1-g9692243 which means 1 commit later than 0.4, latest commit was 9692243 -->
16  <available file=".git" type="dir" property="git.present"/>
17  <target name="git-buildnumber" description="Store output from git-describe in ${buildnumber}" if="git.present">
18    <exec outputproperty="build_number" executable="git" dir="${basedir}">
19      <arg value="describe" />
20    </exec>
21  </target>
22
23  <!-- if you are running svn ("I pity the fool", etc) then svnversion will give the svn revision number, and the
24       build number will be of the form 24041 -->
25  <available file=".svn" type="dir" property="svn.present"/>
26  <target name="svn-buildnumber" description="Store output from svnversion in ${buildnumber}" if="svn.present">
27    <exec outputproperty="build_number" executable="svnversion" dir="${basedir}" />
28  </target>
29
30  <!-- delete and create the DEPLOY dir again -->
31  <target name="init" depends="git-buildnumber,svn-buildnumber,deployLocales">
32    <echo>Build Number ${build_number}</echo>
33    <copy file="version.as.template" tofile="version.as" overwrite="true" />
34    <replace file="version.as" token="@@@buildnumber@@@" value="${build_number}" />
35  </target>
36
37  <!-- Build and output potlatch2.swf in debug mode -->
38  <target name="debug" depends="init">
39    <mxmlc file="potlatch2.mxml">
40      <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
41      <load-config filename="debug-config.xml"/>
42      <source-path path-element="${FLEX_HOME}/frameworks"/>
43      <compiler.debug>true</compiler.debug>
44    </mxmlc>
45  </target>
46
47  <!-- Build and output potlatch2.swf in release mode -->
48  <target name="release" depends="init">
49    <mxmlc file="potlatch2.mxml">
50      <load-config filename="${FLEX_HOME}/frameworks/flex-config.xml"/>
51      <source-path path-element="${FLEX_HOME}/frameworks"/>
52      <compiler.debug>false</compiler.debug>
53    </mxmlc>
54  </target>
55
56  <target name="halcyon">
57    <mxmlc file="halcyon_viewer.as" />
58  </target>
59
60  <!-- note that there's an asdoc target in Flex 4, if/when we move to that -->
61  <target name="docs" depends="manifests">
62    <exec executable="${ASDOC}" failonerror="true">
63      <arg line="-source-path ."/>
64      <arg line="-doc-sources net/systemeD/"/>
65      <arg line="-external-library-path=lib/"/>
66      <arg line="-exclude-classes ${org_classes} ${it_classes} ${hxasm_classes} ${com_classes}"/>
67      <arg line="-output resources/docs/"/>
68      <arg line="-window-title 'Halcyon and Potlatch2 Developer documentation'" />
69      <arg line="-main-title 'Halcyon and Potlatch2 Developer documentation'" />
70      <arg line="-footer 'Found an error? Help us fix it. http://wiki.openstreetmap.org/wiki/Potlatch2'"/>
71      <arg line="-package net.systemeD.controls 'Custom-built controls used in Poltatch2'" />
72      <arg line="-package net.systemeD.halcyon 'The AS3 rendering library'" />
73      <arg line="-package net.systemeD.halcyon.connection 'The connection to the main OSM server, and the entities'" />
74      <arg line="-package net.systemeD.halcyon.connection.actions 'The undoable actions that apply to OSM data'" />
75      <arg line="-package net.systemeD.halcyon.styleparser 'The logic for parsing MapCSS stylesheets'" />
76      <arg line="-package net.systemeD.potlatch2 'The OpenStreetMap editor'" />
77      <arg line="-package net.systemeD.potlatch2.collections 'Singletons for handling collections loaded from config files'" />
78      <arg line="-package net.systemeD.potlatch2.controller 'The various controller states that p2 can be in'" />
79      <arg line="-package net.systemeD.potlatch2.help 'The Help dialog'" />
80      <arg line="-package net.systemeD.potlatch2.mapfeatures 'The engine behind the mapfeatures parsing'" />
81      <arg line="-package net.systemeD.potlatch2.mapfeatures.editors 'The various widgets used in the Simple panel'" />
82      <arg line="-package net.systemeD.potlatch2.mygpx 'The dialog for loading GPX files from the server'" />
83      <arg line="-package net.systemeD.potlatch2.options 'The options dialog'" />
84      <arg line="-package net.systemeD.potlatch2.panels 'The panels for the left-hand pane of p2'" />
85      <arg line="-package net.systemeD.potlatch2.save 'The save dialog and SaveManager'" />
86      <arg line="-package net.systemeD.potlatch2.tools 'Data manipulation tools'" />
87      <arg line="-package net.systemeD.potlatch2.utils 'Data loading utilities'" />
88     
89      <arg line="-left-frameset-width 300" />
90    </exec>
91  </target>
92
93  <target name="manifests">
94        <!-- Adapted from http://dreamingwell.com/articles/archives/2009/12/excluding-direc.php -->
95        <!-- Generating documentation for a class generates all the dependant documentation too. We
96             don't want to do this for certain projects like org.vanrijkom etc (.swc files are
97             automatically ignored). Unfortunately asdoc only has options for excluding particular
98             classes, and there's lots of them - so this stuff autogenerates the class lists that
99             we want to ignore. -->
100
101        <fileset id="com_sources" dir="${basedir}/com/" />
102        <!-- convert the names of excluded classes to packages with class names -->
103        <pathconvert property="com_classes" pathsep=" " refid="com_sources">
104                <chainedmapper>
105                        <globmapper from="${basedir}/*" to="*"/>
106                        <mapper type="package" from="*.as" to="*"/>
107                </chainedmapper>
108        </pathconvert>
109
110        <!-- Get the list of all files in the org directory -->
111        <fileset id="org_sources" dir="${basedir}/org/" />
112        <!-- convert the names of excluded classes to packages with class names -->
113        <pathconvert property="org_classes" pathsep=" " refid="org_sources">
114                <chainedmapper>
115                        <globmapper from="${basedir}/*" to="*"/>
116                        <mapper type="package" from="*.as" to="*"/>
117                </chainedmapper>
118        </pathconvert>
119
120        <fileset id="it_sources" dir="${basedir}/it/" />
121        <!-- convert the names of excluded classes to packages with class names -->
122        <pathconvert property="it_classes" pathsep=" " refid="it_sources">
123                <chainedmapper>
124                        <globmapper from="${basedir}/*" to="*"/>
125                        <mapper type="package" from="*.as" to="*"/>
126                </chainedmapper>
127        </pathconvert>
128
129        <fileset id="hxasm_sources" dir="${basedir}/hxasm/" />
130        <!-- convert the names of excluded classes to packages with class names -->
131        <pathconvert property="hxasm_classes" pathsep=" " refid="hxasm_sources">
132                <chainedmapper>
133                        <globmapper from="${basedir}/*" to="*"/>
134                        <mapper type="package" from="*.as" to="*"/>
135                </chainedmapper>
136        </pathconvert>
137
138        <!-- if we end up with third-party stuff in the net/ folder, then do something like this -->
139        <!-- <fileset id="net_sources" dir="${basedir}/net/">
140               <exclude name="**net.systemeD**"/>
141        </fileset> -->
142
143        <!-- echo the exlcusions for debugging purposes -->
144        <!--<echo message="manifests = ${org_classes} ${it_classes} ${hxasm_classes}"/>-->
145  </target>
146
147  <!-- ======================================= -->
148  <!-- Unit Test Targets -->
149  <!-- ======================================= -->
150 
151  <target name="compileTestRunner" depends="init" description="Compiles the test runner application.">
152   
153    <!-- Compile TestRunner MXML as a SWF -->
154    <mxmlc file="${test.src.dir}/${test.application.name}.mxml"
155      output="${test.bin.dir}/${test.application.name}.swf">
156     
157      <!--<load-config filename="${FLEX_HOME}/frameworks/air-config.xml" />-->
158
159      <!-- we need to supply source paths for the real source and the test source. But passing
160          the potlatch2 top-level directory causes a problem since that also contains the test source.
161          We could move every source folder (net, org, it and hxasm) into a src/ folder, or alternatively
162          set up a fake root folder in the test folder with symlinks to the four directories concerned.
163          It's a bodge, but it works. -->
164      <source-path path-element="${test.fakeroot.dir}" />
165      <source-path path-element="${test.src.dir}" />
166       
167      <!-- The TestRunner needs the flexunit libraries in the build/libs folder -->
168      <library-path dir="${LIBS_DIR}" append="true">
169         <include name="*.swc" />
170      </library-path>
171
172       
173      <!-- Sets java.awt.headless=true so font compilation works in headless environments -->
174      <compiler.headless-server>true</compiler.headless-server>
175     </mxmlc>
176     
177     <echo message="The ${test.application.name}.swf test runner has been created in ${test.bin.dir}" />
178  </target>
179   
180  <target name="runTestsAndReport" depends="init" description="Launches the test runner, captures results, generates test report artifacts.">
181
182      <mkdir dir="${report.dir}" />
183      <mkdir dir="${report.html.dir}" />
184 
185     <!-- Run FlexUnit Ant Task to execute the unit tests and capture reporting data -->
186     <!-- on linux, make sure that gflashplayer is in your PATH and launches a standalone flashplayer binary -->
187     <taskdef resource="flexUnitTasks.tasks" classpath="${LIBS_DIR}/flexUnitTasks-4.1.0_RC2-28.jar" />
188     <flexunit swf="${test.bin.dir}/${test.application.name}.swf" toDir="${report.dir}"
189       haltonfailure="false" verbose="false" localTrusted="true" player="flash" />
190       
191      <!-- Generate html JUnit-style reports based on test results -->
192      <junitreport todir="${report.dir}">
193        <fileset dir="${report.dir}">
194          <include name="TEST-*.xml" />
195        </fileset>
196        <report format="frames" todir="${report.html.dir}" />
197      </junitreport>
198         
199         <echo message="The unit test reports have been created in ${report.dir}" />
200  </target>
201
202  <target name="test" depends="init, compileTestRunner, runTestsAndReport" description="Compiles unit tests and generates test report artifacts." />
203
204  <!-- ======================================= -->
205  <!-- Locale Targets -->
206  <!-- ======================================= -->
207
208  <!-- Deploy compiled Localization Resource Bundles and resources. -->
209  <macrodef name="deployLocale" description="Deploying the compiled swfs">
210    <attribute name="locale" default="en_GB"/>
211    <sequential>
212      <echo>Copying @{locale}.swf to deploy directory...</echo>
213
214      <mkdir dir="${basedir}/resources/locales"/>
215      <copy file="${basedir}/l10n/locale/bundles/@{locale}.swf" tofile="${basedir}/resources/locales/@{locale}.swf" />
216
217    </sequential>
218  </macrodef>
219
220  <!-- Compiles Localization Resource Bundle. -->
221  <macrodef name="compileLocale" description="Compiles the Resource package for the given locale">
222    <attribute name="locale" default="en_GB"/>
223    <sequential>
224
225      <!--
226      Invoke MXMLC
227      - also include the MX Framework locale assets
228      Note: this requires user to invoke copyLocale.exe prior to running this script
229      -->
230      <mxmlc output="${basedir}/l10n/locale/bundles/@{locale}.swf">
231<!--         <locale>@{locale}</locale> -->
232
233
234        <source-path path-element="${basedir}/l10n/locale/@{locale}"/>
235        <include-resource-bundles>help_dialog</include-resource-bundles>
236        <include-resource-bundles>p2_main</include-resource-bundles>
237
238<!--        <source-path path-element="${src.dir}/locale/framework/bundles/{locale}/src"/>
239        <include-resource-bundles>collections</include-resource-bundles>
240        <include-resource-bundles>containers</include-resource-bundles>
241        <include-resource-bundles>controls</include-resource-bundles>
242        <include-resource-bundles>core</include-resource-bundles>
243        <include-resource-bundles>effects</include-resource-bundles>
244        <include-resource-bundles>formatters</include-resource-bundles>
245        <include-resource-bundles>logging</include-resource-bundles>
246        <include-resource-bundles>SharedResources</include-resource-bundles>
247        <include-resource-bundles>skins</include-resource-bundles>
248        <include-resource-bundles>states</include-resource-bundles>
249        <include-resource-bundles>styles</include-resource-bundles>
250        <include-resource-bundles>utils</include-resource-bundles>
251        <include-resource-bundles>validators</include-resource-bundles>-->
252      </mxmlc>
253
254    </sequential>
255  </macrodef>
256
257  <target name="buildLocales">
258    <echo>Building Localization .swf's</echo>
259    <compileLocale locale="en_US" />
260    <compileLocale locale="en_GB" />
261    <compileLocale locale="fr_FR" />
262  </target>
263
264
265  <target name="deployLocales" depends="buildLocales">
266    <echo>Deploying the compiled swf and assets package for the given locales</echo>
267    <deployLocale locale="en_US" />
268    <deployLocale locale="en_GB" />
269    <deployLocale locale="fr_FR" />
270  </target>
271
272</project>
Note: See TracBrowser for help on using the repository browser.