source: osm/applications/editors/josm/plugins/build-common.xml@ 36280

Last change on this file since 36280 was 36208, checked in by taylor.smock, 15 months ago

Fix #23465: Remove custom checkstyle plugin

TopLevelJavadocCheck.java is duplicating functionality from MissingJavadocType.
Our custom class is from #14794 (closed 2017-10-16). The check that makes it
redundant was added in checkstyle 8.20 (released 2019-04-28).

This adds the missing javadocs for the more comprehensive checkstyle version.

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