[26174] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
[25501] | 2 | <!--
|
---|
| 3 | ** This is the build file for the junctionchecking plugin
|
---|
| 4 | **
|
---|
| 5 | ** Maintaining versions
|
---|
| 6 | ** ====================
|
---|
| 7 | ** see README.template
|
---|
| 8 | **
|
---|
| 9 | ** Usage
|
---|
| 10 | ** =====
|
---|
| 11 | ** To build it run
|
---|
| 12 | **
|
---|
| 13 | ** > ant dist
|
---|
| 14 | **
|
---|
| 15 | ** To install the generated plugin locally (in your default plugin directory) run
|
---|
| 16 | **
|
---|
| 17 | ** > ant install
|
---|
| 18 | **
|
---|
| 19 | ** To build against the core in ../../core, create a correct manifest and deploy to
|
---|
| 20 | ** SVN,
|
---|
| 21 | ** set the properties commit.message and plugin.main.version
|
---|
| 22 | ** and run
|
---|
| 23 | ** > ant publish
|
---|
| 24 | **
|
---|
| 25 | **
|
---|
| 26 | -->
|
---|
| 27 | <project name="junctionchecking" default="dist" basedir=".">
|
---|
[26174] | 28 | <property name="commit.message" value="Changed the constructor signature of the plugin main class"/>
|
---|
[26605] | 29 | <property name="plugin.main.version" value="4394"/>
|
---|
[26174] | 30 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
---|
| 31 | <property name="plugin.build.dir" value="build"/>
|
---|
| 32 | <property name="plugin.src.dir" value="src"/>
|
---|
| 33 | <!-- this is the directory where the plugin jar is copied to -->
|
---|
| 34 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
| 35 | <property name="ant.build.javac.target" value="1.5"/>
|
---|
| 36 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
| 37 | <!--
|
---|
[25501] | 38 | **********************************************************
|
---|
| 39 | ** init - initializes the build
|
---|
| 40 | **********************************************************
|
---|
| 41 | -->
|
---|
[26174] | 42 | <target name="init">
|
---|
| 43 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 44 | </target>
|
---|
| 45 | <!--
|
---|
[25501] | 46 | **********************************************************
|
---|
| 47 | ** compile - complies the source tree
|
---|
| 48 | **********************************************************
|
---|
| 49 | -->
|
---|
[26174] | 50 | <target name="compile" depends="init">
|
---|
| 51 | <echo message="compiling sources for ${plugin.jar} ... "/>
|
---|
| 52 | <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
|
---|
| 53 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 54 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 55 | </javac>
|
---|
| 56 | </target>
|
---|
| 57 | <!--
|
---|
[25501] | 58 | **********************************************************
|
---|
| 59 | ** dist - creates the plugin jar
|
---|
| 60 | **********************************************************
|
---|
| 61 | -->
|
---|
[26174] | 62 | <!-- <target name="dist" depends="compile,revision">
|
---|
[25501] | 63 | -->
|
---|
[26174] | 64 | <target name="dist" depends="compile, revision">
|
---|
| 65 | <echo message="creating ${plugin.jar} ... "/>
|
---|
| 66 | <copy todir="${plugin.build.dir}/resources">
|
---|
| 67 | <fileset dir="resources"/>
|
---|
| 68 | </copy>
|
---|
| 69 | <copy todir="${plugin.build.dir}/images">
|
---|
| 70 | <fileset dir="images"/>
|
---|
| 71 | </copy>
|
---|
| 72 | <copy todir="${plugin.build.dir}/data">
|
---|
| 73 | <fileset dir="data"/>
|
---|
| 74 | </copy>
|
---|
| 75 | <copy todir="${plugin.build.dir}">
|
---|
| 76 | <fileset dir=".">
|
---|
| 77 | <include name="LICENSE"/>
|
---|
| 78 | <include name="README"/>
|
---|
| 79 | </fileset>
|
---|
| 80 | </copy>
|
---|
| 81 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
| 82 | <manifest>
|
---|
| 83 | <attribute name="Author" value="Jörg Possin"/>
|
---|
| 84 | <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.JunctionChecker.JunctionCheckerPlugin"/>
|
---|
| 85 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
| 86 | <attribute name="Plugin-Description" value="creates a channel digraph and checks a subset of channels if it is a junction or searches in a subset of channels for junctions"/>
|
---|
| 87 | <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/JunctionChecking"/>
|
---|
| 88 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 89 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 90 | <attribute name="Plugin-Icon" value="images/dialogs/junctionchecker.png"/>
|
---|
| 91 | <attribute name="Class-Path" value="resources/"/>
|
---|
| 92 | <attribute name="Main-Class" value="org.openstreetmap.josm.plugins.JunctionChecker.commandlineinterface.CLI"/>
|
---|
| 93 | </manifest>
|
---|
| 94 | </jar>
|
---|
| 95 | </target>
|
---|
| 96 | <!--
|
---|
[25501] | 97 | **********************************************************
|
---|
| 98 | ** revision - extracts the current revision number for the
|
---|
| 99 | ** file build.number and stores it in the XML property
|
---|
| 100 | ** version.*
|
---|
| 101 | **********************************************************
|
---|
| 102 | -->
|
---|
[26174] | 103 | <target name="revision">
|
---|
[25501] | 104 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
| 105 | <env key="LANG" value="C"/>
|
---|
| 106 | <arg value="info"/>
|
---|
| 107 | <arg value="--xml"/>
|
---|
| 108 | <arg value="."/>
|
---|
| 109 | </exec>
|
---|
| 110 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 111 | <delete file="REVISION"/>
|
---|
| 112 | </target>
|
---|
[26174] | 113 | <!--
|
---|
[25501] | 114 | **********************************************************
|
---|
| 115 | ** clean - clean up the build environment
|
---|
| 116 | **********************************************************
|
---|
| 117 | -->
|
---|
[26174] | 118 | <target name="clean">
|
---|
| 119 | <delete dir="${plugin.build.dir}"/>
|
---|
| 120 | <delete file="${plugin.jar}"/>
|
---|
| 121 | </target>
|
---|
| 122 | <!--
|
---|
[25501] | 123 | **********************************************************
|
---|
| 124 | ** install - install the plugin in your local JOSM installation
|
---|
| 125 | **********************************************************
|
---|
| 126 | -->
|
---|
[26174] | 127 | <target name="install" depends="dist">
|
---|
| 128 | <property environment="env"/>
|
---|
| 129 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
| 130 | <and>
|
---|
| 131 | <os family="windows"/>
|
---|
| 132 | </and>
|
---|
| 133 | </condition>
|
---|
| 134 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 135 | </target>
|
---|
| 136 | <!--
|
---|
| 137 | ************************** Publishing the plugin ***********************************
|
---|
| 138 | -->
|
---|
| 139 | <!--
|
---|
| 140 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
| 141 | ** property ${coreversion.info.entry.revision}
|
---|
| 142 | **
|
---|
| 143 | -->
|
---|
| 144 | <target name="core-info">
|
---|
| 145 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 146 | <env key="LANG" value="C"/>
|
---|
| 147 | <arg value="info"/>
|
---|
| 148 | <arg value="--xml"/>
|
---|
| 149 | <arg value="../../core"/>
|
---|
| 150 | </exec>
|
---|
| 151 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 152 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 153 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 154 | <delete file="core.info.xml"/>
|
---|
| 155 | </target>
|
---|
| 156 | <!--
|
---|
| 157 | ** commits the source tree for this plugin
|
---|
| 158 | -->
|
---|
| 159 | <target name="commit-current">
|
---|
| 160 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 161 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 162 | <env key="LANG" value="C"/>
|
---|
| 163 | <arg value="commit"/>
|
---|
| 164 | <arg value="-m '${commit.message}'"/>
|
---|
| 165 | <arg value="."/>
|
---|
| 166 | </exec>
|
---|
| 167 | </target>
|
---|
| 168 | <!--
|
---|
| 169 | ** updates (svn up) the source tree for this plugin
|
---|
| 170 | -->
|
---|
| 171 | <target name="update-current">
|
---|
| 172 | <echo>Updating plugin source ...</echo>
|
---|
| 173 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 174 | <env key="LANG" value="C"/>
|
---|
| 175 | <arg value="up"/>
|
---|
| 176 | <arg value="."/>
|
---|
| 177 | </exec>
|
---|
| 178 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 179 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 180 | <env key="LANG" value="C"/>
|
---|
| 181 | <arg value="up"/>
|
---|
| 182 | <arg value="../dist/${plugin.jar}"/>
|
---|
| 183 | </exec>
|
---|
| 184 | </target>
|
---|
| 185 | <!--
|
---|
| 186 | ** commits the plugin.jar
|
---|
| 187 | -->
|
---|
| 188 | <target name="commit-dist">
|
---|
| 189 | <echo>
|
---|
| 190 | ***** Properties of published ${plugin.jar} *****
|
---|
| 191 | Commit message : '${commit.message}'
|
---|
| 192 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 193 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 194 | Plugin-Version : ${version.entry.commit.revision}
|
---|
| 195 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 196 |
|
---|
| 197 | Now commiting ${plugin.jar} ...
|
---|
| 198 | </echo>
|
---|
| 199 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 200 | <env key="LANG" value="C"/>
|
---|
| 201 | <arg value="-m '${commit.message}'"/>
|
---|
| 202 | <arg value="commit"/>
|
---|
| 203 | <arg value="${plugin.jar}"/>
|
---|
| 204 | </exec>
|
---|
| 205 | </target>
|
---|
| 206 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 207 | <target name="ensure-svn-present">
|
---|
| 208 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 209 | <env key="LANG" value="C"/>
|
---|
| 210 | <arg value="--version"/>
|
---|
| 211 | </exec>
|
---|
| 212 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 213 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 214 | <condition>
|
---|
| 215 | <not>
|
---|
| 216 | <isset property="svn.exit.code"/>
|
---|
| 217 | </not>
|
---|
| 218 | </condition>
|
---|
| 219 | </fail>
|
---|
| 220 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 221 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 222 | <condition>
|
---|
| 223 | <isfailure code="${svn.exit.code}"/>
|
---|
| 224 | </condition>
|
---|
| 225 | </fail>
|
---|
| 226 | </target>
|
---|
| 227 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 228 | </target>
|
---|
[25501] | 229 | </project>
|
---|