Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 24ec597c45
Fetching contributors…

Cannot retrieve contributors at this time

348 lines (289 sloc) 16.501 kb
<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" />
</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 the ${build} and ${dist} directory trees -->
<!--
FIXME what is supposed to be cleaned?
<delete dir="${build}"/>
<delete dir="${dist}"/>
-->
</target>
</project>
Jump to Line
Something went wrong with that request. Please try again.