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/irsrectify/build.xml

    r31926 r32306  
    11<?xml version="1.0" encoding="utf-8"?>
    22<project name="irsrectify" default="dist" basedir=".">
     3
    34    <!-- enter the SVN commit message -->
    4     <property name="commit.message" value="irsrectify shortcut confilct"/>
     5    <property name="commit.message" value="irsrectify shortcut conflict"/>
    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.build.dir" value="build"/>
    13     <property name="plugin.src.dir" value="src"/>
    14     <!-- this is the directory where the plugin jar is copied to -->
    15     <property name="plugin.dist.dir" value="../../dist"/>
    16     <property name="ant.build.javac.target" value="1.7"/>
    17     <property name="plugin.dist.dir" value="../../dist"/>
    18     <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    19     <!--
    20     **********************************************************
    21     ** init - initializes the build
    22     **********************************************************
     8
     9    <!-- Configure these properties (replace "..." accordingly).
     10         See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
    2311    -->
    24     <target name="init">
    25         <mkdir dir="${plugin.build.dir}"/>
     12    <property name="plugin.author" value="Ilya Zverev"/>
     13    <property name="plugin.class" value="irsrectify.IRSRectifyPlugin"/>
     14    <property name="plugin.description" value="A helper for IRS satellite adjustment."/>
     15    <property name="plugin.icon" value="images/irsrectify.png"/>
     16    <property name="plugin.link" value="http://forum.openstreetmap.org/viewtopic.php?id=6817"/>
     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-Description" value="Удобный инструмент создания файлов привязки космоснимков IRS."/>
     24        </manifest>
    2625    </target>
    27     <!--
    28     **********************************************************
    29     ** compile - complies the source tree
    30     **********************************************************
    31     -->
    32     <target name="compile" depends="init">
    33         <echo message="compiling sources for  ${plugin.jar} ... "/>
    34         <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}" includeantruntime="false">
    35             <compilerarg value="-Xlint:deprecation"/>
    36             <compilerarg value="-Xlint:unchecked"/>
    37         </javac>
    38     </target>
    39     <!--
    40     **********************************************************
    41     ** dist - creates the plugin jar
    42     **********************************************************
    43     -->
    44     <target name="dist" depends="compile,revision">
    45         <echo message="creating ${ant.project.name}.jar ... "/>
    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="Ilya Zverev"/>
    69                 <attribute name="Plugin-Class" value="irsrectify.IRSRectifyPlugin"/>
    70                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    71                 <attribute name="Plugin-Description" value="A helper for IRS satellite adjustment."/>
    72                 <attribute name="ru_Plugin-Description" value="Удобный инструмент создания файлов привязки космоснимков IRS."/>
    73                 <attribute name="Plugin-Icon" value="images/irsrectify.png"/>
    74                 <attribute name="Plugin-Link" value="http://forum.openstreetmap.org/viewtopic.php?id=6817"/>
    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         -->
    128     <target name="core-info">
    129         <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    130             <env key="LANG" value="C"/>
    131             <arg value="info"/>
    132             <arg value="--xml"/>
    133             <arg value="../../core"/>
    134         </exec>
    135         <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
    136         <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    137         <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
    138         <delete file="core.info.xml"/>
    139     </target>
    140     <!--
    141         ** commits the source tree for this plugin
    142         -->
    143     <target name="commit-current">
    144         <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    145         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    146             <env key="LANG" value="C"/>
    147             <arg value="commit"/>
    148             <arg value="-m '${commit.message}'"/>
    149             <arg value="."/>
    150         </exec>
    151     </target>
    152     <!--
    153         ** updates (svn up) the source tree for this plugin
    154         -->
    155     <target name="update-current">
    156         <echo>Updating plugin source ...</echo>
    157         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    158             <env key="LANG" value="C"/>
    159             <arg value="up"/>
    160             <arg value="."/>
    161         </exec>
    162         <echo>Updating ${plugin.jar} ...</echo>
    163         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    164             <env key="LANG" value="C"/>
    165             <arg value="up"/>
    166             <arg value="../dist/${plugin.jar}"/>
    167         </exec>
    168     </target>
    169     <!--
    170         ** commits the plugin.jar
    171         -->
    172     <target name="commit-dist">
    173         <echo>
    174     ***** Properties of published ${plugin.jar} *****
    175     Commit message    : '${commit.message}'                   
    176     Plugin-Mainversion: ${plugin.main.version}
    177     JOSM build version: ${coreversion.info.entry.revision}
    178     Plugin-Version    : ${version.entry.commit.revision}
    179     ***** / Properties of published ${plugin.jar} *****                   
    180                        
    181     Now commiting ${plugin.jar} ...
    182     </echo>
    183         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    184             <env key="LANG" value="C"/>
    185             <arg value="-m '${commit.message}'"/>
    186             <arg value="commit"/>
    187             <arg value="${plugin.jar}"/>
    188         </exec>
    189     </target>
    190     <!-- ** make sure svn is present as a command line tool ** -->
    191     <target name="ensure-svn-present">
    192         <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
    193             <env key="LANG" value="C"/>
    194             <arg value="--version"/>
    195         </exec>
    196         <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
    197             <!-- return code not set at all? Most likely svn isn't installed -->
    198             <condition>
    199                 <not>
    200                     <isset property="svn.exit.code"/>
    201                 </not>
    202             </condition>
    203         </fail>
    204         <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
    205             <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
    206             <condition>
    207                 <isfailure code="${svn.exit.code}"/>
    208             </condition>
    209         </fail>
    210     </target>
    211     <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
    212     </target>
     26
     27    <!-- ** include targets that all plugins have in common ** -->
     28    <import file="../build-common.xml"/>
     29 
    21330</project>
Note: See TracChangeset for help on using the changeset viewer.