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