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