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

Last change on this file since 34904 was 34891, checked in by donvip, 6 years ago

add guava to test classpath

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