[19043] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
| 2 | <!--
|
---|
| 3 | ** This is the build file for the routes 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
|
---|
[20427] | 20 | ** SVN,
|
---|
[19043] | 21 | ** set the properties commit.message and plugin.main.version
|
---|
| 22 | ** and run
|
---|
| 23 | ** > ant publish
|
---|
| 24 | **
|
---|
| 25 | **
|
---|
| 26 | -->
|
---|
[16428] | 27 | <project name="routes" default="dist" basedir=".">
|
---|
[19043] | 28 |
|
---|
[19473] | 29 | <property name="commit.message" value="Changed the constructor signature of the plugin main class" />
|
---|
[23422] | 30 | <property name="plugin.main.version" value="3565" />
|
---|
[19043] | 31 |
|
---|
| 32 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
---|
| 33 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
| 34 | <property name="plugin.build.dir" value="build"/>
|
---|
| 35 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
| 36 | <property name="ant.build.javac.target" value="1.5"/>
|
---|
| 37 | <target name="init">
|
---|
| 38 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 39 | </target>
|
---|
| 40 | <target name="compile" depends="init">
|
---|
| 41 | <echo message="creating ${plugin.jar}"/>
|
---|
| 42 | <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
|
---|
| 43 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 44 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 45 | <classpath>
|
---|
| 46 | <pathelement location="${josm}"/>
|
---|
| 47 | <fileset dir="lib">
|
---|
| 48 | <include name="**/*.jar"/>
|
---|
| 49 | </fileset>
|
---|
| 50 | </classpath>
|
---|
| 51 | </javac>
|
---|
| 52 | <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xml" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
|
---|
| 53 | <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xsd" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
|
---|
| 54 |
|
---|
| 55 | </target>
|
---|
| 56 | <target name="dist" depends="compile,revision">
|
---|
| 57 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
| 58 | <zipfileset src="lib/jsr173-1.0_api.jar" includes="**/*"/>
|
---|
| 59 | <zipfileset src="lib/jaxb-api.jar" includes="**/*"/>
|
---|
| 60 | <zipfileset src="lib/jaxb-impl.jar" includes="**/*.class"/>
|
---|
| 61 | <zipfileset src="lib/activation.jar" includes="**/*.class"/>
|
---|
| 62 | <manifest>
|
---|
| 63 | <attribute name="Author" value="Jiri Klement"/>
|
---|
| 64 | <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.routes.RoutesPlugin"/>
|
---|
| 65 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
| 66 | <attribute name="Plugin-Description" value="Renders routes (bus, hiking trails, bicycle routes, ..). Route types must be defined in routes.xml file in plugin directory"/>
|
---|
| 67 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 68 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 69 | </manifest>
|
---|
| 70 | </jar>
|
---|
| 71 | </target>
|
---|
| 72 | <target name="revision">
|
---|
| 73 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
| 74 | <env key="LANG" value="C"/>
|
---|
| 75 | <arg value="info"/>
|
---|
| 76 | <arg value="--xml"/>
|
---|
| 77 | <arg value="."/>
|
---|
| 78 | </exec>
|
---|
| 79 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 80 | <delete file="REVISION"/>
|
---|
| 81 | </target>
|
---|
| 82 | <target name="clean">
|
---|
| 83 | <delete dir="${plugin.build.dir}"/>
|
---|
| 84 | <delete file="${plugin.jar}"/>
|
---|
| 85 | </target>
|
---|
| 86 | <target name="install" depends="dist">
|
---|
| 87 | <property environment="env"/>
|
---|
| 88 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
| 89 | <and>
|
---|
| 90 | <os family="windows"/>
|
---|
| 91 | </and>
|
---|
| 92 | </condition>
|
---|
| 93 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 94 | </target>
|
---|
| 95 |
|
---|
| 96 |
|
---|
| 97 | <!--
|
---|
[20427] | 98 | ************************** Publishing the plugin ***********************************
|
---|
[19043] | 99 | -->
|
---|
| 100 | <!--
|
---|
[20427] | 101 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
[19043] | 102 | ** property ${coreversion.info.entry.revision}
|
---|
| 103 | **
|
---|
| 104 | -->
|
---|
| 105 | <target name="core-info">
|
---|
| 106 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 107 | <env key="LANG" value="C"/>
|
---|
| 108 | <arg value="info"/>
|
---|
| 109 | <arg value="--xml"/>
|
---|
| 110 | <arg value="../../core"/>
|
---|
| 111 | </exec>
|
---|
| 112 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 113 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 114 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 115 | <delete file="core.info.xml" />
|
---|
| 116 | </target>
|
---|
| 117 |
|
---|
| 118 | <!--
|
---|
| 119 | ** commits the source tree for this plugin
|
---|
| 120 | -->
|
---|
| 121 | <target name="commit-current">
|
---|
| 122 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 123 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 124 | <env key="LANG" value="C"/>
|
---|
| 125 | <arg value="commit"/>
|
---|
| 126 | <arg value="-m '${commit.message}'"/>
|
---|
| 127 | <arg value="."/>
|
---|
| 128 | </exec>
|
---|
| 129 | </target>
|
---|
| 130 |
|
---|
| 131 | <!--
|
---|
| 132 | ** updates (svn up) the source tree for this plugin
|
---|
| 133 | -->
|
---|
| 134 | <target name="update-current">
|
---|
| 135 | <echo>Updating plugin source ...</echo>
|
---|
| 136 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 137 | <env key="LANG" value="C"/>
|
---|
| 138 | <arg value="up"/>
|
---|
| 139 | <arg value="."/>
|
---|
| 140 | </exec>
|
---|
| 141 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 142 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 143 | <env key="LANG" value="C"/>
|
---|
| 144 | <arg value="up"/>
|
---|
| 145 | <arg value="../dist/${plugin.jar}"/>
|
---|
| 146 | </exec>
|
---|
| 147 | </target>
|
---|
| 148 |
|
---|
| 149 | <!--
|
---|
[20427] | 150 | ** commits the plugin.jar
|
---|
[19043] | 151 | -->
|
---|
| 152 | <target name="commit-dist">
|
---|
| 153 | <echo>
|
---|
| 154 | ***** Properties of published ${plugin.jar} *****
|
---|
[20427] | 155 | Commit message : '${commit.message}'
|
---|
[19043] | 156 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 157 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 158 | Plugin-Version : ${version.entry.commit.revision}
|
---|
[20427] | 159 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 160 |
|
---|
[19043] | 161 | Now commiting ${plugin.jar} ...
|
---|
| 162 | </echo>
|
---|
| 163 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 164 | <env key="LANG" value="C"/>
|
---|
| 165 | <arg value="-m '${commit.message}'"/>
|
---|
| 166 | <arg value="commit"/>
|
---|
| 167 | <arg value="${plugin.jar}"/>
|
---|
| 168 | </exec>
|
---|
| 169 | </target>
|
---|
| 170 |
|
---|
| 171 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 172 | <target name="ensure-svn-present">
|
---|
| 173 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 174 | <env key="LANG" value="C" />
|
---|
| 175 | <arg value="--version" />
|
---|
| 176 | </exec>
|
---|
| 177 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 178 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 179 | <condition>
|
---|
| 180 | <not>
|
---|
| 181 | <isset property="svn.exit.code" />
|
---|
| 182 | </not>
|
---|
| 183 | </condition>
|
---|
| 184 | </fail>
|
---|
| 185 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 186 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 187 | <condition>
|
---|
| 188 | <isfailure code="${svn.exit.code}" />
|
---|
| 189 | </condition>
|
---|
| 190 | </fail>
|
---|
| 191 | </target>
|
---|
| 192 |
|
---|
| 193 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 194 | </target>
|
---|
[16428] | 195 | </project>
|
---|