Ignore:
Timestamp:
2013-04-09T18:25:26+02:00 (13 years ago)
Author:
malcolmh
Message:

save

File:
1 edited

Legend:

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

    r29438 r29491  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <!--
    3 ** This is a template build file for a JOSM  plugin.
    4 **
    5 ** Maintaining versions
    6 ** ====================
    7 ** See README.template
    8 **
    9 ** Usage
    10 ** =====
    11 ** Call "ant help" to get possible build targets.
    12 **
    13 -->
    14 <project name="SeaMapEditor" default="dist" basedir=".">
     2<project name="SeaMapEditor" basedir=".">
    153    <!-- enter the SVN commit message -->
    164    <property name="commit.message" value="New release"/>
     
    186    <property name="plugin.main.version" value="4394"/>
    197    <!-- should not be necessary to change the following properties -->
    20 
    21     <property name="plugin.author" value="Werner, Malcolm"/>
    22     <property name="plugin.class" value="smed.Smed"/>
    23     <property name="plugin.description" value="Create and edit seamaps for OpenSeaMap"/>
    24     <property name="plugin.icon" value="images/Smed.png"/>
    25     <property name="plugin.link" value="http://openseamap.org/"/>
    26 
    27     <!-- ** include targets that all plugins have in common ** -->
    28     <import file="../build-common.xml"/>
    29 
    30     <target name="setup-dist">
    31         <antcall target="setup-dist-default" />
     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    <property name="smed.dist.dir" value="dist/"/>
     12    <!-- this is the directory where the plugin jar is copied to -->
     13    <property name="plugin.dist.dir" value="../../dist/"/>
     14    <property name="smed_core.dist.dir" value="core/dist/"/>
     15    <property name="ant.build.javac.target" value="1.5"/>
     16    <property name="plugin.jar" value="${plugin.dist.dir}${ant.project.name}.jar"/>
     17    <!--
     18    **********************************************************
     19    ** init - initializes the build
     20    **********************************************************
     21    -->
     22    <target name="init">
     23        <mkdir dir="${plugin.build.dir}"/>
     24        <mkdir dir="${smed_core.dist.dir}"/>
     25        <mkdir dir="${smed.dist.dir}"/>
     26    </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}">
     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>
    3252        <copy todir="${plugin.build.dir}/smed/msg">
    3353            <fileset dir="${plugin.src.dir}/smed/msg"/>
    3454        </copy>
    35     </target>
    36 
     55        <copy todir="${plugin.build.dir}">
     56            <fileset dir="${smed.dist.dir}"/>
     57        </copy>
     58        <copy todir="${plugin.build.dir}">
     59            <fileset dir=".">
     60                <include name="*.txt"/>
     61            </fileset>
     62        </copy>
     63        <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
     64            <!--
     65        ************************************************
     66        ** configure these properties. Most of them will be copied to the plugins
     67        ** manifest file. Property values will also show up in the list available
     68        ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
     69        **
     70        ************************************************
     71    -->
     72            <manifest>
     73                <attribute name="Author" value="Werner, Malcolm"/>
     74                <attribute name="Plugin-Class" value="smed.Smed"/>
     75                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
     76                <attribute name="Plugin-Description" value="Create and edit seamaps for OpenSeaMap"/>
     77                <attribute name="Plugin-Icon" value="images/Smed.png"/>
     78                <attribute name="Plugin-Link" value="http://openseamap.org/"/>
     79                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
     80                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
     81            </manifest>
     82        </jar>
     83        <!-- install interface -->
     84        <copy file="${plugin.jar}" todir="${smed_core.dist.dir}"/>
     85    </target>
     86    <!--
     87    **********************************************************
     88    ** revision - extracts the current revision number for the
     89    **    file build.number and stores it in the XML property
     90    **    version.*
     91    **********************************************************
     92    -->
     93    <target name="revision">
     94        <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
     95            <env key="LANG" value="C"/>
     96            <arg value="info"/>
     97            <arg value="--xml"/>
     98            <arg value="."/>
     99        </exec>
     100        <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
     101        <delete file="REVISION"/>
     102    </target>
     103    <!--
     104    **********************************************************
     105    ** clean - clean up the build environment
     106    **********************************************************
     107    -->
     108    <target name="clean">
     109        <delete dir="${plugin.build.dir}"/>
     110        <delete file="${plugin.jar}"/>
     111    </target>
     112    <!--
     113    **********************************************************
     114    ** install - install the plugin in your local JOSM installation
     115    **********************************************************
     116    -->
     117    <target name="install" depends="dist">
     118        <property environment="env"/>
     119        <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
     120            <and>
     121                <os family="windows"/>
     122            </and>
     123        </condition>
     124        <delete dir="${josm.plugins.dir}/splug"/>
     125        <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
     126    </target>
     127    <!--
     128    ************************** Publishing the plugin ***********************************
     129    -->
     130    <!--
     131    ** extracts the JOSM release for the JOSM version in ../core and saves it in the
     132    ** property ${coreversion.info.entry.revision}
     133    -->
     134    <target name="core-info">
     135        <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
     136            <env key="LANG" value="C"/>
     137            <arg value="info"/>
     138            <arg value="--xml"/>
     139            <arg value="../../core"/>
     140        </exec>
     141        <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
     142        <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
     143        <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
     144        <delete file="core.info.xml"/>
     145    </target>
     146    <!-- commits the source tree for this plugin -->
     147    <target name="commit-current">
     148        <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
     149        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     150            <env key="LANG" value="C"/>
     151            <arg value="commit"/>
     152            <arg value="-m '${commit.message}'"/>
     153            <arg value="."/>
     154        </exec>
     155    </target>
     156    <!-- updates (svn up) the source tree for this plugin -->
     157    <target name="update-current">
     158        <echo>Updating plugin source ...</echo>
     159        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     160            <env key="LANG" value="C"/>
     161            <arg value="up"/>
     162            <arg value="."/>
     163        </exec>
     164        <echo>Updating ${plugin.jar} ...</echo>
     165        <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     166            <env key="LANG" value="C"/>
     167            <arg value="up"/>
     168            <arg value="../dist/${plugin.jar}"/>
     169        </exec>
     170    </target>
     171    <!-- commits the plugin.jar -->
     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>
    37213</project>
Note: See TracChangeset for help on using the changeset viewer.