[26174] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
[19043] | 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=".">
|
---|
[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.dist.dir" value="../../dist"/>
|
---|
| 32 | <property name="plugin.build.dir" value="build"/>
|
---|
| 33 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
| 34 | <property name="ant.build.javac.target" value="1.5"/>
|
---|
| 35 | <target name="init">
|
---|
| 36 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 37 | </target>
|
---|
| 38 | <target name="compile" depends="init">
|
---|
| 39 | <echo message="creating ${plugin.jar}"/>
|
---|
| 40 | <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
|
---|
| 41 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 42 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 43 | <classpath>
|
---|
| 44 | <pathelement location="${josm}"/>
|
---|
| 45 | <fileset dir="lib">
|
---|
| 46 | <include name="**/*.jar"/>
|
---|
| 47 | </fileset>
|
---|
| 48 | </classpath>
|
---|
| 49 | </javac>
|
---|
| 50 | <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xml" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
|
---|
| 51 | <copy file="src/org/openstreetmap/josm/plugins/routes/xml/routes.xsd" todir="${plugin.build.dir}/org/openstreetmap/josm/plugins/routes/xml"/>
|
---|
| 52 | </target>
|
---|
| 53 | <target name="dist" depends="compile,revision">
|
---|
| 54 | <copy todir="${plugin.build.dir}/data">
|
---|
| 55 | <fileset dir="data"/>
|
---|
| 56 | </copy>
|
---|
| 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 | ************************** Publishing the plugin ***********************************
|
---|
| 97 | -->
|
---|
| 98 | <!--
|
---|
| 99 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
| 100 | ** property ${coreversion.info.entry.revision}
|
---|
| 101 | **
|
---|
| 102 | -->
|
---|
| 103 | <target name="core-info">
|
---|
| 104 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 105 | <env key="LANG" value="C"/>
|
---|
| 106 | <arg value="info"/>
|
---|
| 107 | <arg value="--xml"/>
|
---|
| 108 | <arg value="../../core"/>
|
---|
| 109 | </exec>
|
---|
| 110 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 111 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 112 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 113 | <delete file="core.info.xml"/>
|
---|
| 114 | </target>
|
---|
| 115 | <!--
|
---|
| 116 | ** commits the source tree for this plugin
|
---|
| 117 | -->
|
---|
| 118 | <target name="commit-current">
|
---|
| 119 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 120 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 121 | <env key="LANG" value="C"/>
|
---|
| 122 | <arg value="commit"/>
|
---|
| 123 | <arg value="-m '${commit.message}'"/>
|
---|
| 124 | <arg value="."/>
|
---|
| 125 | </exec>
|
---|
| 126 | </target>
|
---|
| 127 | <!--
|
---|
| 128 | ** updates (svn up) the source tree for this plugin
|
---|
| 129 | -->
|
---|
| 130 | <target name="update-current">
|
---|
| 131 | <echo>Updating plugin source ...</echo>
|
---|
| 132 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 133 | <env key="LANG" value="C"/>
|
---|
| 134 | <arg value="up"/>
|
---|
| 135 | <arg value="."/>
|
---|
| 136 | </exec>
|
---|
| 137 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 138 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 139 | <env key="LANG" value="C"/>
|
---|
| 140 | <arg value="up"/>
|
---|
| 141 | <arg value="../dist/${plugin.jar}"/>
|
---|
| 142 | </exec>
|
---|
| 143 | </target>
|
---|
| 144 | <!--
|
---|
| 145 | ** commits the plugin.jar
|
---|
| 146 | -->
|
---|
| 147 | <target name="commit-dist">
|
---|
| 148 | <echo>
|
---|
| 149 | ***** Properties of published ${plugin.jar} *****
|
---|
| 150 | Commit message : '${commit.message}'
|
---|
| 151 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 152 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 153 | Plugin-Version : ${version.entry.commit.revision}
|
---|
| 154 | ***** / Properties of published ${plugin.jar} *****
|
---|
[19043] | 155 |
|
---|
[26174] | 156 | Now commiting ${plugin.jar} ...
|
---|
| 157 | </echo>
|
---|
| 158 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 159 | <env key="LANG" value="C"/>
|
---|
| 160 | <arg value="-m '${commit.message}'"/>
|
---|
| 161 | <arg value="commit"/>
|
---|
| 162 | <arg value="${plugin.jar}"/>
|
---|
| 163 | </exec>
|
---|
| 164 | </target>
|
---|
| 165 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 166 | <target name="ensure-svn-present">
|
---|
| 167 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 168 | <env key="LANG" value="C"/>
|
---|
| 169 | <arg value="--version"/>
|
---|
| 170 | </exec>
|
---|
| 171 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 172 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 173 | <condition>
|
---|
| 174 | <not>
|
---|
| 175 | <isset property="svn.exit.code"/>
|
---|
| 176 | </not>
|
---|
| 177 | </condition>
|
---|
| 178 | </fail>
|
---|
| 179 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 180 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 181 | <condition>
|
---|
| 182 | <isfailure code="${svn.exit.code}"/>
|
---|
| 183 | </condition>
|
---|
| 184 | </fail>
|
---|
| 185 | </target>
|
---|
| 186 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 187 | </target>
|
---|
[16428] | 188 | </project>
|
---|