[27429] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <project name="surveyor2" default="dist" basedir=".">
|
---|
| 3 | <!-- enter the SVN commit message -->
|
---|
| 4 | <property name="commit.message" value="Surveyor 2"/>
|
---|
| 5 | <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
|
---|
[30416] | 6 | <property name="plugin.main.version" value="7001"/>
|
---|
[27429] | 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="plugin.dist.dir" value="/Users/Zverik/AppData/Roaming/JOSM/plugins"/-->
|
---|
[30416] | 17 | <property name="ant.build.javac.target" value="1.7"/>
|
---|
| 18 | <property name="ant.build.javac.source" value="1.7"/>
|
---|
[27429] | 19 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
| 20 | <!--
|
---|
| 21 | **********************************************************
|
---|
| 22 | ** init - initializes the build
|
---|
| 23 | **********************************************************
|
---|
| 24 | -->
|
---|
| 25 | <target name="init">
|
---|
| 26 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 27 | </target>
|
---|
| 28 | <!--
|
---|
| 29 | **********************************************************
|
---|
| 30 | ** compile - complies the source tree
|
---|
| 31 | **********************************************************
|
---|
| 32 | -->
|
---|
| 33 | <target name="compile" depends="init">
|
---|
| 34 | <echo message="compiling sources for ${plugin.jar} ... "/>
|
---|
| 35 | <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
|
---|
| 36 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 37 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 38 | </javac>
|
---|
| 39 | </target>
|
---|
| 40 | <!--
|
---|
| 41 | **********************************************************
|
---|
| 42 | ** dist - creates the plugin jar
|
---|
| 43 | **********************************************************
|
---|
| 44 | -->
|
---|
| 45 | <target name="dist" depends="compile,revision">
|
---|
| 46 | <echo message="creating ${ant.project.name}.jar ... "/>
|
---|
| 47 | <copy todir="${plugin.build.dir}/images">
|
---|
| 48 | <fileset dir="images"/>
|
---|
| 49 | </copy>
|
---|
| 50 | <copy todir="${plugin.build.dir}/data">
|
---|
| 51 | <fileset dir="data"/>
|
---|
| 52 | </copy>
|
---|
| 53 | <copy todir="${plugin.build.dir}">
|
---|
| 54 | <fileset dir="src" includes="**/*.txt"/>
|
---|
| 55 | </copy>
|
---|
| 56 | <copy todir="${plugin.build.dir}">
|
---|
| 57 | <fileset dir=".">
|
---|
| 58 | <include name="README"/>
|
---|
| 59 | <include name="LICENSE"/>
|
---|
| 60 | </fileset>
|
---|
| 61 | </copy>
|
---|
| 62 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
| 63 | <!--
|
---|
| 64 | ************************************************
|
---|
| 65 | ** configure these properties. Most of them will be copied to the plugins
|
---|
| 66 | ** manifest file. Property values will also show up in the list available
|
---|
| 67 | ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
|
---|
| 68 | **
|
---|
| 69 | ************************************************
|
---|
| 70 | -->
|
---|
| 71 | <manifest>
|
---|
| 72 | <attribute name="Author" value="Ilya Zverev"/>
|
---|
| 73 | <attribute name="Plugin-Class" value="surveyor2.SurveyorPlugin"/>
|
---|
| 74 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
[27602] | 75 | <attribute name="Plugin-Description" value="The surveyor''s toolbox."/>
|
---|
[27429] | 76 | <attribute name="ru_Plugin-Description" value="Модуль для полевого картографирования."/>
|
---|
| 77 | <attribute name="Plugin-Icon" value="images/surveyor2.png"/>
|
---|
| 78 | <!--attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/Relation_Toolbox"/-->
|
---|
| 79 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 80 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 81 | <attribute name="Plugin-Stage" value="10"/>
|
---|
| 82 | </manifest>
|
---|
| 83 | </jar>
|
---|
| 84 | </target>
|
---|
| 85 | <!--
|
---|
| 86 | **********************************************************
|
---|
| 87 | ** revision - extracts the current revision number for the
|
---|
| 88 | ** file build.number and stores it in the XML property
|
---|
| 89 | ** version.*
|
---|
| 90 | **********************************************************
|
---|
| 91 | -->
|
---|
| 92 | <target name="revision">
|
---|
| 93 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
| 94 | <env key="LANG" value="C"/>
|
---|
| 95 | <arg value="info"/>
|
---|
| 96 | <arg value="--xml"/>
|
---|
| 97 | <arg value="."/>
|
---|
| 98 | </exec>
|
---|
| 99 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 100 | <delete file="REVISION"/>
|
---|
| 101 | </target>
|
---|
| 102 | <!--
|
---|
| 103 | **********************************************************
|
---|
| 104 | ** clean - clean up the build environment
|
---|
| 105 | **********************************************************
|
---|
| 106 | -->
|
---|
| 107 | <target name="clean">
|
---|
| 108 | <delete dir="${plugin.build.dir}"/>
|
---|
| 109 | <delete file="${plugin.jar}"/>
|
---|
| 110 | </target>
|
---|
| 111 | <!--
|
---|
| 112 | **********************************************************
|
---|
| 113 | ** install - install the plugin in your local JOSM installation
|
---|
| 114 | **********************************************************
|
---|
| 115 | -->
|
---|
| 116 | <target name="install" depends="dist">
|
---|
| 117 | <property environment="env"/>
|
---|
| 118 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
| 119 | <and>
|
---|
| 120 | <os family="windows"/>
|
---|
| 121 | </and>
|
---|
| 122 | </condition>
|
---|
| 123 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 124 | </target>
|
---|
| 125 | <!--
|
---|
| 126 | ************************** Publishing the plugin ***********************************
|
---|
| 127 | -->
|
---|
| 128 | <!--
|
---|
| 129 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
| 130 | ** property ${coreversion.info.entry.revision}
|
---|
| 131 | **
|
---|
| 132 | -->
|
---|
| 133 | <target name="core-info">
|
---|
| 134 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 135 | <env key="LANG" value="C"/>
|
---|
| 136 | <arg value="info"/>
|
---|
| 137 | <arg value="--xml"/>
|
---|
| 138 | <arg value="../../core"/>
|
---|
| 139 | </exec>
|
---|
| 140 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 141 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 142 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 143 | <delete file="core.info.xml"/>
|
---|
| 144 | </target>
|
---|
| 145 | <!--
|
---|
| 146 | ** commits the source tree for this plugin
|
---|
| 147 | -->
|
---|
| 148 | <target name="commit-current">
|
---|
| 149 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 150 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 151 | <env key="LANG" value="C"/>
|
---|
| 152 | <arg value="commit"/>
|
---|
| 153 | <arg value="-m '${commit.message}'"/>
|
---|
| 154 | <arg value="."/>
|
---|
| 155 | </exec>
|
---|
| 156 | </target>
|
---|
| 157 | <!--
|
---|
| 158 | ** updates (svn up) the source tree for this plugin
|
---|
| 159 | -->
|
---|
| 160 | <target name="update-current">
|
---|
| 161 | <echo>Updating plugin source ...</echo>
|
---|
| 162 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 163 | <env key="LANG" value="C"/>
|
---|
| 164 | <arg value="up"/>
|
---|
| 165 | <arg value="."/>
|
---|
| 166 | </exec>
|
---|
| 167 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 168 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 169 | <env key="LANG" value="C"/>
|
---|
| 170 | <arg value="up"/>
|
---|
| 171 | <arg value="../dist/${plugin.jar}"/>
|
---|
| 172 | </exec>
|
---|
| 173 | </target>
|
---|
| 174 | <!--
|
---|
| 175 | ** commits the plugin.jar
|
---|
| 176 | -->
|
---|
| 177 | <target name="commit-dist">
|
---|
| 178 | <echo>
|
---|
| 179 | ***** Properties of published ${plugin.jar} *****
|
---|
| 180 | Commit message : '${commit.message}'
|
---|
| 181 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 182 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 183 | Plugin-Version : ${version.entry.commit.revision}
|
---|
| 184 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 185 |
|
---|
| 186 | Now commiting ${plugin.jar} ...
|
---|
| 187 | </echo>
|
---|
| 188 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 189 | <env key="LANG" value="C"/>
|
---|
| 190 | <arg value="-m '${commit.message}'"/>
|
---|
| 191 | <arg value="commit"/>
|
---|
| 192 | <arg value="${plugin.jar}"/>
|
---|
| 193 | </exec>
|
---|
| 194 | </target>
|
---|
| 195 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 196 | <target name="ensure-svn-present">
|
---|
| 197 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 198 | <env key="LANG" value="C"/>
|
---|
| 199 | <arg value="--version"/>
|
---|
| 200 | </exec>
|
---|
| 201 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 202 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 203 | <condition>
|
---|
| 204 | <not>
|
---|
| 205 | <isset property="svn.exit.code"/>
|
---|
| 206 | </not>
|
---|
| 207 | </condition>
|
---|
| 208 | </fail>
|
---|
| 209 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 210 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 211 | <condition>
|
---|
| 212 | <isfailure code="${svn.exit.code}"/>
|
---|
| 213 | </condition>
|
---|
| 214 | </fail>
|
---|
| 215 | </target>
|
---|
| 216 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 217 | </target>
|
---|
| 218 | </project>
|
---|