<project name="potlatch2styles_mod" basedir=".">
<!--

    The potlatch 2 styles need to be patched in order to work with the JOSM MapCSS implementation.
    When updating from the potlatch2 repository, the workflow can be like this:
     * copy files from 'patched' to 'source'
     * cd source && svn up
     * solve possible conflicts
     * modify the new sections, such that they work with josm
     * create potlatch2.mapcss (ant assemble)
     * copy files from 'source' to 'patched'
     * update externals definition to the current revision (ant update-externals)
     * commit everything (style, patches and externals definition)
     
-->

    <!--    concatinate the files to one mapcss style file     -->
    <target name="assemble">
        <concat destfile="../../styles/standard/potlatch2.mapcss">
            <filelist dir="." files="prelude.css"/>        
            <filelist dir="patched" files="core_ways.css,core_pois.css,core_landuse.css,potlatch.css"/>        
        </concat>
    </target>
    
    
    <target name="copy-patched-to-source">
        <copy todir="source" overwrite="true"> 
            <fileset dir="patched"/>
        </copy>
    </target>
    
    <target name="copy-source-to-patched">
        <copy todir="patched" overwrite="true"> 
            <filelist dir="source" files="core_ways.css,core_pois.css,core_landuse.css,potlatch.css"/>        
        </copy>
    </target>

    <!--    Update the explicit revision number in the externals definition to the current revision. -->
    <target name="update-externals" depends="source-revision">
        <exec executable="svn">
            <arg value="propset"/>
            <arg value="svn:externals"/>
            <arg value="source -r ${version.entry.commit.revision} http://svn.openstreetmap.org/applications/editors/potlatch2/resources/stylesheets"/>
            <arg value="."/>
        </exec>
    </target>
    
    <!--    Determine revision and save in  ${version.entry.commit.revision}-->
    <target name="source-revision" depends="init">
        <exec append="false" output="REVISION.XML" executable="svn" dir="source" failifexecutionfails="true">
            <env key="LANG" value="C"/>
            <arg value="info"/>
            <arg value="--xml"/>
            <arg value="."/>
        </exec>
        <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
        <delete file="REVISION.XML" />
    </target>
    
</project>

