Ignore:
Timestamp:
2016-06-18T03:37:43+02:00 (8 years ago)
Author:
donvip
Message:

rework/simplify plugins build.xml file - automatically run unit tests of all plugins, without having to maintain list manually

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/infomode/build.xml

    r31926 r32306  
    11<?xml version="1.0" encoding="utf-8"?>
    22<project name="InfoMode" default="dist" basedir=".">
     3
    34    <!-- enter the SVN commit message -->
    45    <property name="commit.message" value="InfoMode : for shortcurt parser"/>
    56    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    67    <property name="plugin.main.version" value="7001"/>
    7     <!-- should not be necessary to change the following properties -->
    8     <property name="josm" location="../../core/dist/josm-custom.jar"/>
    9     <property name="plugin.build.dir" value="build"/>
    10     <property name="plugin.src.dir" value="src"/>
    11     <!-- this is the directory where the plugin jar is copied to -->
    12     <property name="plugin.dist.dir" value="../../dist"/>
    13     <property name="ant.build.javac.target" value="1.7"/>
    14     <property name="plugin.dist.dir" value="../../dist"/>
    15     <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    16     <!--
    17     **********************************************************
    18     ** init - initializes the build
    19     **********************************************************
     8
     9    <!-- Configure these properties (replace "..." accordingly).
     10         See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
    2011    -->
    21     <target name="init">
    22         <mkdir dir="${plugin.build.dir}"/>
    23     </target>
    24     <!--
    25     **********************************************************
    26     ** compile - complies the source tree
    27     **********************************************************
    28     -->
    29     <target name="compile" depends="init">
    30         <echo message="compiling sources for  ${plugin.jar} ... "/>
    31         <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
    32             <compilerarg value="-Xlint:deprecation"/>
    33             <compilerarg value="-Xlint:unchecked"/>
    34         </javac>
    35     </target>
    36     <!--
    37     **********************************************************
    38     ** dist - creates the plugin jar
    39     **********************************************************
    40     -->
    41     <target name="dist" depends="compile,revision">
    42         <echo message="creating ${ant.project.name}.jar ... "/>
    43         <copy todir="${plugin.build.dir}/resources">
    44             <fileset dir="resources"/>
    45         </copy>
    46         <copy todir="${plugin.build.dir}/images">
    47             <fileset dir="images"/>
    48         </copy>
    49         <copy todir="${plugin.build.dir}/data">
    50             <fileset dir="data"/>
    51         </copy>
    52         <copy todir="${plugin.build.dir}">
    53             <fileset dir=".">
    54                 <include name="README"/>
    55                 <include name="LICENSE"/>
    56             </fileset>
    57         </copy>
    58         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifestencoding="UTF-8">
    59             <!--
    60             ************************************************
    61             ** configure these properties. Most of them will be copied to the plugins
    62             ** manifest file. Property values will also show up in the list available
    63             ** plugins: https://josm.openstreetmap.de/wiki/Plugins.
    64             **
    65             ************************************************
    66             -->
    67             <manifest>
    68                 <attribute name="Author" value="Alexei Kasatkin"/>
    69                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.infomode.InfoModePlugin"/>
    70                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    71                 <attribute name="Plugin-Description" value="Extra information about current layer objects pop ups - currently GPX trackpoint info"/>
    72                 <attribute name="Plugin-Icon" value="images/mapmode/infomode.png"/>
    73                 <attribute name="Plugin-Link" value="https://wiki.openstreetmap.org/wiki/JOSM/Plugins/InfoMode"/>
    74                 <attribute name="ru_Plugin-Link" value="https://wiki.openstreetmap.org/wiki/RU:JOSM/Plugins/InfoMode"/>
    75                 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    76                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    77             </manifest>
    78         </jar>
    79     </target>
    80     <!--
    81     **********************************************************
    82     ** revision - extracts the current revision number for the
    83     **    file build.number and stores it in the XML property
    84     **    version.*
    85     **********************************************************
    86     -->
    87     <target name="revision">
    88         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    89             <env key="LANG" value="C"/>
    90             <arg value="info"/>
    91             <arg value="--xml"/>
    92             <arg value="."/>
    93         </exec>
    94         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    95         <delete file="REVISION"/>
    96     </target>
    97     <!--
    98     **********************************************************
    99     ** clean - clean up the build environment
    100     **********************************************************
    101     -->
    102     <target name="clean">
    103         <delete dir="${plugin.build.dir}"/>
    104         <delete file="${plugin.jar}"/>
    105     </target>
    106     <!--
    107     **********************************************************
    108     ** install - install the plugin in your local JOSM installation
    109     **********************************************************
    110     -->
    111     <target name="install" depends="dist">
    112         <property environment="env"/>
    113         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    114             <and>
    115                 <os family="windows"/>
    116             </and>
    117         </condition>
    118         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    119     </target>
    120     <!--
    121     ************************** Publishing the plugin ***********************************
    122     -->
    123     <!--
    124     ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    125     ** property ${coreversion.info.entry.revision}
    126     -->
    127     <target name="core-info">
    128         <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    129             <env key="LANG" value="C"/>
    130             <arg value="info"/>
    131             <arg value="--xml"/>
    132             <arg value="../../core"/>
    133         </exec>
    134         <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    135         <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    136         <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    137         <delete file="core.info.xml"/>
    138     </target>
    139     <!-- commits the source tree for this plugin -->
    140     <target name="commit-current">
    141         <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    142         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    143             <env key="LANG" value="C"/>
    144             <arg value="commit"/>
    145             <arg value="-m '${commit.message}'"/>
    146             <arg value="."/>
    147         </exec>
    148     </target>
    149     <!-- updates (svn up) the source tree for this plugin -->
    150     <target name="update-current">
    151         <echo>Updating plugin source ...</echo>
    152         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    153             <env key="LANG" value="C"/>
    154             <arg value="up"/>
    155             <arg value="."/>
    156         </exec>
    157         <echo>Updating ${plugin.jar} ...</echo>
    158         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    159             <env key="LANG" value="C"/>
    160             <arg value="up"/>
    161             <arg value="../dist/${plugin.jar}"/>
    162         </exec>
    163     </target>
    164     <!-- commits the plugin.jar -->
    165     <target name="commit-dist">
    166         <echo>
    167     ***** Properties of published ${plugin.jar} *****
    168     Commit message    : '${commit.message}'                   
    169     Plugin-Mainversion: ${plugin.main.version}
    170     JOSM build version: ${coreversion.info.entry.revision}
    171     Plugin-Version    : ${version.entry.commit.revision}
    172     ***** / Properties of published ${plugin.jar} *****                   
    173                        
    174     Now commiting ${plugin.jar} ...
    175     </echo>
    176         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    177             <env key="LANG" value="C"/>
    178             <arg value="-m '${commit.message}'"/>
    179             <arg value="commit"/>
    180             <arg value="${plugin.jar}"/>
    181         </exec>
    182     </target>
    183     <!-- make sure svn is present as a command line tool -->
    184     <target name="ensure-svn-present">
    185         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    186             <env key="LANG" value="C"/>
    187             <arg value="--version"/>
    188         </exec>
    189         <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    190             <!-- return code not set at all? Most likely svn isn't installed -->
    191             <condition>
    192                 <not>
    193                     <isset property="svn.exit.code"/>
    194                 </not>
    195             </condition>
    196         </fail>
    197         <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    198             <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    199             <condition>
    200                 <isfailure code="${svn.exit.code}"/>
    201             </condition>
    202         </fail>
    203     </target>
    204     <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    205     </target>
    206     <target name="runjosm" depends="install">
    207         <java jar="${josm}" fork="true">
    208             <arg line="../../core/data_nodist/munich.gpx"/>
    209         </java>
     12    <property name="plugin.author" value="Alexei Kasatkin"/>
     13    <property name="plugin.class" value="org.openstreetmap.josm.plugins.infomode.InfoModePlugin"/>
     14    <property name="plugin.description" value="Extra information about current layer objects pop ups - currently GPX trackpoint info"/>
     15    <property name="plugin.icon" value="images/mapmode/infomode.png"/>
     16    <property name="plugin.link" value="https://wiki.openstreetmap.org/wiki/JOSM/Plugins/InfoMode"/>
     17    <!--<property name="plugin.early" value="..."/>-->
     18    <!--<property name="plugin.requires" value="..."/>-->
     19    <!--<property name="plugin.stage" value="..."/>-->
     20
     21    <target name="additional-manifest">
     22        <manifest file="MANIFEST" mode="update">
     23            <attribute name="ru_Plugin-Link" value="https://wiki.openstreetmap.org/wiki/RU:JOSM/Plugins/InfoMode"/>
     24        </manifest>
    21025    </target>
    21126
     27    <!-- ** include targets that all plugins have in common ** -->
     28    <import file="../build-common.xml"/>
     29 
    21230</project>
Note: See TracChangeset for help on using the changeset viewer.