| 1 | <?xml version="1.0" encoding="UTF-8"?>
|
|---|
| 2 | <project name="mapdust" default="dist" basedir=".">
|
|---|
| 3 |
|
|---|
| 4 | <!-- properties -->
|
|---|
| 5 | <property name="commit.message" value="MapDust bug reporter plugin" />
|
|---|
| 6 | <property name="plugin.main.version" value="3835" />
|
|---|
| 7 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
|---|
| 8 | <property name="plugin.build.dir" value="build/classes" />
|
|---|
| 9 | <property name="apidoc.dir" value="build/doc" />
|
|---|
| 10 | <property name="plugin.src.dir" value="src" />
|
|---|
| 11 | <property name="plugin.lib.dir" value="lib" />
|
|---|
| 12 | <property name="plugin.dist.dir" value="../../dist" />
|
|---|
| 13 | <property name="ant.build.javac.target" value="1.5" />
|
|---|
| 14 | <property name="plugin.dist.dir" value="../../dist" />
|
|---|
| 15 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar" />
|
|---|
| 16 |
|
|---|
| 17 | <!-- classpath -->
|
|---|
| 18 | <path id="classpath">
|
|---|
| 19 | <fileset dir="${plugin.lib.dir}" includes="**/*.jar" />
|
|---|
| 20 | <pathelement path="${josm}"/>
|
|---|
| 21 | </path>
|
|---|
| 22 |
|
|---|
| 23 | <!-- clean the build -->
|
|---|
| 24 | <target name="clean">
|
|---|
| 25 | <delete dir="${plugin.build.dir}" />
|
|---|
| 26 | <delete file="${plugin.jar}" />
|
|---|
| 27 | </target>
|
|---|
| 28 |
|
|---|
| 29 | <!-- initialize the build -->
|
|---|
| 30 | <target name="init" depends="clean">
|
|---|
| 31 | <mkdir dir="${plugin.build.dir}" />
|
|---|
| 32 | </target>
|
|---|
| 33 |
|
|---|
| 34 | <!-- compiles the sources -->
|
|---|
| 35 | <target name="compile" depends="init">
|
|---|
| 36 | <echo message="compiling sources for ${plugin.jar} ... " />
|
|---|
| 37 | <javac srcdir="src" classpathref="classpath" debug="true"
|
|---|
| 38 | destdir="${plugin.build.dir}" includeantruntime="true" target="1.5"
|
|---|
| 39 | source="1.5">
|
|---|
| 40 | <compilerarg value="-Xlint:deprecation" />
|
|---|
| 41 | <compilerarg value="-Xlint:unchecked" />
|
|---|
| 42 | </javac>
|
|---|
| 43 | </target>
|
|---|
| 44 |
|
|---|
| 45 | <!-- creates the javadocs -->
|
|---|
| 46 | <target name="javadoc">
|
|---|
| 47 | <mkdir dir="${apidoc.dir}" />
|
|---|
| 48 | <javadoc destdir="${apidoc.dir}" source="1.6" classpathref="classpath"
|
|---|
| 49 | windowtitle="MapDust plugin API">
|
|---|
| 50 | <link href="http://java.sun.com/javase/6/docs/api/" />
|
|---|
| 51 | <link href="http://docs.jboss.org/hibernate/stable/core/api/" />
|
|---|
| 52 | <packageset dir="${plugin.src.dir}">
|
|---|
| 53 | </packageset>
|
|---|
| 54 | </javadoc>
|
|---|
| 55 |
|
|---|
| 56 | </target>
|
|---|
| 57 |
|
|---|
| 58 | <!-- revision -->
|
|---|
| 59 | <target name="revision">
|
|---|
| 60 | <exec append="false" output="REVISION" executable="svn"
|
|---|
| 61 | failifexecutionfails="false">
|
|---|
| 62 | <env key="LANG" value="C" />
|
|---|
| 63 | <arg value="info" />
|
|---|
| 64 | <arg value="--xml" />
|
|---|
| 65 | <arg value="." />
|
|---|
| 66 | </exec>
|
|---|
| 67 | <xmlproperty file="REVISION" prefix="version" keepRoot="false"
|
|---|
| 68 | collapseAttributes="true" />
|
|---|
| 69 | <delete file="REVISION" />
|
|---|
| 70 | </target>
|
|---|
| 71 |
|
|---|
| 72 | <!-- creates the .jar file of the plugin -->
|
|---|
| 73 | <target name="dist" depends="compile,revision">
|
|---|
| 74 | <echo message="creating ${ant.project.name}.jar ... " />
|
|---|
| 75 | <copy todir="${plugin.build.dir}">
|
|---|
| 76 | <fileset dir="conf" />
|
|---|
| 77 | </copy>
|
|---|
| 78 | <copy todir="${plugin.build.dir}/images">
|
|---|
| 79 | <fileset dir="images" />
|
|---|
| 80 | </copy>
|
|---|
| 81 | <copy todir="${plugin.build.dir}">
|
|---|
| 82 | <fileset dir=".">
|
|---|
| 83 | <include name="README" />
|
|---|
| 84 | <include name="LICENSE" />
|
|---|
| 85 | </fileset>
|
|---|
| 86 | </copy>
|
|---|
| 87 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
|---|
| 88 | <zipfileset src="lib/gson-1.5.jar" includes="**/*.class" />
|
|---|
| 89 | <manifest>
|
|---|
| 90 | <attribute name="Author" value="Beata Jancso" />
|
|---|
| 91 | <attribute name="Plugin-Class"
|
|---|
| 92 | value="org.openstreetmap.josm.plugins.mapdust.MapdustPlugin" />
|
|---|
| 93 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
|---|
| 94 | <attribute name="Plugin-Description"
|
|---|
| 95 | value="The MapDust Plug-In shows the MapDust bug reports on
|
|---|
| 96 | the map. You can create, close,invalidate, re-open and comment
|
|---|
| 97 | bug reports by using this plugin." />
|
|---|
| 98 | <attribute name="Plugin-Link"
|
|---|
| 99 | value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/MapDust" />
|
|---|
| 100 | <attribute name="Plugin-Mainversion"
|
|---|
| 101 | value="${plugin.main.version}" />
|
|---|
| 102 | <attribute name="Plugin-Version"
|
|---|
| 103 | value="${version.entry.commit.revision}" />
|
|---|
| 104 | <attribute name="Plugin-Icon"
|
|---|
| 105 | value="images/dialogs/mapdust_icon25.png" />
|
|---|
| 106 | </manifest>
|
|---|
| 107 | </jar>
|
|---|
| 108 | </target>
|
|---|
| 109 |
|
|---|
| 110 | <!-- installs the plugin -->
|
|---|
| 111 | <target name="install" depends="dist">
|
|---|
| 112 | <property environment="env" />
|
|---|
| 113 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins"
|
|---|
| 114 | else="${user.home}/.josm/plugins">
|
|---|
| 115 | <and>
|
|---|
| 116 | <os family="windows" />
|
|---|
| 117 | </and>
|
|---|
| 118 | </condition>
|
|---|
| 119 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
|
|---|
| 120 | </target>
|
|---|
| 121 |
|
|---|
| 122 | <!-- displays the information about the core josm -->
|
|---|
| 123 | <target name="core-info">
|
|---|
| 124 | <exec append="false" output="core.info.xml" executable="svn"
|
|---|
| 125 | failifexecutionfails="false">
|
|---|
| 126 | <env key="LANG" value="C" />
|
|---|
| 127 | <arg value="info" />
|
|---|
| 128 | <arg value="--xml" />
|
|---|
| 129 | <arg value="../../core" />
|
|---|
| 130 | </exec>
|
|---|
| 131 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true"
|
|---|
| 132 | collapseAttributes="true" />
|
|---|
| 133 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
|---|
| 134 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
|---|
| 135 | <delete file="core.info.xml" />
|
|---|
| 136 | </target>
|
|---|
| 137 |
|
|---|
| 138 | <!-- commits the current sources -->
|
|---|
| 139 | <target name="commit-current">
|
|---|
| 140 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
|---|
| 141 | <exec append="true" output="svn.log" executable="svn"
|
|---|
| 142 | failifexecutionfails="false">
|
|---|
| 143 | <env key="LANG" value="C" />
|
|---|
| 144 | <arg value="commit" />
|
|---|
| 145 | <arg value="-m '${commit.message}'" />
|
|---|
| 146 | <arg value="." />
|
|---|
| 147 | </exec>
|
|---|
| 148 | </target>
|
|---|
| 149 |
|
|---|
| 150 | <!-- updates the plugin -->
|
|---|
| 151 | <target name="update-current">
|
|---|
| 152 | <echo>Updating plugin source ...</echo>
|
|---|
| 153 | <exec append="true" output="svn.log" executable="svn"
|
|---|
| 154 | failifexecutionfails="false">
|
|---|
| 155 | <env key="LANG" value="C" />
|
|---|
| 156 | <arg value="up" />
|
|---|
| 157 | <arg value="." />
|
|---|
| 158 | </exec>
|
|---|
| 159 | <echo>Updating ${plugin.jar} ...</echo>
|
|---|
| 160 | <exec append="true" output="svn.log" executable="svn"
|
|---|
| 161 | failifexecutionfails="false">
|
|---|
| 162 | <env key="LANG" value="C" />
|
|---|
| 163 | <arg value="up" />
|
|---|
| 164 | <arg value="../dist/${plugin.jar}" />
|
|---|
| 165 | </exec>
|
|---|
| 166 | </target>
|
|---|
| 167 |
|
|---|
| 168 | <!-- commit the .jar of the plugin -->
|
|---|
| 169 | <target name="commit-dist">
|
|---|
| 170 | <echo>
|
|---|
| 171 | ***** Properties of published ${plugin.jar} *****
|
|---|
| 172 | Commit message : '${commit.message}'
|
|---|
| 173 | Plugin-Mainversion: ${plugin.main.version}
|
|---|
| 174 | JOSM build version: ${coreversion.info.entry.revision}
|
|---|
| 175 | Plugin-Version : ${version.entry.commit.revision}
|
|---|
| 176 | ***** / Properties of published ${plugin.jar} *****
|
|---|
| 177 |
|
|---|
| 178 | Now commiting ${plugin.jar} ...
|
|---|
| 179 | </echo>
|
|---|
| 180 | <exec append="true" output="svn.log" executable="svn"
|
|---|
| 181 | failifexecutionfails="false">
|
|---|
| 182 | <env key="LANG" value="C" />
|
|---|
| 183 | <arg value="-m '${commit.message}'" />
|
|---|
| 184 | <arg value="commit" />
|
|---|
| 185 | <arg value="${plugin.jar}" />
|
|---|
| 186 | </exec>
|
|---|
| 187 | </target>
|
|---|
| 188 |
|
|---|
| 189 | <!-- ** make sure svn is present as a command line tool ** -->
|
|---|
| 190 | <target name="ensure-svn-present">
|
|---|
| 191 | <exec append="true" output="svn.log" executable="svn"
|
|---|
| 192 | failifexecutionfails="false" failonerror="false"
|
|---|
| 193 | resultproperty="svn.exit.code">
|
|---|
| 194 | <env key="LANG" value="C" />
|
|---|
| 195 | <arg value="--version" />
|
|---|
| 196 | </exec>
|
|---|
| 197 | <fail message="Fatal: command 'svn --version' failed. Please make sure
|
|---|
| 198 | svn is installed on your system.">
|
|---|
| 199 | <!-- return code not set at all? Most likely svn isn't installed -->
|
|---|
| 200 | <condition>
|
|---|
| 201 | <not>
|
|---|
| 202 | <isset property="svn.exit.code" />
|
|---|
| 203 | </not>
|
|---|
| 204 | </condition>
|
|---|
| 205 | </fail>
|
|---|
| 206 | <fail message="Fatal: command 'svn --version' failed. Please make sure
|
|---|
| 207 | a working copy of svn is installed on your system.">
|
|---|
| 208 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
|---|
| 209 | <condition>
|
|---|
| 210 | <isfailure code="${svn.exit.code}" />
|
|---|
| 211 | </condition>
|
|---|
| 212 | </fail>
|
|---|
| 213 | </target>
|
|---|
| 214 |
|
|---|
| 215 | <!-- publish the plugin -->
|
|---|
| 216 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,
|
|---|
| 217 | update-current,clean,dist,commit-dist">
|
|---|
| 218 | </target>
|
|---|
| 219 | </project>
|
|---|