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

Location:
applications/editors/josm/plugins/globalsat
Files:
1 edited
1 moved

Legend:

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

    r31768 r32306  
    11<?xml version="1.0" encoding="utf-8"?>
    22<project name="globalsat" default="dist" basedir=".">
     3
    34    <!-- enter the SVN commit message -->
    45    <property name="commit.message" value="Changed constructor signature of plugin main class"/>
    56    <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
    67    <property name="plugin.main.version" value="7001"/>
    7     <!--
    8       ************************************************
    9       ** should not be necessary to change the following properties
    10      -->
    11     <property name="josm" location="../../core/dist/josm-custom.jar"/>
    12     <property name="plugin.dist.dir" value="../../dist"/>
    13     <property name="plugin.build.dir" value="build"/>
    14     <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    15     <property name="ant.build.javac.target" value="1.7"/>
    16     <property name="RXTX" location="./libs/RXTXcomm.jar"/>
    17     <target name="init">
    18         <mkdir dir="${plugin.build.dir}"/>
    19     </target>
    20     <target name="compile" depends="init">
    21         <echo message="creating ${plugin.jar}"/>
    22         <javac srcdir="src" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
    23             <compilerarg value="-Xlint:deprecation"/>
    24             <compilerarg value="-Xlint:unchecked"/>
    25             <classpath>
    26                 <pathelement location="${josm}"/>
    27                 <pathelement location="${RXTX}"/>
    28             </classpath>
    29         </javac>
    30     </target>
    31     <target name="dist" depends="compile,revision">
    32         <unjar dest="${plugin.build.dir}" src="${RXTX}"/>
    33         <copy todir="${plugin.build.dir}/images">
    34             <fileset dir="images"/>
    35         </copy>
    36         <copy todir="${plugin.build.dir}/data">
    37             <fileset dir="data"/>
    38         </copy>
    39         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifestencoding="UTF-8">
    40             <manifest>
    41                 <attribute name="Author" value="Raphael Mack"/>
    42                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.globalsat.GlobalsatPlugin"/>
    43                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    44                 <attribute name="Plugin-Description" value="Download GPS points from Globalsat dg100 data logger directly in JOSM."/>
    45                 <attribute name="Plugin-Icon" value="images/globalsatImport.png"/>
    46                 <attribute name="Plugin-Link" value="http://www.raphael-mack.de/josm-globalsat-gpx-import-plugin/"/>
    47                 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    48                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    49             </manifest>
    50         </jar>
    51     </target>
    52     <target name="revision">
    53         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    54             <env key="LANG" value="C"/>
    55             <arg value="info"/>
    56             <arg value="--xml"/>
    57             <arg value="."/>
    58         </exec>
    59         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    60         <delete file="REVISION"/>
    61     </target>
    62     <target name="clean">
    63         <delete dir="${plugin.build.dir}"/>
    64         <delete file="${plugin.jar}"/>
    65     </target>
    66     <target name="install" depends="dist">
    67         <property environment="env"/>
    68         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    69             <and>
    70                 <os family="windows"/>
    71             </and>
    72         </condition>
    73         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    74     </target>
    75     <!--
    76         ************************** Publishing the plugin ***********************************
    77         -->
    78     <!--
    79             ** extracts the JOSM release for the JOSM version in ../core and saves it in the
    80             ** property ${coreversion.info.entry.revision}
    81             **
    82             -->
    83     <target name="core-info">
    84         <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    85             <env key="LANG" value="C"/>
    86             <arg value="info"/>
    87             <arg value="--xml"/>
    88             <arg value="../../core"/>
    89         </exec>
    90         <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    91         <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    92         <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    93         <delete file="core.info.xml"/>
    94     </target>
    95     <!--
    96             ** commits the source tree for this plugin
    97             -->
    98     <target name="commit-current">
    99         <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    100         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    101             <env key="LANG" value="C"/>
    102             <arg value="commit"/>
    103             <arg value="-m '${commit.message}'"/>
    104             <arg value="."/>
    105         </exec>
    106     </target>
    107     <!--
    108             ** updates (svn up) the source tree for this plugin
    109             -->
    110     <target name="update-current">
    111         <echo>Updating plugin source ...</echo>
    112         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    113             <env key="LANG" value="C"/>
    114             <arg value="up"/>
    115             <arg value="."/>
    116         </exec>
    117         <echo>Updating ${plugin.jar} ...</echo>
    118         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    119             <env key="LANG" value="C"/>
    120             <arg value="up"/>
    121             <arg value="../dist/${plugin.jar}"/>
    122         </exec>
    123     </target>
    124     <!--
    125             ** commits the plugin.jar
    126             -->
    127     <target name="commit-dist">
    128         <echo>
    129         ***** Properties of published ${plugin.jar} *****
    130         Commit message    : '${commit.message}'
    131         Plugin-Mainversion: ${plugin.main.version}
    132         JOSM build version: ${coreversion.info.entry.revision}
    133         Plugin-Version    : ${version.entry.commit.revision}
    134         ***** / Properties of published ${plugin.jar} *****
    1358
    136         Now commiting ${plugin.jar} ...
    137         </echo>
    138         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    139             <env key="LANG" value="C"/>
    140             <arg value="-m '${commit.message}'"/>
    141             <arg value="commit"/>
    142             <arg value="${plugin.jar}"/>
    143         </exec>
    144     </target>
    145     <!-- ** make sure svn is present as a command line tool ** -->
    146     <target name="ensure-svn-present">
    147         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    148             <env key="LANG" value="C"/>
    149             <arg value="--version"/>
    150         </exec>
    151         <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    152             <!-- return code not set at all? Most likely svn isn't installed -->
    153             <condition>
    154                 <not>
    155                     <isset property="svn.exit.code"/>
    156                 </not>
    157             </condition>
    158         </fail>
    159         <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    160             <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    161             <condition>
    162                 <isfailure code="${svn.exit.code}"/>
    163             </condition>
    164         </fail>
    165     </target>
    166     <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    167     </target>
     9    <!-- Configure these properties (replace "..." accordingly).
     10         See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
     11    -->
     12    <property name="plugin.author" value="Raphael Mack"/>
     13    <property name="plugin.class" value="org.openstreetmap.josm.plugins.globalsat.GlobalsatPlugin"/>
     14    <property name="plugin.description" value="Download GPS points from Globalsat dg100 data logger directly in JOSM."/>
     15    <property name="plugin.icon" value="images/globalsatImport.png"/>
     16    <property name="plugin.link" value="http://www.raphael-mack.de/josm-globalsat-gpx-import-plugin/"/>
     17    <!--<property name="plugin.early" value="..."/>-->
     18    <!--<property name="plugin.requires" value="..."/>-->
     19    <!--<property name="plugin.stage" value="..."/>-->
     20
     21    <!-- ** include targets that all plugins have in common ** -->
     22    <import file="../build-common.xml"/>
     23 
    16824</project>
Note: See TracChangeset for help on using the changeset viewer.