[26341] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <!--
|
---|
| 3 | ** Template for the build targets common to all plugins
|
---|
| 4 | ** ====================================================
|
---|
| 5 | **
|
---|
| 6 | ** To override a property, add it to the plugin build.xml _before_
|
---|
| 7 | ** this template has been imported.
|
---|
| 8 | ** To override a target, add it _after_ this template has been imported.
|
---|
| 9 | **
|
---|
| 10 | ** Paths are relative to the build.xml that imports this template.
|
---|
| 11 | **
|
---|
| 12 | -->
|
---|
[33333] | 13 | <project name="plugin_common" basedir="." xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if">
|
---|
[26341] | 14 |
|
---|
[31508] | 15 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
---|
| 16 | <property name="josm.test.build.dir" location="../../core/test/build"/>
|
---|
[33330] | 17 | <property name="error_prone_ant.jar" location="../00_core_tools/error_prone_ant.jar"/>
|
---|
[33135] | 18 | <property name="checkstyle.jar" location="../00_core_tools/checkstyle/checkstyle-all.jar"/>
|
---|
[33491] | 19 | <property name="checkstyle-build.dir" location="../00_core_tools/checkstyle/build"/>
|
---|
[33591] | 20 | <property name="spotbugs-ant.jar" location="../00_core_tools/spotbugs/spotbugs-ant.jar"/>
|
---|
| 21 | <property name="annotations.jar" location="../00_core_tools/spotbugs/spotbugs-annotations.jar"/>
|
---|
[30550] | 22 | <property name="plugin.build.dir" location="build"/>
|
---|
| 23 | <property name="plugin.test.dir" location="test"/>
|
---|
| 24 | <property name="plugin.src.dir" location="src"/>
|
---|
[34045] | 25 | <property name="plugin.doc.dir" location="javadoc"/>
|
---|
[30550] | 26 | <property name="plugin.lib.dir" location="lib"/>
|
---|
[26341] | 27 | <!-- this is the directory where the plugin jar is copied to -->
|
---|
[30550] | 28 | <property name="plugin.dist.dir" location="../../dist"/>
|
---|
[32678] | 29 | <property name="ant.build.javac.target" value="1.8"/>
|
---|
| 30 | <property name="ant.build.javac.source" value="1.8"/>
|
---|
[30550] | 31 | <property name="plugin.jar" location="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
[34045] | 32 | <property name="plugin.sources.jar" location="${plugin.dist.dir}/${ant.project.name}-sources.jar"/>
|
---|
| 33 | <property name="plugin.javadoc.jar" location="${plugin.dist.dir}/${ant.project.name}-javadoc.jar"/>
|
---|
[32777] | 34 | <property name="javac.compiler" value="com.google.errorprone.ErrorProneAntCompilerAdapter" />
|
---|
[26341] | 35 |
|
---|
[30699] | 36 | <!-- For Windows-specific stuff -->
|
---|
| 37 | <condition property="isWindows">
|
---|
| 38 | <os family="Windows"/>
|
---|
| 39 | </condition>
|
---|
[32900] | 40 | <!-- For Java9-specific stuff -->
|
---|
| 41 | <condition property="isJava9">
|
---|
[33423] | 42 | <matches string="${ant.java.version}" pattern="(1.)?9" />
|
---|
[32900] | 43 | </condition>
|
---|
| 44 | <target name="-jaxb_before9" unless="isJava9">
|
---|
| 45 | <property name="xjc" value="${java.home}${file.separator}..${file.separator}bin${file.separator}xjc" />
|
---|
[30699] | 46 | </target>
|
---|
[32900] | 47 | <target name="-jaxb_after9" if="isJava9">
|
---|
| 48 | <property name="xjc" value="${java.home}${file.separator}bin${file.separator}xjc" />
|
---|
[30699] | 49 | </target>
|
---|
| 50 |
|
---|
[30747] | 51 | <!-- To be overriden in plugin build file before inclusion if other plugins are required -->
|
---|
| 52 | <fileset id="plugin.requires.jars" dir="${plugin.dist.dir}" includes="nothing"/>
|
---|
| 53 |
|
---|
[32312] | 54 | <path id="plugin.classpath">
|
---|
| 55 | <pathelement location="${josm}"/>
|
---|
| 56 | <fileset dir="${plugin.lib.dir}" erroronmissingdir="no">
|
---|
| 57 | <include name="**/*.jar"/>
|
---|
| 58 | <exclude name="**/*-sources.jar"/>
|
---|
| 59 | <exclude name="**/*-javadoc.jar"/>
|
---|
| 60 | </fileset>
|
---|
| 61 | <fileset refid="plugin.requires.jars"/>
|
---|
| 62 | </path>
|
---|
| 63 |
|
---|
[26341] | 64 | <!--
|
---|
| 65 | **********************************************************
|
---|
| 66 | ** init - initializes the build
|
---|
| 67 | **********************************************************
|
---|
| 68 | -->
|
---|
| 69 | <target name="init">
|
---|
| 70 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 71 | </target>
|
---|
| 72 | <!--
|
---|
| 73 | **********************************************************
|
---|
[29442] | 74 | ** compile - compiles the source tree
|
---|
[26341] | 75 | **********************************************************
|
---|
| 76 | -->
|
---|
[32322] | 77 | <target name="pre-compile">
|
---|
| 78 | <!-- to be overidden by plugins that need to perform additional tasks before compiling -->
|
---|
| 79 | </target>
|
---|
| 80 | <target name="compile" depends="init, pre-compile" unless="skip-compile">
|
---|
[28290] | 81 | <echo message="compiling sources for ${plugin.jar} ..."/>
|
---|
[34059] | 82 | <javac compiler="${javac.compiler}" srcdir="${plugin.src.dir}" debug="true" destdir="${plugin.build.dir}" includeantruntime="false" encoding="UTF-8">
|
---|
[32678] | 83 | <compilerclasspath>
|
---|
| 84 | <pathelement location="${error_prone_ant.jar}"/>
|
---|
| 85 | </compilerclasspath>
|
---|
[26341] | 86 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 87 | <compilerarg value="-Xlint:unchecked"/>
|
---|
[34010] | 88 | <compilerarg value="-Xep:StringSplitter:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
[32777] | 89 | <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
[33059] | 90 | <compilerarg value="-Xep:InsecureCryptoUsage:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
[33181] | 91 | <compilerarg value="-Xep:FutureReturnValueIgnored:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
[33763] | 92 | <compilerarg value="-Xep:JdkObsolete:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
[32737] | 93 | <compilerarg line="-Xmaxwarns 1000"/>
|
---|
[32312] | 94 | <classpath refid="plugin.classpath"/>
|
---|
[26341] | 95 | </javac>
|
---|
| 96 | </target>
|
---|
| 97 | <!--
|
---|
| 98 | **********************************************************
|
---|
[29005] | 99 | ** setup-dist - copies files for distribution
|
---|
[28990] | 100 | **********************************************************
|
---|
| 101 | -->
|
---|
[29005] | 102 | <target name="setup-dist-default">
|
---|
[28990] | 103 | <copy todir="${plugin.build.dir}/resources" failonerror="no" includeemptydirs="no">
|
---|
| 104 | <fileset dir="resources"/>
|
---|
| 105 | </copy>
|
---|
| 106 | <copy todir="${plugin.build.dir}/images" failonerror="no" includeemptydirs="no">
|
---|
| 107 | <fileset dir="images"/>
|
---|
| 108 | </copy>
|
---|
| 109 | <copy todir="${plugin.build.dir}/data" failonerror="no" includeemptydirs="no">
|
---|
| 110 | <fileset dir="data"/>
|
---|
| 111 | </copy>
|
---|
| 112 | <copy todir="${plugin.build.dir}">
|
---|
| 113 | <fileset dir=".">
|
---|
| 114 | <include name="README"/>
|
---|
[28996] | 115 | <include name="LICENSE*"/>
|
---|
| 116 | <include name="*GPL*"/>
|
---|
[28990] | 117 | </fileset>
|
---|
| 118 | </copy>
|
---|
[29005] | 119 | </target>
|
---|
| 120 | <target name="setup-dist">
|
---|
[29007] | 121 | <antcall target="setup-dist-default" />
|
---|
[29005] | 122 | </target>
|
---|
| 123 | <!--
|
---|
| 124 | **********************************************************
|
---|
[34045] | 125 | ** dist - creates the plugin jars
|
---|
[29005] | 126 | **********************************************************
|
---|
| 127 | -->
|
---|
[34045] | 128 | <target name="dist" depends="compile,javadoc,revision" unless="skip-dist">
|
---|
[29005] | 129 | <echo message="creating ${ant.project.name}.jar ... "/>
|
---|
[29007] | 130 | <antcall target="setup-dist" />
|
---|
[28990] | 131 | <delete file="MANIFEST" failonerror="no"/>
|
---|
| 132 | <manifest file="MANIFEST" mode="update">
|
---|
| 133 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 134 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 135 | <attribute name="Plugin-Class" value="${plugin.class}" />
|
---|
| 136 | <attribute name="Plugin-Description" value="${plugin.description}" />
|
---|
| 137 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
---|
| 138 | <attribute name="Author" value="${plugin.author}"/>
|
---|
| 139 | </manifest>
|
---|
| 140 | <antcall target="add-manifest-attribute">
|
---|
| 141 | <param name="manifest.attribute" value="Plugin-Link"/>
|
---|
[30562] | 142 | <param name="property.name" value="plugin.link"/>
|
---|
| 143 | <param name="property.value" value="${plugin.link}"/>
|
---|
[28990] | 144 | </antcall>
|
---|
| 145 | <antcall target="add-manifest-attribute">
|
---|
| 146 | <param name="manifest.attribute" value="Plugin-Icon"/>
|
---|
[30562] | 147 | <param name="property.name" value="plugin.icon"/>
|
---|
| 148 | <param name="property.value" value="${plugin.icon}"/>
|
---|
[28990] | 149 | </antcall>
|
---|
| 150 | <antcall target="add-manifest-attribute">
|
---|
| 151 | <param name="manifest.attribute" value="Plugin-Early"/>
|
---|
[30562] | 152 | <param name="property.name" value="plugin.early"/>
|
---|
| 153 | <param name="property.value" value="${plugin.early}"/>
|
---|
[28990] | 154 | </antcall>
|
---|
| 155 | <antcall target="add-manifest-attribute">
|
---|
| 156 | <param name="manifest.attribute" value="Plugin-Requires"/>
|
---|
[30562] | 157 | <param name="property.name" value="plugin.requires"/>
|
---|
| 158 | <param name="property.value" value="${plugin.requires}"/>
|
---|
[28990] | 159 | </antcall>
|
---|
| 160 | <antcall target="add-manifest-attribute">
|
---|
| 161 | <param name="manifest.attribute" value="Plugin-Stage"/>
|
---|
[30562] | 162 | <param name="property.name" value="plugin.stage"/>
|
---|
| 163 | <param name="property.value" value="${plugin.stage}"/>
|
---|
[28990] | 164 | </antcall>
|
---|
[30952] | 165 | <antcall target="add-manifest-attribute">
|
---|
| 166 | <param name="manifest.attribute" value="Plugin-Canloadatruntime"/>
|
---|
| 167 | <param name="property.name" value="plugin.canloadatruntime"/>
|
---|
| 168 | <param name="property.value" value="${plugin.canloadatruntime}"/>
|
---|
| 169 | </antcall>
|
---|
[29435] | 170 | <antcall target="additional-manifest" />
|
---|
[31768] | 171 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifest="MANIFEST" manifestencoding="UTF-8">
|
---|
[31281] | 172 | <restrict>
|
---|
| 173 | <not><or>
|
---|
| 174 | <name name="META-INF/maven/*"/>
|
---|
| 175 | <name name="META-INF/DEPENDENCIES"/>
|
---|
| 176 | <name name="META-INF/LICENSE"/>
|
---|
| 177 | <name name="META-INF/NOTICE"/>
|
---|
[32175] | 178 | <name name="META-INF/*.RSA"/>
|
---|
| 179 | <name name="META-INF/*.SF"/>
|
---|
[31281] | 180 | </or></not>
|
---|
| 181 | <archives>
|
---|
| 182 | <zips>
|
---|
| 183 | <fileset dir="${plugin.lib.dir}" includes="*.jar" excludes="*-sources.jar, *-javadoc.jar" erroronmissingdir="no"/>
|
---|
| 184 | </zips>
|
---|
| 185 | </archives>
|
---|
| 186 | </restrict>
|
---|
[28990] | 187 | </jar>
|
---|
[34045] | 188 | <jar destfile="${plugin.sources.jar}" basedir="${plugin.src.dir}"/>
|
---|
| 189 | <jar destfile="${plugin.javadoc.jar}" basedir="${plugin.doc.dir}"/>
|
---|
[28990] | 190 | <delete file="MANIFEST" failonerror="no"/>
|
---|
[29007] | 191 | <antcall target="post-dist" />
|
---|
[28990] | 192 | </target>
|
---|
[29007] | 193 | <target name="post-dist">
|
---|
[31281] | 194 | <!-- to be overidden by plugins that need to perform additional tasks on resulting jar -->
|
---|
[29007] | 195 | </target>
|
---|
[30562] | 196 | <target name="add-manifest-attribute" depends="check-manifest-attribute" if="have-${property.name}">
|
---|
[28990] | 197 | <manifest file="MANIFEST" mode="update">
|
---|
[30562] | 198 | <attribute name="${manifest.attribute}" value="${property.value}" />
|
---|
[28990] | 199 | </manifest>
|
---|
| 200 | </target>
|
---|
[29435] | 201 | <!-- target to add additional entries, empty in commons -->
|
---|
| 202 | <target name="additional-manifest">
|
---|
| 203 | </target>
|
---|
[28990] | 204 | <target name="check-manifest-attribute">
|
---|
[30562] | 205 | <condition property="have-${property.name}">
|
---|
[28990] | 206 | <and>
|
---|
[30562] | 207 | <isset property="${property.name}"/>
|
---|
[28990] | 208 | <not>
|
---|
[30562] | 209 | <equals arg1="${property.value}" arg2=""/>
|
---|
[28990] | 210 | </not>
|
---|
| 211 | <not>
|
---|
[30562] | 212 | <equals arg1="${property.value}" arg2="..."/>
|
---|
[28990] | 213 | </not>
|
---|
| 214 | </and>
|
---|
| 215 | </condition>
|
---|
| 216 | </target>
|
---|
[34038] | 217 | <target name="javadoc">
|
---|
[34045] | 218 | <javadoc destdir="${plugin.doc.dir}"
|
---|
[34038] | 219 | sourcepath="${plugin.src.dir}"
|
---|
| 220 | encoding="UTF-8"
|
---|
| 221 | windowtitle="JOSM-${ant.project.name}"
|
---|
| 222 | use="true"
|
---|
| 223 | private="true"
|
---|
| 224 | linksource="true"
|
---|
| 225 | author="false">
|
---|
| 226 | <classpath refid="plugin.classpath"/>
|
---|
[34045] | 227 | <link href="https://docs.oracle.com/javase/8/docs/api"/>
|
---|
[34038] | 228 | <link href="https://josm.openstreetmap.de/doc"/>
|
---|
| 229 | <doctitle><![CDATA[<h2>JOSM-${ant.project.name} - Javadoc</h2>]]></doctitle>
|
---|
| 230 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/wiki/Plugins">JOSM Plugins</a>]]></bottom>
|
---|
| 231 | <arg value="--add-exports" if:set="isJava9" />
|
---|
| 232 | <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 233 | </javadoc>
|
---|
| 234 | </target>
|
---|
[28990] | 235 | <!--
|
---|
| 236 | **********************************************************
|
---|
[26341] | 237 | ** revision - extracts the current revision number for the
|
---|
| 238 | ** file build.number and stores it in the XML property
|
---|
| 239 | ** version.*
|
---|
| 240 | **********************************************************
|
---|
| 241 | -->
|
---|
[30161] | 242 | <!--
|
---|
| 243 | ** Initializes the REVISION.XML file from SVN information
|
---|
| 244 | -->
|
---|
[32334] | 245 | <target name="init-svn-revision-xml" unless="skip-revision">
|
---|
[30161] | 246 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
|
---|
[26341] | 247 | <env key="LANG" value="C"/>
|
---|
| 248 | <arg value="info"/>
|
---|
| 249 | <arg value="--xml"/>
|
---|
| 250 | <arg value="."/>
|
---|
| 251 | </exec>
|
---|
[32334] | 252 | <condition property="svn.info.fail">
|
---|
[33489] | 253 | <not>
|
---|
| 254 | <and>
|
---|
| 255 | <equals arg1="${svn.info.result}" arg2="0" />
|
---|
| 256 | <length file="REVISION.XML" when="greater" length="1" />
|
---|
| 257 | </and>
|
---|
| 258 | </not>
|
---|
[30161] | 259 | </condition>
|
---|
[26341] | 260 | </target>
|
---|
| 261 | <!--
|
---|
[30306] | 262 | ** Initializes the REVISION.XML file from git-svn information.
|
---|
| 263 | Obtains the revision from the git-svn-id field.
|
---|
[30161] | 264 | -->
|
---|
[32334] | 265 | <target name="init-git-svn-revision-xml" if="svn.info.fail" unless="skip-revision">
|
---|
[30306] | 266 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.svn.info.result">
|
---|
[30161] | 267 | <arg value="log"/>
|
---|
| 268 | <arg value="-1"/>
|
---|
| 269 | <arg value="--grep=git-svn-id"/>
|
---|
| 270 | <!--
|
---|
| 271 | %B: raw body (unwrapped subject and body)
|
---|
| 272 | %n: new line
|
---|
| 273 | %ai: author date, ISO 8601 format
|
---|
| 274 | -->
|
---|
| 275 | <arg value="--pretty=format:%B%n%ai"/>
|
---|
[31886] | 276 | <arg value="."/>
|
---|
[30161] | 277 | </exec>
|
---|
| 278 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
| 279 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 280 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[30306] | 281 | <condition property="git.svn.fail">
|
---|
| 282 | <not>
|
---|
| 283 | <and>
|
---|
| 284 | <equals arg1="${git.svn.info.result}" arg2="0" />
|
---|
| 285 | <length file="REVISION.XML" when="greater" length="1" />
|
---|
| 286 | </and>
|
---|
| 287 | </not>
|
---|
| 288 | </condition>
|
---|
[30562] | 289 | </target>
|
---|
[30306] | 290 | <!--
|
---|
| 291 | ** Initializes the REVISION.XML file from git (w/o svn) information.
|
---|
| 292 | Uses Unix date as revision number.
|
---|
| 293 | -->
|
---|
[32334] | 294 | <target name="init-git-revision-xml" if="git.svn.fail" unless="skip-revision">
|
---|
[30309] | 295 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.info.result">
|
---|
[30306] | 296 | <arg value="log"/>
|
---|
| 297 | <arg value="-1"/>
|
---|
| 298 | <arg value="--pretty=format:%at%n%ai"/>
|
---|
[31886] | 299 | <arg value="."/>
|
---|
[30306] | 300 | </exec>
|
---|
| 301 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
| 302 | match="\s*(\d*)\s+(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 303 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[30309] | 304 | <condition property="git.fail">
|
---|
| 305 | <not>
|
---|
| 306 | <and>
|
---|
| 307 | <equals arg1="${git.info.result}" arg2="0" />
|
---|
| 308 | <length file="REVISION.XML" when="greater" length="1" />
|
---|
| 309 | </and>
|
---|
| 310 | </not>
|
---|
| 311 | </condition>
|
---|
[30161] | 312 | </target>
|
---|
[32334] | 313 | <target name="init-revision-fallback" if="git.fail" unless="skip-revision">
|
---|
[30309] | 314 | <tstamp>
|
---|
| 315 | <format property="current.time" pattern="yyyy-MM-dd'T'HH:mm:ss.SSS" />
|
---|
| 316 | </tstamp>
|
---|
| 317 | <echo file="REVISION.XML"><![CDATA[<info><entry><commit revision="UNKNOWN"><date>${current.time}</date></commit></entry></info>]]></echo>
|
---|
| 318 | </target>
|
---|
[32311] | 319 | <target name="revision" depends="init-svn-revision-xml, init-git-svn-revision-xml, init-git-revision-xml, init-revision-fallback" unless="skip-revision">
|
---|
[30161] | 320 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 321 | <delete file="REVISION.XML"/>
|
---|
| 322 | </target>
|
---|
| 323 | <!--
|
---|
[26341] | 324 | **********************************************************
|
---|
| 325 | ** clean - clean up the build environment
|
---|
| 326 | **********************************************************
|
---|
| 327 | -->
|
---|
| 328 | <target name="clean">
|
---|
| 329 | <delete dir="${plugin.build.dir}"/>
|
---|
[34045] | 330 | <delete dir="${plugin.doc.dir}"/>
|
---|
[33491] | 331 | <delete dir="${checkstyle-build.dir}"/>
|
---|
[26341] | 332 | <delete file="${plugin.jar}"/>
|
---|
[34045] | 333 | <delete file="${plugin.sources.jar}"/>
|
---|
| 334 | <delete file="${plugin.javadoc.jar}"/>
|
---|
[26341] | 335 | </target>
|
---|
| 336 | <!--
|
---|
| 337 | **********************************************************
|
---|
| 338 | ** install - install the plugin in your local JOSM installation
|
---|
| 339 | **********************************************************
|
---|
| 340 | -->
|
---|
| 341 | <target name="install" depends="dist">
|
---|
| 342 | <property environment="env"/>
|
---|
[30907] | 343 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins">
|
---|
[26341] | 344 | <and>
|
---|
| 345 | <os family="windows"/>
|
---|
| 346 | </and>
|
---|
| 347 | </condition>
|
---|
[30896] | 348 | <condition property="josm.plugins.dir" value="${user.home}/Library/JOSM/plugins">
|
---|
| 349 | <and>
|
---|
| 350 | <os family="mac"/>
|
---|
| 351 | </and>
|
---|
| 352 | </condition>
|
---|
| 353 | <condition property="josm.plugins.dir" value="${user.home}/.josm/plugins">
|
---|
| 354 | <and>
|
---|
| 355 | <not><os family="windows"/></not>
|
---|
| 356 | <not><os family="mac"/></not>
|
---|
| 357 | </and>
|
---|
| 358 | </condition>
|
---|
[26341] | 359 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 360 | </target>
|
---|
| 361 | <!--
|
---|
[32052] | 362 | ************************** Publishing the plugin ***********************************
|
---|
[26341] | 363 | -->
|
---|
| 364 | <!--
|
---|
[32052] | 365 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
[26341] | 366 | ** property ${coreversion.info.entry.revision}
|
---|
| 367 | **
|
---|
| 368 | -->
|
---|
| 369 | <target name="core-info">
|
---|
| 370 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 371 | <env key="LANG" value="C"/>
|
---|
| 372 | <arg value="info"/>
|
---|
| 373 | <arg value="--xml"/>
|
---|
| 374 | <arg value="../../core"/>
|
---|
| 375 | </exec>
|
---|
| 376 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 377 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 378 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 379 | <delete file="core.info.xml"/>
|
---|
| 380 | </target>
|
---|
| 381 | <!--
|
---|
| 382 | ** commits the source tree for this plugin
|
---|
| 383 | -->
|
---|
| 384 | <target name="commit-current">
|
---|
| 385 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 386 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 387 | <env key="LANG" value="C"/>
|
---|
| 388 | <arg value="commit"/>
|
---|
[28400] | 389 | <arg value="-m"/>
|
---|
| 390 | <arg value="${commit.message}"/>
|
---|
[26341] | 391 | <arg value="."/>
|
---|
| 392 | </exec>
|
---|
| 393 | </target>
|
---|
| 394 | <!--
|
---|
| 395 | ** updates (svn up) the source tree for this plugin
|
---|
| 396 | -->
|
---|
| 397 | <target name="update-current">
|
---|
| 398 | <echo>Updating plugin source ...</echo>
|
---|
| 399 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 400 | <env key="LANG" value="C"/>
|
---|
| 401 | <arg value="up"/>
|
---|
| 402 | <arg value="."/>
|
---|
| 403 | </exec>
|
---|
| 404 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 405 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 406 | <env key="LANG" value="C"/>
|
---|
| 407 | <arg value="up"/>
|
---|
| 408 | <arg value="../dist/${plugin.jar}"/>
|
---|
[34045] | 409 | <arg value="../dist/${plugin.javadoc.jar}"/>
|
---|
| 410 | <arg value="../dist/${plugin.sources.jar}"/>
|
---|
[26341] | 411 | </exec>
|
---|
| 412 | </target>
|
---|
| 413 | <!--
|
---|
[32052] | 414 | ** commits the plugin.jar
|
---|
[26341] | 415 | -->
|
---|
| 416 | <target name="commit-dist">
|
---|
| 417 | <echo>
|
---|
| 418 | ***** Properties of published ${plugin.jar} *****
|
---|
[27960] | 419 | Commit message : '${commit.message}'
|
---|
[26341] | 420 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 421 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 422 | Plugin-Version : ${version.entry.commit.revision}
|
---|
[27960] | 423 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 424 |
|
---|
[26341] | 425 | Now commiting ${plugin.jar} ...
|
---|
| 426 | </echo>
|
---|
| 427 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 428 | <env key="LANG" value="C"/>
|
---|
[28400] | 429 | <arg value="-m"/>
|
---|
| 430 | <arg value="${commit.message}"/>
|
---|
[26341] | 431 | <arg value="commit"/>
|
---|
| 432 | <arg value="${plugin.jar}"/>
|
---|
[34045] | 433 | <arg value="${plugin.sources.jar}"/>
|
---|
| 434 | <arg value="${plugin.javadoc.jar}"/>
|
---|
[26341] | 435 | </exec>
|
---|
| 436 | </target>
|
---|
| 437 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 438 | <target name="ensure-svn-present">
|
---|
| 439 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 440 | <env key="LANG" value="C"/>
|
---|
| 441 | <arg value="--version"/>
|
---|
| 442 | </exec>
|
---|
| 443 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 444 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 445 | <condition>
|
---|
| 446 | <not>
|
---|
| 447 | <isset property="svn.exit.code"/>
|
---|
| 448 | </not>
|
---|
| 449 | </condition>
|
---|
| 450 | </fail>
|
---|
| 451 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 452 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 453 | <condition>
|
---|
| 454 | <isfailure code="${svn.exit.code}"/>
|
---|
| 455 | </condition>
|
---|
| 456 | </fail>
|
---|
| 457 | </target>
|
---|
[28807] | 458 |
|
---|
[26341] | 459 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 460 | </target>
|
---|
[31281] | 461 |
|
---|
[30550] | 462 | <path id="test.classpath">
|
---|
[30552] | 463 | <fileset dir="../00_core_test_lib">
|
---|
[30550] | 464 | <include name="**/*.jar"/>
|
---|
| 465 | </fileset>
|
---|
| 466 | <fileset dir="${plugin.test.dir}/lib" erroronmissingdir="no">
|
---|
| 467 | <include name="**/*.jar"/>
|
---|
[30820] | 468 | <exclude name="**/*-sources.jar"/>
|
---|
| 469 | <exclude name="**/*-javadoc.jar"/>
|
---|
[30550] | 470 | </fileset>
|
---|
| 471 | <fileset dir="lib" erroronmissingdir="no">
|
---|
| 472 | <include name="**/*.jar"/>
|
---|
[30820] | 473 | <exclude name="**/*-sources.jar"/>
|
---|
| 474 | <exclude name="**/*-javadoc.jar"/>
|
---|
[30550] | 475 | </fileset>
|
---|
[32052] | 476 | <pathelement path="${plugin.test.dir}/data"/>
|
---|
[30553] | 477 | <pathelement path="${josm.test.build.dir}/unit"/>
|
---|
[30550] | 478 | <pathelement path="${josm}"/>
|
---|
| 479 | <pathelement path="${plugin.jar}"/>
|
---|
[32188] | 480 | <pathelement path="${annotations.jar}"/>
|
---|
[30550] | 481 | </path>
|
---|
| 482 | <macrodef name="init-test-preferences">
|
---|
| 483 | <sequential>
|
---|
[32326] | 484 | <copy file="../00_core_test_config/preferences.template.xml" tofile="../00_core_test_config/unit-josm.home/preferences.xml"/>
|
---|
| 485 | <replace file="../00_core_test_config/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
| 486 | <replace file="../00_core_test_config/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
[30550] | 487 | </sequential>
|
---|
| 488 | </macrodef>
|
---|
[32306] | 489 | <target name="check-test">
|
---|
| 490 | <available file="${plugin.test.dir}" type="dir" property="test.present"/>
|
---|
| 491 | </target>
|
---|
| 492 | <target name="test-init" depends="check-test" if="test.present">
|
---|
[30550] | 493 | <mkdir dir="${plugin.test.dir}/build"/>
|
---|
| 494 | <mkdir dir="${plugin.test.dir}/build/unit"/>
|
---|
| 495 | <mkdir dir="${plugin.test.dir}/report"/>
|
---|
[30562] | 496 | <init-test-preferences/>
|
---|
[30550] | 497 | </target>
|
---|
| 498 | <target name="test-clean">
|
---|
| 499 | <delete dir="${plugin.test.dir}/build"/>
|
---|
| 500 | <delete dir="${plugin.test.dir}/report"/>
|
---|
| 501 | <delete file="${plugin.test.dir}/jacoco.exec" />
|
---|
[32326] | 502 | <delete file="../00_core_test_config/unit-josm.home/preferences.xml" />
|
---|
| 503 | <delete dir="../00_core_test_config/unit-josm.home/cache" failonerror="false"/>
|
---|
[30550] | 504 | </target>
|
---|
[32306] | 505 | <target name="test-compile" depends="test-init,dist" if="test.present">
|
---|
[30550] | 506 | <sequential>
|
---|
[33960] | 507 | <javac debug="on" includeantruntime="false" srcdir="${plugin.test.dir}/unit" destdir="${plugin.test.dir}/build/unit" encoding="UTF-8">
|
---|
[30550] | 508 | <classpath>
|
---|
[30747] | 509 | <fileset refid="plugin.requires.jars"/>
|
---|
[30562] | 510 | <path refid="test.classpath"/>
|
---|
[30550] | 511 | </classpath>
|
---|
[32926] | 512 | <compilerarg value="-Xlint:all"/>
|
---|
| 513 | <compilerarg value="-Xlint:-serial"/>
|
---|
| 514 | </javac>
|
---|
[30550] | 515 | </sequential>
|
---|
| 516 | </target>
|
---|
[32306] | 517 | <target name="test" depends="dist, test-clean, test-compile" if="test.present"
|
---|
[30747] | 518 | description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
| 519 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="../00_core_tools/jacocoant.jar" />
|
---|
[30550] | 520 | <sequential>
|
---|
[30562] | 521 | <echo message="Running unit tests with JUnit"/>
|
---|
[30550] | 522 | <jacoco:coverage destfile="${plugin.test.dir}/jacoco.exec">
|
---|
[30556] | 523 | <junit printsummary="yes" fork="true" forkmode="once" dir="${basedir}">
|
---|
[30562] | 524 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
[33331] | 525 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 526 | <jvmarg value="java.base/java.lang.reflect=ALL-UNNAMED" if:set="isJava9" />
|
---|
[33339] | 527 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 528 | <jvmarg value="java.desktop/javax.imageio.spi=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 529 | <jvmarg value="--add-exports" if:set="isJava9" />
|
---|
| 530 | <jvmarg value="java.desktop/com.sun.imageio.spi=ALL-UNNAMED" if:set="isJava9" />
|
---|
[32326] | 531 | <sysproperty key="josm.home" value="../00_core_test_config/unit-josm.home"/>
|
---|
[30550] | 532 | <sysproperty key="josm.test.data" value="${plugin.test.dir}/data"/>
|
---|
| 533 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
| 534 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
| 535 | <classpath>
|
---|
[30747] | 536 | <fileset refid="plugin.requires.jars"/>
|
---|
[30550] | 537 | <path refid="test.classpath"/>
|
---|
| 538 | <pathelement path="${plugin.test.dir}/build/unit"/>
|
---|
| 539 | </classpath>
|
---|
| 540 | <formatter type="plain"/>
|
---|
| 541 | <formatter type="xml"/>
|
---|
| 542 | <batchtest fork="yes" todir="${plugin.test.dir}/report">
|
---|
[30562] | 543 | <fileset dir="${plugin.test.dir}/build/unit" includes="**/*Test.class"/>
|
---|
[30550] | 544 | </batchtest>
|
---|
| 545 | </junit>
|
---|
| 546 | </jacoco:coverage>
|
---|
| 547 | </sequential>
|
---|
[30562] | 548 | </target>
|
---|
[31281] | 549 |
|
---|
[33491] | 550 | <target name="checkstyle-compile">
|
---|
| 551 | <mkdir dir="${checkstyle-build.dir}"/>
|
---|
| 552 | <javac sourcepath="" srcdir="../00_core_tools/checkstyle/src" failonerror="true"
|
---|
| 553 | destdir="${checkstyle-build.dir}" target="${ant.build.javac.target}" source="${ant.build.javac.source}" debug="on"
|
---|
| 554 | includeantruntime="false" createMissingPackageInfoClass="false"
|
---|
| 555 | encoding="UTF-8" classpath="${checkstyle.jar}">
|
---|
| 556 | </javac>
|
---|
| 557 | </target>
|
---|
| 558 | <target name="checkstyle" depends="checkstyle-compile">
|
---|
| 559 | <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpath="${checkstyle.jar}:${checkstyle-build.dir}"/>
|
---|
| 560 | <checkstyle config="${basedir}/../00_core_tools/checkstyle/josm_checks.xml">
|
---|
[33061] | 561 | <fileset dir="${basedir}/src" includes="**/*.java" excludes="boofcv/**/*.java,
|
---|
| 562 | com/google/**/*.java,
|
---|
[32317] | 563 | crosby/**/*.java,
|
---|
| 564 | edu/princeton/**/*.java,
|
---|
| 565 | net/boplicity/**/*.java,
|
---|
| 566 | org/apache/**/*.java,
|
---|
| 567 | org/dinopolis/**/*.java,
|
---|
| 568 | org/kaintoch/**/*.java,
|
---|
| 569 | org/marvinproject/**/*.java,
|
---|
| 570 | org/netbeans/**/*.java,
|
---|
[33025] | 571 | org/openstreetmap/josm/plugins/dataimport/io/tcx/**/*.java,
|
---|
[32765] | 572 | org/openstreetmap/josm/plugins/ohe/parser/**/*.java,
|
---|
| 573 | org/openstreetmap/josm/plugins/roadsigns/javacc/**/*.java,
|
---|
| 574 | org/osgeo/**/*.java,
|
---|
| 575 | pdfimport/pdfbox/operators/**/*.java
|
---|
| 576 | "/>
|
---|
[32310] | 577 | <fileset dir="${basedir}/test" includes="**/*.java" erroronmissingdir="false"/>
|
---|
| 578 | <formatter type="xml" toFile="checkstyle-josm-${ant.project.name}.xml"/>
|
---|
| 579 | </checkstyle>
|
---|
| 580 | </target>
|
---|
| 581 |
|
---|
[33932] | 582 | <target name="spotbugs" depends="compile">
|
---|
[33591] | 583 | <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${spotbugs-ant.jar}"/>
|
---|
| 584 | <path id="spotbugs-classpath">
|
---|
| 585 | <fileset dir="../00_core_tools/spotbugs/">
|
---|
[32310] | 586 | <include name="*.jar"/>
|
---|
| 587 | </fileset>
|
---|
| 588 | </path>
|
---|
[33591] | 589 | <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
|
---|
| 590 | <spotbugs output="xml"
|
---|
| 591 | outputFile="spotbugs-josm-${ant.project.name}.xml"
|
---|
| 592 | classpath="${spotbugs-classpath}"
|
---|
[32310] | 593 | pluginList=""
|
---|
[33591] | 594 | excludeFilter="../spotbugs-filter.xml"
|
---|
[34039] | 595 | effort="less"
|
---|
[32310] | 596 | reportLevel="low"
|
---|
[34063] | 597 | jvmargs="-Xmx3072m"
|
---|
[32310] | 598 | >
|
---|
[32317] | 599 | <auxClasspath refid="plugin.classpath" />
|
---|
[32310] | 600 | <sourcePath path="${basedir}/src" />
|
---|
[33932] | 601 | <class location="${plugin.build.dir}" />
|
---|
[33591] | 602 | </spotbugs>
|
---|
[32310] | 603 | </target>
|
---|
| 604 |
|
---|
[28807] | 605 | <target name="runjosm" depends="install">
|
---|
[32311] | 606 | <java jar="${josm}" fork="true"/>
|
---|
[28807] | 607 | </target>
|
---|
| 608 |
|
---|
| 609 | <target name="profilejosm" depends="install">
|
---|
| 610 | <nbprofiledirect>
|
---|
| 611 | </nbprofiledirect>
|
---|
| 612 | <java jar="${josm}" fork="true">
|
---|
| 613 | <jvmarg value="${profiler.info.jvmargs.agent}"/>
|
---|
| 614 | </java>
|
---|
| 615 | </target>
|
---|
[29004] | 616 | <!--
|
---|
[32052] | 617 | ** shows a help text
|
---|
[29004] | 618 | -->
|
---|
| 619 | <target name="help">
|
---|
| 620 | <echo>
|
---|
| 621 | You can use following targets:
|
---|
| 622 | * dist This default target builds the plugin jar file
|
---|
[29006] | 623 | * clean Cleanup automatical created files
|
---|
[31281] | 624 | * test Run unit tests (if any)
|
---|
[29004] | 625 | * publish Checkin source code, build jar and checkin plugin jar
|
---|
| 626 | (requires proper entry for SVN commit message!)
|
---|
| 627 | * install Install the plugin in current system
|
---|
| 628 | * runjosm Install plugin and start josm
|
---|
| 629 | * profilejosm Install plugin and start josm in profiling mode
|
---|
[32052] | 630 |
|
---|
[29004] | 631 | There are other targets, which usually should not be called manually.
|
---|
| 632 | </echo>
|
---|
| 633 | </target>
|
---|
[26341] | 634 | </project>
|
---|