[18922] | 1 | <!--
|
---|
| 2 | ** This is a template build file for the osmarender plugin
|
---|
| 3 | **
|
---|
| 4 | ** Maintaining versions
|
---|
| 5 | ** ====================
|
---|
| 6 | ** see README.template
|
---|
| 7 | **
|
---|
| 8 | ** Usage
|
---|
| 9 | ** =====
|
---|
| 10 | ** To build it run
|
---|
| 11 | **
|
---|
| 12 | ** > ant dist
|
---|
| 13 | **
|
---|
| 14 | ** To install the generated plugin locally (in your default plugin directory) run
|
---|
| 15 | **
|
---|
| 16 | ** > ant install
|
---|
| 17 | **
|
---|
| 18 | ** To build against the core in ../../core, create a correct manifest and deploy to
|
---|
[21422] | 19 | ** SVN,
|
---|
[18922] | 20 | ** set the properties commit.message and plugin.main.version
|
---|
| 21 | ** and run
|
---|
| 22 | ** > ant publish
|
---|
| 23 | **
|
---|
| 24 | **
|
---|
| 25 | -->
|
---|
[1471] | 26 | <project name="osmarender" default="install" basedir=".">
|
---|
[18951] | 27 | <property name="josm" location="../../core/dist/josm-custom.jar" />
|
---|
| 28 | <property name="plugin.dist.dir" value="../../dist" />
|
---|
| 29 | <property name="plugin.build.dir" value="build" />
|
---|
| 30 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar" />
|
---|
| 31 | <property name="ant.build.javac.target" value="1.5" />
|
---|
| 32 | <property name="stylesheets" location="./stylesheets" />
|
---|
| 33 | <property name="xslt" location="./xslt" />
|
---|
[18922] | 34 |
|
---|
[18951] | 35 |
|
---|
[19419] | 36 | <property name="commit.message" value="Fixed #4360 - osmarender plugin does not load" />
|
---|
| 37 | <property name="plugin.main.version" value="2830" />
|
---|
[18951] | 38 |
|
---|
| 39 | <target name="init">
|
---|
| 40 | <mkdir dir="${plugin.build.dir}" />
|
---|
| 41 | </target>
|
---|
| 42 |
|
---|
| 43 | <target name="compile" depends="init">
|
---|
| 44 | <echo message="creating ${plugin.jar}" />
|
---|
| 45 | <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
|
---|
| 46 | <compilerarg value="-Xlint:deprecation" />
|
---|
| 47 | <compilerarg value="-Xlint:unchecked" />
|
---|
| 48 | </javac>
|
---|
| 49 | </target>
|
---|
[21422] | 50 | <target name="copy-styles">
|
---|
[18951] | 51 | <copy todir="${plugin.build.dir}" file="${xslt}/osmarender.xsl" />
|
---|
| 52 | <copy tofile="${plugin.build.dir}/osm-map-features.xml" file="${stylesheets}/osm-map-features-z17.xml" />
|
---|
[21422] | 53 | </target>
|
---|
| 54 | <target name="dist" depends="compile,revision,copy-styles">
|
---|
[18951] | 55 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
| 56 | <manifest>
|
---|
| 57 | <attribute name="Author" value="80n" />
|
---|
| 58 | <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.osmarender.OsmarenderPlugin" />
|
---|
| 59 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
---|
| 60 | <attribute name="Plugin-Description" value="Launches FireFox to display the current visible screen as a nice SVG image." />
|
---|
| 61 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
|
---|
| 62 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
|
---|
| 63 | </manifest>
|
---|
| 64 | </jar>
|
---|
| 65 | </target>
|
---|
| 66 | <target name="revision">
|
---|
[19296] | 67 | <exec append="false" output="REVISION" executable="perl" failifexecutionfails="false">
|
---|
| 68 | <env key="LANG" value="C"/>
|
---|
| 69 | <arg value="../getrevision.pl"/>
|
---|
| 70 | <arg value="xslt"/>
|
---|
| 71 | <arg value="stylesheets"/>
|
---|
| 72 | <arg value="." />
|
---|
| 73 | </exec>
|
---|
[21252] | 74 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
|
---|
[19296] | 75 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="true" failonerror="true">
|
---|
[18951] | 76 | <env key="LANG" value="C" />
|
---|
| 77 | <arg value="info" />
|
---|
| 78 | <arg value="--xml" />
|
---|
[18971] | 79 | <arg value="." />
|
---|
[18951] | 80 | </exec>
|
---|
| 81 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
|
---|
[21252] | 82 | <echo message="Revision is ${version.entry.commit.revision}" />
|
---|
[18951] | 83 | <delete file="REVISION" />
|
---|
| 84 | </target>
|
---|
| 85 | <target name="clean">
|
---|
| 86 | <delete dir="${plugin.build.dir}" />
|
---|
| 87 | <delete file="${plugin.jar}" />
|
---|
| 88 | </target>
|
---|
| 89 | <target name="install" depends="dist">
|
---|
| 90 | <property environment="env" />
|
---|
| 91 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
| 92 | <and>
|
---|
| 93 | <os family="windows" />
|
---|
| 94 | </and>
|
---|
| 95 | </condition>
|
---|
| 96 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
|
---|
| 97 | </target>
|
---|
| 98 |
|
---|
[18922] | 99 | <!--
|
---|
[21422] | 100 | ************************** Publishing the plugin ***********************************
|
---|
[19296] | 101 | -->
|
---|
| 102 | <!--
|
---|
[21422] | 103 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
[19296] | 104 | ** property ${coreversion.info.entry.revision}
|
---|
| 105 | **
|
---|
| 106 | -->
|
---|
[18951] | 107 | <target name="core-info">
|
---|
[19296] | 108 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 109 | <env key="LANG" value="C"/>
|
---|
| 110 | <arg value="info"/>
|
---|
| 111 | <arg value="--xml"/>
|
---|
| 112 | <arg value="../../core"/>
|
---|
[18951] | 113 | </exec>
|
---|
[19296] | 114 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
[18951] | 115 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 116 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 117 | <delete file="core.info.xml" />
|
---|
| 118 | </target>
|
---|
[18922] | 119 |
|
---|
[19296] | 120 | <!--
|
---|
| 121 | ** commits the source tree for this plugin
|
---|
| 122 | -->
|
---|
[18951] | 123 | <target name="commit-current">
|
---|
| 124 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
[19296] | 125 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 126 | <env key="LANG" value="C"/>
|
---|
| 127 | <arg value="commit"/>
|
---|
| 128 | <arg value="-m '${commit.message}'"/>
|
---|
| 129 | <arg value="."/>
|
---|
[18951] | 130 | </exec>
|
---|
| 131 | </target>
|
---|
[18922] | 132 |
|
---|
[19296] | 133 | <!--
|
---|
| 134 | ** updates (svn up) the source tree for this plugin
|
---|
| 135 | -->
|
---|
[18951] | 136 | <target name="update-current">
|
---|
| 137 | <echo>Updating plugin source ...</echo>
|
---|
[19296] | 138 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 139 | <env key="LANG" value="C"/>
|
---|
| 140 | <arg value="up"/>
|
---|
| 141 | <arg value="."/>
|
---|
[18951] | 142 | </exec>
|
---|
| 143 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
[19296] | 144 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 145 | <env key="LANG" value="C"/>
|
---|
| 146 | <arg value="up"/>
|
---|
| 147 | <arg value="../dist/${plugin.jar}"/>
|
---|
[18951] | 148 | </exec>
|
---|
| 149 | </target>
|
---|
| 150 |
|
---|
[19296] | 151 | <!--
|
---|
[21422] | 152 | ** commits the plugin.jar
|
---|
[19296] | 153 | -->
|
---|
[18951] | 154 | <target name="commit-dist">
|
---|
| 155 | <echo>
|
---|
[18922] | 156 | ***** Properties of published ${plugin.jar} *****
|
---|
[21422] | 157 | Commit message : '${commit.message}'
|
---|
[18922] | 158 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 159 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 160 | Plugin-Version : ${version.entry.commit.revision}
|
---|
[21422] | 161 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 162 |
|
---|
[18922] | 163 | Now commiting ${plugin.jar} ...
|
---|
[18951] | 164 | </echo>
|
---|
[19296] | 165 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 166 | <env key="LANG" value="C"/>
|
---|
| 167 | <arg value="-m '${commit.message}'"/>
|
---|
| 168 | <arg value="commit"/>
|
---|
| 169 | <arg value="${plugin.jar}"/>
|
---|
[18951] | 170 | </exec>
|
---|
| 171 | </target>
|
---|
| 172 |
|
---|
| 173 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 174 | <target name="ensure-svn-present">
|
---|
[19296] | 175 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 176 | <env key="LANG" value="C" />
|
---|
| 177 | <arg value="--version" />
|
---|
[18951] | 178 | </exec>
|
---|
[19296] | 179 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 180 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
[18951] | 181 | <condition>
|
---|
[19296] | 182 | <not>
|
---|
| 183 | <isset property="svn.exit.code" />
|
---|
| 184 | </not>
|
---|
| 185 | </condition>
|
---|
| 186 | </fail>
|
---|
| 187 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 188 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 189 | <condition>
|
---|
[18951] | 190 | <isfailure code="${svn.exit.code}" />
|
---|
| 191 | </condition>
|
---|
| 192 | </fail>
|
---|
| 193 | </target>
|
---|
| 194 |
|
---|
| 195 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 196 | </target>
|
---|
[1438] | 197 | </project>
|
---|