[26174] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <project name="alignways" default="dist" basedir=".">
|
---|
| 3 | <!-- enter the SVN commit message -->
|
---|
[27732] | 4 | <property name="commit.message" value="AlignWays: moved to Shift-Spacebar due to shortcut confilcts with core. A is too overloaded"/>
|
---|
[29854] | 5 | <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
|
---|
| 6 | <property name="plugin.main.version" value="6162"/>
|
---|
[26174] | 7 | <!--
|
---|
| 8 | ************************************************ ** should not be
|
---|
| 9 | 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 | <property name="plugin.lib.dir" value="lib"/>
|
---|
| 15 | <!-- this is the directory where the plugin jar is copied to -->
|
---|
| 16 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
[28605] | 17 | <property name="ant.build.javac.target" value="1.6"/>
|
---|
[26174] | 18 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
| 19 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
| 20 | <!--
|
---|
| 21 | ********************************************************** ** init -
|
---|
| 22 | initializes the build
|
---|
| 23 | **********************************************************
|
---|
| 24 | -->
|
---|
| 25 | <target name="init">
|
---|
| 26 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 27 | </target>
|
---|
| 28 | <!--
|
---|
| 29 | ********************************************************** ** compile
|
---|
| 30 | - 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};${plugin.lib.dir}" debug="true" destdir="${plugin.build.dir}">
|
---|
| 36 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 37 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 38 | </javac>
|
---|
| 39 | <copy todir="${plugin.build.dir}">
|
---|
| 40 | <fileset dir="lib"/>
|
---|
| 41 | </copy>
|
---|
| 42 | </target>
|
---|
| 43 | <!--
|
---|
| 44 | ********************************************************** ** dist -
|
---|
| 45 | creates the plugin jar
|
---|
| 46 | **********************************************************
|
---|
| 47 | -->
|
---|
| 48 | <target name="dist" depends="compile,revision">
|
---|
| 49 | <echo message="creating ${ant.project.name}.jar ... "/>
|
---|
| 50 | <copy todir="${plugin.build.dir}/resources">
|
---|
| 51 | <fileset dir="resources"/>
|
---|
| 52 | </copy>
|
---|
| 53 | <copy todir="${plugin.build.dir}/images">
|
---|
| 54 | <fileset dir="images"/>
|
---|
| 55 | </copy>
|
---|
| 56 | <copy todir="${plugin.build.dir}/data">
|
---|
| 57 | <fileset dir="data"/>
|
---|
| 58 | </copy>
|
---|
| 59 | <copy todir="${plugin.build.dir}">
|
---|
| 60 | <fileset dir=".">
|
---|
| 61 | <include name="README"/>
|
---|
| 62 | <include name="LICENSE"/>
|
---|
| 63 | </fileset>
|
---|
| 64 | </copy>
|
---|
| 65 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
| 66 | <!--
|
---|
| 67 | ************************************************ ** configure these
|
---|
| 68 | properties. Most of them will be copied to the plugins ** manifest
|
---|
| 69 | file. Property values will also show up in the list available **
|
---|
| 70 | plugins: http://josm.openstreetmap.de/wiki/Plugins. **
|
---|
| 71 | ************************************************
|
---|
| 72 | -->
|
---|
| 73 | <manifest>
|
---|
| 74 | <attribute name="Author" value="Attila Szász"/>
|
---|
[27348] | 75 | <attribute name="Plugin-Class" value="com.tilusnet.josm.plugins.alignways.AlignWaysPlugin"/>
|
---|
[26174] | 76 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
| 77 | <attribute name="Plugin-Description" value="Makes a pair of selected way segments parallel by rotating one of them around a chosen pivot."/>
|
---|
| 78 | <attribute name="Plugin-Icon" value="images/alignways.png"/>
|
---|
| 79 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 80 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 81 | <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/AlignWayS"/>
|
---|
| 82 | </manifest>
|
---|
| 83 | </jar>
|
---|
| 84 | </target>
|
---|
| 85 | <!--
|
---|
| 86 | ********************************************************** ** revision
|
---|
| 87 | - extracts the current revision number for the ** file build.number
|
---|
| 88 | and stores it in the XML property ** version.*
|
---|
| 89 | **********************************************************
|
---|
| 90 | -->
|
---|
| 91 | <target name="revision">
|
---|
| 92 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
| 93 | <env key="LANG" value="C"/>
|
---|
| 94 | <arg value="info"/>
|
---|
| 95 | <arg value="--xml"/>
|
---|
| 96 | <arg value="."/>
|
---|
| 97 | </exec>
|
---|
| 98 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 99 | <delete file="REVISION"/>
|
---|
| 100 | </target>
|
---|
| 101 | <!--
|
---|
| 102 | ********************************************************** ** clean -
|
---|
| 103 | clean up the build environment
|
---|
| 104 | **********************************************************
|
---|
| 105 | -->
|
---|
| 106 | <target name="clean">
|
---|
| 107 | <delete dir="${plugin.build.dir}"/>
|
---|
| 108 | <delete file="${plugin.jar}"/>
|
---|
| 109 | </target>
|
---|
| 110 | <!--
|
---|
| 111 | ********************************************************** ** install
|
---|
| 112 | - install the plugin in your local JOSM installation
|
---|
| 113 | **********************************************************
|
---|
| 114 | -->
|
---|
| 115 | <target name="install" depends="dist">
|
---|
| 116 | <property environment="env"/>
|
---|
| 117 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
| 118 | <and>
|
---|
| 119 | <os family="windows"/>
|
---|
| 120 | </and>
|
---|
| 121 | </condition>
|
---|
| 122 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 123 | </target>
|
---|
| 124 | <!--
|
---|
| 125 | ************************** Publishing the plugin
|
---|
| 126 | ***********************************
|
---|
| 127 | -->
|
---|
| 128 | <!--
|
---|
| 129 | ** extracts the JOSM release for the JOSM version in ../core and saves
|
---|
| 130 | it in the ** property ${coreversion.info.entry.revision} **
|
---|
| 131 | -->
|
---|
| 132 | <target name="core-info">
|
---|
| 133 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 134 | <env key="LANG" value="C"/>
|
---|
| 135 | <arg value="info"/>
|
---|
| 136 | <arg value="--xml"/>
|
---|
| 137 | <arg value="../../core"/>
|
---|
| 138 | </exec>
|
---|
| 139 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 140 | <echo>Building against core revision
|
---|
| 141 | ${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
|
---|
| 181 | : '${commit.message}'
|
---|
| 182 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 183 | JOSM
|
---|
| 184 | build version: ${coreversion.info.entry.revision}
|
---|
| 185 | Plugin-Version :
|
---|
| 186 | ${version.entry.commit.revision}
|
---|
| 187 | ***** / Properties of published
|
---|
| 188 | ${plugin.jar} *****
|
---|
| 189 |
|
---|
| 190 | Now commiting ${plugin.jar} ...
|
---|
| 191 | </echo>
|
---|
| 192 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 193 | <env key="LANG" value="C"/>
|
---|
| 194 | <arg value="-m '${commit.message}'"/>
|
---|
| 195 | <arg value="commit"/>
|
---|
| 196 | <arg value="${plugin.jar}"/>
|
---|
| 197 | </exec>
|
---|
| 198 | </target>
|
---|
| 199 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 200 | <target name="ensure-svn-present">
|
---|
| 201 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 202 | <env key="LANG" value="C"/>
|
---|
| 203 | <arg value="--version"/>
|
---|
| 204 | </exec>
|
---|
| 205 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 206 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 207 | <condition>
|
---|
| 208 | <not>
|
---|
| 209 | <isset property="svn.exit.code"/>
|
---|
| 210 | </not>
|
---|
| 211 | </condition>
|
---|
| 212 | </fail>
|
---|
| 213 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 214 | <!--
|
---|
| 215 | error code from SVN? Most likely svn is not what we are looking on
|
---|
| 216 | this system
|
---|
| 217 | -->
|
---|
| 218 | <condition>
|
---|
| 219 | <isfailure code="${svn.exit.code}"/>
|
---|
| 220 | </condition>
|
---|
| 221 | </fail>
|
---|
| 222 | </target>
|
---|
| 223 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 224 | </target>
|
---|
| 225 | </project>
|
---|