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

Last change on this file since 35088 was 35053, checked in by donvip, 5 years ago

see #josm17861 - initial version of the HTTP/2 plugin

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