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