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

Last change on this file since 34819 was 34795, checked in by donvip, 6 years ago

tools update

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