Localisation updates from https://translatewiki.net.
[potlatch2.git] / build.xml
index f335490..9bf885b 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -1,4 +1,4 @@
-<project name="Potlatch2 ├╝ber compile system" default="debug">
+<project name="Potlatch 2" default="debug" xmlns:ac="antlib:net.sf.antcontrib">
 
   <!-- load properties from the environment -->
   <property environment="env" />
@@ -9,6 +9,9 @@
   <!-- 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.
@@ -17,6 +20,7 @@
   <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>
 
   </target>
 
   <!-- delete and create the DEPLOY dir again -->
-  <target name="init" depends="git-buildnumber,svn-buildnumber,deployLocales">
+  <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">
     </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">
+  <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"/>
   </target>
 
   <!-- note that there's an asdoc target in Flex 4, if/when we move to that -->
-  <target name="docs" depends="manifests">
+  <target name="docs" depends="manifests,makeLocalesList">
     <exec executable="${ASDOC}" failonerror="true">
-      <arg line="-source-path ."/>
-      <arg line="-doc-sources net/systemeD/"/>
+      <arg line="-source-path=."/>
+      <arg line="-doc-sources=net/systemeD/"/>
       <arg line="-external-library-path=lib/"/>
-      <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 Poltatch2'" />
+      <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.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.tools 'Data manipulation tools'" />
       <arg line="-package net.systemeD.potlatch2.utils 'Data loading utilities'" />
       
-      <arg line="-left-frameset-width 300" />
+      <arg line="-left-frameset-width=300" />
+      <arg line="-allow-source-path-overlap=true" />
     </exec>
   </target>
 
 
         <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">
+        <pathconvert property="com_classes" pathsep="," refid="com_sources">
                 <chainedmapper>
                         <globmapper from="${basedir}/*" to="*"/>
                         <mapper type="package" from="*.as" to="*"/>
         <!-- 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">
+        <pathconvert property="org_classes" pathsep="," refid="org_sources">
                 <chainedmapper>
                         <globmapper from="${basedir}/*" to="*"/>
                         <mapper type="package" from="*.as" to="*"/>
 
         <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">
+        <pathconvert property="it_classes" pathsep="," refid="it_sources">
                 <chainedmapper>
                         <globmapper from="${basedir}/*" to="*"/>
                         <mapper type="package" from="*.as" to="*"/>
 
         <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">
+        <pathconvert property="hxasm_classes" pathsep="," refid="hxasm_sources">
                 <chainedmapper>
                         <globmapper from="${basedir}/*" to="*"/>
                         <mapper type="package" from="*.as" to="*"/>
        
       <!-- 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}" />
 
 
         <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>
 
     </sequential>
   </macrodef>
 
-  <target name="buildLocales">
-    <echo>Building Localization .swf's</echo>
-    <compileLocale locale="en_US" />
-    <compileLocale locale="en_GB" />
-    <compileLocale locale="fr_FR" />
+  <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>
-    <deployLocale locale="en_US" />
-    <deployLocale locale="en_GB" />
-    <deployLocale locale="fr_FR" />
+    <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>