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