Changeset 8687 in josm


Ignore:
Timestamp:
2015-08-24T14:41:08+02:00 (4 years ago)
Author:
Don-vip
Message:

see #11795 - add taginfo target to Ant build

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        77javadoc
        88checkstyle-josm.xml
         9taginfo_*.json
         10taginfo-img
  • trunk/build.xml

    r8664 r8687  
    1515    <property name="javacc.home" location="tools"/>
    1616    <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
     17    <property name="groovy.jar" location="tools/groovy-all-2.4.3.jar"/>
    1718    <!-- build parameter: compression level (ant -Dclevel=N)
    1819             N ranges from 0 (no compression) to 9 (maximum compression)
     
    296297        </fileset>
    297298        <pathelement path="dist/josm-custom.jar"/>
    298         <pathelement path="tools/groovy-all-2.4.3.jar"/>
     299        <pathelement path="${groovy.jar}"/>
    299300    </path>
    300301    <macrodef name="init-test-preferences">
     
    343344    </macrodef>
    344345    <target name="test-compile" depends="test-init,dist">
    345         <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="tools/groovy-all-2.4.3.jar"/>
     346        <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpath="${groovy.jar}"/>
    346347        <call-groovyc testfamily="unit">
    347348            <cp-elements>
     
    573574    </target>
    574575
     576    <macrodef name="_taginfo">
     577        <attribute name="type"/>
     578        <attribute name="output"/>
     579        <sequential>
     580            <echo message="Generating Taginfo for type @{type} to @{output}"/>
     581            <groovy src="${taginfoextract}" classpath="dist/josm-custom.jar">
     582                <arg value="-t"/>
     583                <arg value="@{type}"/>
     584                <arg value="--noexit"/>
     585                <arg value="--svnweb"/>
     586                <arg value="--imgurlprefix"/>
     587                <arg value="${imgurlprefix}"/>
     588                <arg value="-o"/>
     589                <arg value="@{output}"/>
     590            </groovy>
     591        </sequential>
     592    </macrodef>
     593
     594    <target name="taginfo" depends="dist">
     595        <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/>
     596        <property name="taginfoextract" value="scripts/taginfoextract.groovy"/>
     597        <property name="imgurlprefix" value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
     598        <_taginfo type="mappaint" output="taginfo_style.json"/>
     599        <_taginfo type="presets" output="taginfo_presets.json"/>
     600        <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
     601    </target>
     602
    575603    <target name="checkstyle">
    576604        <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
  • trunk/scripts/taginfoextract.groovy

    r8681 r8687  
    1010 */
    1111import groovy.json.JsonBuilder
     12
     13import java.awt.image.BufferedImage
     14import java.nio.file.FileSystems
     15import java.nio.file.Files
     16import java.nio.file.Path
     17
     18import javax.imageio.ImageIO
     19
    1220import org.openstreetmap.josm.Main
    1321import org.openstreetmap.josm.data.Version
     
    2230import org.openstreetmap.josm.gui.mappaint.Environment
    2331import org.openstreetmap.josm.gui.mappaint.LineElemStyle
     32import org.openstreetmap.josm.gui.mappaint.MultiCascade
    2433import org.openstreetmap.josm.gui.mappaint.MapPaintStyles.IconReference
    25 import org.openstreetmap.josm.gui.mappaint.MultiCascade
     34import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource
    2635import org.openstreetmap.josm.gui.mappaint.mapcss.Condition.SimpleKeyValueCondition
    27 import org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource
    2836import org.openstreetmap.josm.gui.mappaint.mapcss.Selector.GeneralSelector
    2937import org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser
     
    3543import org.openstreetmap.josm.io.CachedFile
    3644import org.openstreetmap.josm.tools.Utils
    37 
    38 import javax.imageio.ImageIO
    39 import java.awt.image.BufferedImage
    40 import java.nio.file.FileSystems
    41 import java.nio.file.Files
    42 import java.nio.file.Path
    4345
    4446class taginfoextract {
     
    191193        } else {
    192194            System.err.println 'Invalid type ' + options.t
    193             System.exit(1)
    194         }
    195 
    196         System.exit(0)
     195            if (!options.noexit) {
     196                System.exit(1)
     197            }
     198        }
     199
     200        if (!options.noexit) {
     201            System.exit(0)
     202        }
    197203    }
    198204
     
    208214        cli._(longOpt:'svnrev', args:1, argName:"revision", "corresponding revision of the repository https://svn.openstreetmap.org/ (optional, current revision is read from the local checkout or from the web if not given, see --svnweb)")
    209215        cli._(longOpt:'imgdir', args:1, argName:"directory", "directory to put the generated images in (default: ./taginfo-img)")
     216        cli._(longOpt:'noexit', "don't call System.exit(), for use from Ant script")
    210217        cli._(longOpt:'svnweb', 'fetch revision of the repository https://svn.openstreetmap.org/ from web and not from the local repository')
    211218        cli._(longOpt:'imgurlprefix', args:1, argName:'prefix', 'image URLs prefix for generated image files')
Note: See TracChangeset for help on using the changeset viewer.