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