[4166] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <!-- ** build.xml - main ant file for JOSM
|
---|
| 3 | **
|
---|
| 4 | ** To build run
|
---|
| 5 | ** ant clean
|
---|
| 6 | ** ant dist
|
---|
[7133] | 7 | ** This will create 'josm-custom.jar' in directory 'dist'. See also
|
---|
[7183] | 8 | ** https://josm.openstreetmap.de/wiki/DevelopersGuide/CreateBuild
|
---|
[4166] | 9 | **
|
---|
| 10 | -->
|
---|
[15977] | 11 | <project name="josm" default="dist"
|
---|
| 12 | xmlns:as="antlib:org.codehaus.mojo.animal_sniffer"
|
---|
| 13 | xmlns:if="ant:if"
|
---|
| 14 | xmlns:ivy="antlib:org.apache.ivy.ant"
|
---|
| 15 | xmlns:jacoco="antlib:org.jacoco.ant"
|
---|
| 16 | xmlns:unless="ant:unless"
|
---|
| 17 | >
|
---|
[17338] | 18 | <target name="init-ivy" description="Initialize dependency management system Apache Ivy">
|
---|
[18587] | 19 | <property name="ivy.version" value="2.5.1"/>
|
---|
[15977] | 20 | <dirname property="base.dir" file="${ant.file.josm}"/>
|
---|
| 21 | <property name="lib.dir" location="${base.dir}/lib"/>
|
---|
| 22 | <property name="tools.dir" location="${base.dir}/tools"/>
|
---|
[16168] | 23 | <property name="tools.ivy" location="${tools.dir}/ivy.xml"/>
|
---|
[16183] | 24 | <property name="ivy.jar.dir" location="${tools.dir}/ivy"/>
|
---|
| 25 | <property name="ivy.jar.file" location="${ivy.jar.dir}/ivy-${ivy.version}.jar"/>
|
---|
| 26 | <mkdir dir="${ivy.jar.dir}"/>
|
---|
| 27 | <get src="https://josm.openstreetmap.de/nexus/content/repositories/public/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"
|
---|
| 28 | dest="${ivy.jar.file}"
|
---|
| 29 | skipexisting="true"
|
---|
| 30 | />
|
---|
| 31 | <taskdef resource="org/apache/ivy/ant/antlib.xml" uri="antlib:org.apache.ivy.ant" classpath="${ivy.jar.file}"/>
|
---|
[15977] | 32 | </target>
|
---|
[17338] | 33 | <target name="init-properties" description="Initialize properties for the build">
|
---|
[13641] | 34 | <property environment="env"/>
|
---|
[9765] | 35 | <!-- Load properties in a target and not at top level, so this build file can be
|
---|
| 36 | imported from an IDE ant file (Netbeans) without messing up IDE properties.
|
---|
| 37 | When imported from another file, ${basedir} will point to the parent directory
|
---|
| 38 | of the importing ant file. Use ${base.dir} instead, which is always the parent
|
---|
| 39 | directory of this file. -->
|
---|
[16878] | 40 | <dirname property="base.dir" file="${ant.file.josm}"/>
|
---|
[9765] | 41 | <property name="test.dir" location="${base.dir}/test"/>
|
---|
| 42 | <property name="src.dir" location="${base.dir}/src"/>
|
---|
[18142] | 43 | <condition property="sign.jar">
|
---|
| 44 | <and>
|
---|
| 45 | <isset property="env.SIGN_ALIAS"/>
|
---|
| 46 | <isset property="env.SIGN_KEYSTORE"/>
|
---|
| 47 | <isset property="env.SIGN_KEYPASS"/>
|
---|
| 48 | <isset property="env.SIGN_STOREPASS"/>
|
---|
| 49 | <isset property="env.SIGN_TSA"/>
|
---|
| 50 | </and>
|
---|
| 51 | </condition>
|
---|
[13819] | 52 | <condition property="noJavaFX">
|
---|
| 53 | <or>
|
---|
[13642] | 54 | <isset property="env.JOSM_NOJAVAFX"/>
|
---|
[13819] | 55 | <not>
|
---|
| 56 | <available classname="javafx.scene.media.Media"/>
|
---|
| 57 | </not>
|
---|
| 58 | </or>
|
---|
[13641] | 59 | </condition>
|
---|
[16341] | 60 | <available property="svn.present" file="${base.dir}/.svn"/>
|
---|
| 61 | <available property="git.present" file="${base.dir}/.git"/>
|
---|
[9765] | 62 | <property name="build.dir" location="${base.dir}/build"/>
|
---|
| 63 | <property name="dist.dir" location="${base.dir}/dist"/>
|
---|
[16140] | 64 | <property name="resources.dir" location="${base.dir}/resources"/>
|
---|
[14136] | 65 | <property name="modules.dir" location="${dist.dir}/modules"/>
|
---|
[13209] | 66 | <property name="tools.dir" location="${base.dir}/tools"/>
|
---|
| 67 | <property name="pmd.dir" location="${tools.dir}/pmd"/>
|
---|
| 68 | <property name="checkstyle.dir" location="${tools.dir}/checkstyle"/>
|
---|
| 69 | <property name="spotbugs.dir" location="${tools.dir}/spotbugs"/>
|
---|
| 70 | <property name="javacc.home" location="${tools.dir}"/>
|
---|
[9765] | 71 | <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
|
---|
| 72 | <property name="proj-build.dir" location="${base.dir}/build2"/>
|
---|
[15033] | 73 | <property name="script-build.dir" location="${base.dir}/build2"/>
|
---|
[12582] | 74 | <property name="checkstyle-build.dir" location="${base.dir}/build2"/>
|
---|
[16140] | 75 | <property name="epsg.output" location="${resources.dir}/data/projection/custom-epsg"/>
|
---|
[16231] | 76 | <property name="commons-lang3.jar" location="${tools.dir}/commons-lang3.jar"/>
|
---|
[12628] | 77 | <property name="dist.jar" location="${dist.dir}/josm-custom.jar"/>
|
---|
| 78 | <property name="dist-optimized.jar" location="${dist.dir}/josm-custom-optimized.jar"/>
|
---|
[16141] | 79 | <property name="dist-sources.jar" location="${dist.dir}/josm-custom-sources.jar"/>
|
---|
[17906] | 80 | <property name="java.lang.version" value="8" />
|
---|
[14052] | 81 | <property name="test.headless" value="true" />
|
---|
[13103] | 82 | <property name="jacoco.includes" value="org.openstreetmap.josm.*" />
|
---|
[13097] | 83 | <property name="jacoco.inclbootstrapclasses" value="false" />
|
---|
| 84 | <property name="jacoco.inclnolocationclasses" value="false" />
|
---|
[14309] | 85 | <property name="junit.printsummary" value="on" />
|
---|
[15032] | 86 | <property name="default-junit-includes" value="**/*Test.class"/>
|
---|
| 87 | <property name="default-junitIT-includes" value="**/*TestIT.class"/>
|
---|
[9765] | 88 | <!-- build parameter: compression level (ant -Dclevel=N)
|
---|
| 89 | N ranges from 0 (no compression) to 9 (maximum compression)
|
---|
| 90 | default: 9 -->
|
---|
| 91 | <condition property="clevel" value="${clevel}" else="9">
|
---|
| 92 | <isset property="clevel"/>
|
---|
| 93 | </condition>
|
---|
[14172] | 94 | <!-- For Java specific stuff by version -->
|
---|
[18727] | 95 | <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|[1-9][0-9])" /></condition>
|
---|
[18726] | 96 | <condition property="isJava10"><matches string="${ant.java.version}" pattern="[1-9][0-9]" /></condition>
|
---|
[18308] | 97 | <condition property="isJava11"><matches string="${ant.java.version}" pattern="1[1-9]|[2-9][0-9]" /></condition>
|
---|
| 98 | <condition property="isJava12"><matches string="${ant.java.version}" pattern="1[2-9]|[2-9][0-9]" /></condition>
|
---|
| 99 | <condition property="isJava13"><matches string="${ant.java.version}" pattern="1[3-9]|[2-9][0-9]" /></condition>
|
---|
| 100 | <condition property="isJava14"><matches string="${ant.java.version}" pattern="1[4-9]|[2-9][0-9]" /></condition>
|
---|
| 101 | <condition property="isJava16"><matches string="${ant.java.version}" pattern="1[6-9]|[2-9][0-9]" /></condition>
|
---|
| 102 | <condition property="isJava18"><matches string="${ant.java.version}" pattern="1[8-9]|[2-9][0-9]" /></condition>
|
---|
| 103 | <condition property="isJava19"><matches string="${ant.java.version}" pattern="19|[2-9][0-9]" /></condition>
|
---|
| 104 | <condition property="isJava20"><matches string="${ant.java.version}" pattern="[2-9][0-9]" /></condition>
|
---|
| 105 | <condition property="isJava21"><matches string="${ant.java.version}" pattern="2[1-9]|[3-9][0-9]" /></condition>
|
---|
[18488] | 106 | <!-- Disable jacoco on Java 19+, see https://github.com/jacoco/jacoco/pull/1282 -->
|
---|
[13523] | 107 | <condition property="coverageByDefault">
|
---|
| 108 | <not>
|
---|
[18488] | 109 | <isset property="isJava19"/>
|
---|
[13523] | 110 | </not>
|
---|
| 111 | </condition>
|
---|
[14244] | 112 | <condition property="java.library.dir" value="jmods" else="lib">
|
---|
| 113 | <isset property="isJava9"/>
|
---|
| 114 | </condition>
|
---|
[9765] | 115 | </target>
|
---|
[17338] | 116 | <target name="init-svn-revision-xml" if="svn.present" depends="init-properties"
|
---|
| 117 | description="Initialize the REVISION.XML file from SVN information">
|
---|
[16341] | 118 | <exec append="false" output="${base.dir}/REVISION.XML" executable="svn" dir="${base.dir}" resultproperty="svn.info.result">
|
---|
[4166] | 119 | <env key="LANG" value="C"/>
|
---|
| 120 | <arg value="info"/>
|
---|
| 121 | <arg value="--xml"/>
|
---|
| 122 | <arg value="."/>
|
---|
| 123 | </exec>
|
---|
[6540] | 124 | </target>
|
---|
[17338] | 125 | <target name="init-git-revision-xml" if="git.present" depends="init-properties"
|
---|
| 126 | description="Initialize the REVISION.XML file from git information">
|
---|
[16341] | 127 | <exec append="false" output="${base.dir}/REVISION.XML" executable="git" dir="${base.dir}">
|
---|
[6540] | 128 | <arg value="log"/>
|
---|
| 129 | <arg value="-1"/>
|
---|
| 130 | <arg value="--grep=git-svn-id"/>
|
---|
[6545] | 131 | <!--
|
---|
| 132 | %B: raw body (unwrapped subject and body)
|
---|
| 133 | %n: new line
|
---|
| 134 | %ai: author date, ISO 8601 format
|
---|
| 135 | -->
|
---|
| 136 | <arg value="--pretty=format:%B%n%ai"/>
|
---|
[6540] | 137 | <arg value="HEAD"/>
|
---|
| 138 | </exec>
|
---|
[9765] | 139 | <replaceregexp file="${base.dir}/REVISION.XML" flags="s"
|
---|
[6545] | 140 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 141 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[6540] | 142 | </target>
|
---|
[17338] | 143 | <target name="create-revision" depends="init-properties,init-svn-revision-xml,init-git-revision-xml"
|
---|
| 144 | description="Create the REVISION file to be included in the distribution based on the latest SVN/Git commit">
|
---|
[9765] | 145 | <xmlproperty file="${base.dir}/REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 146 | <delete file="${base.dir}/REVISION.XML"/>
|
---|
[4166] | 147 | <tstamp>
|
---|
| 148 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
|
---|
| 149 | </tstamp>
|
---|
| 150 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
[6540] | 151 | <property name="version.entry.commit.date" value="UNKNOWN"/>
|
---|
[5362] | 152 | <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
|
---|
[16349] | 153 | <echo file="${resources.dir}/REVISION">
|
---|
[4166] | 154 | # automatically generated by JOSM build.xml - do not edit
|
---|
| 155 | Revision: ${version.entry.commit.revision}
|
---|
| 156 | Build-Date: ${build.tstamp}
|
---|
| 157 | </echo>
|
---|
[17493] | 158 | <echo unless:set="releasebuild" file="${resources.dir}/REVISION" append="true">
|
---|
| 159 | Is-Local-Build: true
|
---|
| 160 | </echo>
|
---|
[4166] | 161 | </target>
|
---|
[17338] | 162 | <target name="check-schemas" unless="check-schemas.notRequired" depends="init-properties"
|
---|
| 163 | description="Check internal XML files against their XSD">
|
---|
[16140] | 164 | <schemavalidate file="${resources.dir}/data/defaultpresets.xml" >
|
---|
| 165 | <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="${resources.dir}/data/tagging-preset.xsd" />
|
---|
[6208] | 166 | </schemavalidate>
|
---|
| 167 | </target>
|
---|
[17338] | 168 | <target name="dist" depends="compile,extract-libraries,epsg,copy-resources,check-schemas"
|
---|
| 169 | description="Main target that builds JOSM and checks XML against schemas">
|
---|
[4166] | 170 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
[12648] | 171 | <copy file="CONTRIBUTION" todir="${build.dir}"/>
|
---|
| 172 | <copy file="README" todir="${build.dir}"/>
|
---|
| 173 | <copy file="LICENSE" todir="${build.dir}"/>
|
---|
[4166] | 174 | <!-- create josm-custom.jar -->
|
---|
[12628] | 175 | <delete file="${dist.jar}"/>
|
---|
| 176 | <jar destfile="${dist.jar}" basedir="${build.dir}" level="${clevel}">
|
---|
[4166] | 177 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
| 178 | <manifest>
|
---|
[11926] | 179 | <attribute name="Main-class" value="org.openstreetmap.josm.gui.MainApplication"/>
|
---|
[4166] | 180 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
| 181 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
[6341] | 182 | <attribute name="Permissions" value="all-permissions"/>
|
---|
| 183 | <attribute name="Codebase" value="josm.openstreetmap.de"/>
|
---|
| 184 | <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
|
---|
[12205] | 185 | <!-- Java 9 stuff. Entries are safely ignored by Java 8 -->
|
---|
[17971] | 186 | <attribute name="Add-Exports" value="java.base/sun.security.action java.desktop/com.apple.eawt java.desktop/com.sun.imageio.spi java.desktop/com.sun.imageio.plugins.jpeg javafx.graphics/com.sun.javafx.application jdk.deploy/com.sun.deploy.config" />
|
---|
[12932] | 187 | <attribute name="Add-Opens" value="java.base/java.lang java.base/java.nio java.base/jdk.internal.loader java.base/jdk.internal.ref java.desktop/javax.imageio.spi java.desktop/javax.swing.text.html java.prefs/java.util.prefs" />
|
---|
[18308] | 188 | <!-- Indicate that this jar may have version specific classes. Only used in Java9+. -->
|
---|
| 189 | <attribute name="Multi-Release" value="true"/>
|
---|
[4166] | 190 | </manifest>
|
---|
| 191 | </jar>
|
---|
[18142] | 192 | <!-- Sign jar if all environment variables are set -->
|
---|
[18858] | 193 | <signjar jar="${dist.jar}" alias="${env.SIGN_ALIAS}" tsaurl="${env.SIGN_TSA}"
|
---|
[18142] | 194 | keystore="${env.SIGN_KEYSTORE}" storepass="${env.SIGN_STOREPASS}" keypass="${env.SIGN_KEYPASS}" if:set="sign.jar" />
|
---|
[4166] | 195 | </target>
|
---|
[17338] | 196 | <target name="javacc" depends="init" unless="javacc.notRequired" description="Compile the MapCSS compiler">
|
---|
[16243] | 197 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="javacc.classpath" conf="javacc"/>
|
---|
[4252] | 198 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
[17908] | 199 | <java classname="javacc" fork="true" dir="${mapcss.dir}" failonerror="true">
|
---|
[16908] | 200 | <classpath path="${tools.dir}/javacc"/>
|
---|
[16168] | 201 | <classpath refid="javacc.classpath"/>
|
---|
[7043] | 202 | <arg value="-DEBUG_PARSER=false"/>
|
---|
| 203 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
[17906] | 204 | <arg value="-JDK_VERSION=1.${java.lang.version}"/>
|
---|
[6446] | 205 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
[17908] | 206 | <arg value="-UNICODE_INPUT=true"/>
|
---|
[4257] | 207 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
[11676] | 208 | </java>
|
---|
[4252] | 209 | </target>
|
---|
[18308] | 210 | <macrodef name="call-javac-compile">
|
---|
| 211 | <attribute name="sourcepath" default=""/>
|
---|
| 212 | <attribute name="srcdir" default="${src.dir}"/>
|
---|
| 213 | <attribute name="fork" default="yes"/>
|
---|
| 214 | <attribute name="excludes" default=""/>
|
---|
| 215 | <attribute name="includes" default="**/*.java"/>
|
---|
| 216 | <attribute name="destdir" default="${build.dir}"/>
|
---|
| 217 | <attribute name="debug" default="on"/>
|
---|
| 218 | <attribute name="includeantruntime" default="false"/>
|
---|
| 219 | <attribute name="encoding" default="UTF-8"/>
|
---|
| 220 | <attribute name="release" default="${java.lang.version}"/>
|
---|
| 221 | <element name="cp-elements" optional="true"/>
|
---|
| 222 | <sequential>
|
---|
| 223 | <javac sourcepath="@{sourcepath}" srcdir="@{srcdir}" fork="@{fork}"
|
---|
| 224 | includes="@{includes}" excludes="@{excludes}" destdir="@{destdir}" release="@{release}"
|
---|
| 225 | debug="@{debug}" includeantruntime="@{includeantruntime}" encoding="@{encoding}">
|
---|
| 226 | <compilerarg value="-J-Xbootclasspath/p:${toString:errorprone_javac.classpath}" unless:set="isJava9"/>
|
---|
| 227 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 228 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 229 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 230 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 231 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 232 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 233 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 234 | <compilerarg value="-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 235 | <compilerarg value="-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED" if:set="isJava16" unless:set="noErrorProne"/>
|
---|
| 236 | <compilerarg line="-XDcompilePolicy=simple"/>
|
---|
| 237 | <compilerarg value="-processorpath"/>
|
---|
| 238 | <compilerarg value="${toString:errorprone.classpath}:${toString:semanticdb.classpath}"/>
|
---|
| 239 | <compilerarg value="-Xlint:cast"/>
|
---|
| 240 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 241 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
| 242 | <compilerarg value="-Xlint:divzero"/>
|
---|
| 243 | <compilerarg value="-Xlint:empty"/>
|
---|
| 244 | <compilerarg value="-Xlint:finally"/>
|
---|
| 245 | <compilerarg value="-Xlint:overrides"/>
|
---|
| 246 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
| 247 | <compilerarg value="-Xlint:static"/>
|
---|
| 248 | <compilerarg value="-Xlint:try"/>
|
---|
| 249 | <compilerarg value="-Xlint:unchecked"/>
|
---|
| 250 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
|
---|
| 251 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
| 252 | <compilerarg value="-Xplugin:ErrorProne -XepExcludedPaths:.*/parsergen/.* -Xep:ReferenceEquality:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsGetClass:OFF -Xep:UndefinedEquals:OFF -Xep:BadImport:OFF -Xep:AnnotateFormatMethod:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF -Xep:RestrictedApiChecker:OFF -Xep:InlineMeSuggester:OFF" unless:set="noErrorProne"/>
|
---|
| 253 | <compilerarg line="-Xmaxwarns 1000"/>
|
---|
| 254 | <compilerarg value="-Xplugin:semanticdb -sourceroot:@{srcdir} -targetroot:${build.dir}/semanticdb" if:set="lsif" />
|
---|
| 255 | <classpath>
|
---|
| 256 | <path refid="runtime.path"/>
|
---|
| 257 | <cp-elements/>
|
---|
| 258 | </classpath>
|
---|
| 259 | </javac>
|
---|
| 260 | </sequential>
|
---|
| 261 | </macrodef>
|
---|
| 262 | <macrodef name="call-javac-compile-mrjar">
|
---|
| 263 | <!--
|
---|
| 264 | See https://openjdk.java.net/jeps/238 for the specification
|
---|
| 265 | The big bits are that the version specific files should be in META-INF/versions/${javaVersion}/
|
---|
| 266 | using the same package scheme. And that the files in the version specific directories are *full*
|
---|
| 267 | implementations of the class they are replacing.
|
---|
| 268 | -->
|
---|
| 269 | <attribute name="release"/>
|
---|
| 270 | <sequential>
|
---|
| 271 | <condition property="java@{release}DirExists">
|
---|
| 272 | <and>
|
---|
| 273 | <isset property="isJava@{release}"/>
|
---|
| 274 | <resourceexists>
|
---|
| 275 | <file file="${src.dir}/main/java-@{release}"/>
|
---|
| 276 | </resourceexists>
|
---|
| 277 | </and>
|
---|
| 278 | </condition>
|
---|
| 279 | <echo message="Compiling Java @{release} files" if:true="${java@{release}DirExists}"/>
|
---|
| 280 | <mkdir dir="${build.dir}/META-INF/versions/@{release}" if:true="${java@{release}DirExists}"/>
|
---|
| 281 | <call-javac-compile srcdir="${src.dir}/main/java-@{release}" destdir="${build.dir}/META-INF/versions/@{release}" release="@{release}" if:true="${java@{release}DirExists}">
|
---|
| 282 | <cp-elements>
|
---|
| 283 | <pathelement path="${build.dir}"/>
|
---|
| 284 | </cp-elements>
|
---|
| 285 | </call-javac-compile>
|
---|
| 286 | </sequential>
|
---|
| 287 | </macrodef>
|
---|
[18072] | 288 | <target name="compile" depends="init,javacc" unless="compile.notRequired" description="Compile JOSM">
|
---|
[16556] | 289 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="errorprone.classpath" conf="errorprone"/>
|
---|
[16571] | 290 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="errorprone_javac.classpath" conf="errorprone_javac"/>
|
---|
[8526] | 291 | <!-- JOSM -->
|
---|
[18308] | 292 | <call-javac-compile excludes="**/package-info.java,**/module-info.java,main/**" release="${java.lang.version}"/>
|
---|
| 293 | <!-- Java 11 specific files (2018-09 LTS) -->
|
---|
| 294 | <call-javac-compile-mrjar release="11"/>
|
---|
| 295 | <!-- Java 17 specific files (2021-09 LTS) -->
|
---|
| 296 | <call-javac-compile-mrjar release="17"/>
|
---|
| 297 | <!-- Java 18 specific files -->
|
---|
| 298 | <call-javac-compile-mrjar release="18"/>
|
---|
| 299 | <!-- Java 19 specific files -->
|
---|
| 300 | <call-javac-compile-mrjar release="19"/>
|
---|
| 301 | <!-- Java 20 specific files -->
|
---|
| 302 | <call-javac-compile-mrjar release="20"/>
|
---|
| 303 | <!-- Java 21 specific files (2023-09 LTS) -->
|
---|
| 304 | <call-javac-compile-mrjar release="21"/>
|
---|
[16036] | 305 | </target>
|
---|
[16349] | 306 | <target name="create-resources" depends="create-revision" description="Create generated resource files">
|
---|
| 307 | <copy todir="${resources.dir}">
|
---|
| 308 | <file file="CONTRIBUTION"/>
|
---|
| 309 | <file file="README"/>
|
---|
| 310 | <file file="LICENSE"/>
|
---|
| 311 | </copy>
|
---|
| 312 | </target>
|
---|
| 313 | <target name="copy-resources" depends="create-resources" description="Copy resource files to build directory">
|
---|
[6756] | 314 | <copy todir="build" failonerror="no" includeemptydirs="no">
|
---|
[16140] | 315 | <fileset dir="${resources.dir}"/>
|
---|
[6756] | 316 | </copy>
|
---|
[4166] | 317 | </target>
|
---|
[17338] | 318 | <target name="init" depends="init-properties,resolve" description="Initialize the build">
|
---|
[5392] | 319 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
|
---|
| 320 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
|
---|
| 321 | </uptodate>
|
---|
[16345] | 322 | <uptodate property="epsg.notRequired" targetfile="${epsg.output}">
|
---|
| 323 | <srcfiles file="${base.dir}/scripts/BuildProjectionDefinitions.java"/>
|
---|
| 324 | <srcfiles dir="nodist/data/projection"/>
|
---|
| 325 | </uptodate>
|
---|
[9765] | 326 | <mkdir dir="${build.dir}"/>
|
---|
| 327 | <mkdir dir="${dist.dir}"/>
|
---|
[4166] | 328 | </target>
|
---|
[17338] | 329 | <target name="javadoc" depends="init" description="Generate API documentation from JOSM source files">
|
---|
[9765] | 330 | <javadoc destdir="javadoc"
|
---|
[7133] | 331 | sourcepath="${src.dir}"
|
---|
[15992] | 332 | classpathref="compile.path"
|
---|
[9765] | 333 | encoding="UTF-8"
|
---|
[16194] | 334 | packagenames="org.openstreetmap.josm.*"
|
---|
[9250] | 335 | excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
|
---|
[5263] | 336 | windowtitle="JOSM"
|
---|
| 337 | use="true"
|
---|
[5481] | 338 | private="true"
|
---|
[5263] | 339 | linksource="true"
|
---|
| 340 | author="false">
|
---|
[15106] | 341 | <link href="https://docs.oracle.com/javase/8/docs/api" unless:set="isJava11" />
|
---|
| 342 | <link href="https://docs.oracle.com/en/java/javase/11/docs/api" if:set="isJava11" />
|
---|
[16348] | 343 | <doctitle><![CDATA[<h2>
|
---|
| 344 | <img src="https://josm.openstreetmap.de/svn/trunk/nodist/images/logo/header.png" style="vertical-align: middle;" alt="JOSM">
|
---|
| 345 | — Javadoc
|
---|
| 346 | </h2>]]></doctitle>
|
---|
[6955] | 347 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
|
---|
[15243] | 348 | <!-- Disable HTML checking until we switch to Java13+, see https://bugs.openjdk.java.net/browse/JDK-8223552 -->
|
---|
| 349 | <arg value="-Xdoclint:-html" if:set="isJava13" />
|
---|
[13494] | 350 | <arg value="-html5" if:set="isJava9" />
|
---|
[13820] | 351 | <arg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
|
---|
| 352 | <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
|
---|
[5263] | 353 | </javadoc>
|
---|
| 354 | </target>
|
---|
[17338] | 355 | <target name="clean" depends="init-properties" description="Delete all build files">
|
---|
[9765] | 356 | <delete dir="${build.dir}"/>
|
---|
| 357 | <delete dir="${proj-build.dir}"/>
|
---|
[15033] | 358 | <delete dir="${script-build.dir}"/>
|
---|
[12582] | 359 | <delete dir="${checkstyle-build.dir}"/>
|
---|
[9765] | 360 | <delete dir="${dist.dir}"/>
|
---|
[4252] | 361 | <delete dir="${mapcss.dir}/parsergen"/>
|
---|
[8535] | 362 | <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
|
---|
| 363 | <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
|
---|
[9133] | 364 | <delete file="${epsg.output}"/>
|
---|
[13209] | 365 | <delete file="${pmd.dir}/cache"/>
|
---|
[4166] | 366 | </target>
|
---|
[7068] | 367 | <macrodef name="init-test-preferences">
|
---|
| 368 | <attribute name="testfamily"/>
|
---|
| 369 | <sequential>
|
---|
| 370 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
| 371 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
| 372 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
| 373 | </sequential>
|
---|
| 374 | </macrodef>
|
---|
[17338] | 375 | <target name="test-init" depends="init" description="Initialize the tests">
|
---|
[6121] | 376 | <mkdir dir="${test.dir}/build"/>
|
---|
[7068] | 377 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
| 378 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
| 379 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
[4166] | 380 | <mkdir dir="${test.dir}/report"/>
|
---|
[7068] | 381 | <init-test-preferences testfamily="unit"/>
|
---|
| 382 | <init-test-preferences testfamily="functional"/>
|
---|
| 383 | <init-test-preferences testfamily="performance"/>
|
---|
[16229] | 384 | <path id="test.classpath">
|
---|
| 385 | <path refid="test.path"/>
|
---|
| 386 | <pathelement path="${build.dir}"/>
|
---|
| 387 | <pathelement path="${resources.dir}"/>
|
---|
| 388 | </path>
|
---|
[16243] | 389 | <ivy:retrieve log="download-only" pattern="${test.dir}/lib/[artifact].[ext]" conf="jmockit"/>
|
---|
| 390 | <ivy:retrieve log="download-only" pattern="${tools.dir}/[artifact].[ext]" conf="commonslang"/>
|
---|
| 391 | <ivy:retrieve log="download-only" pattern="${tools.dir}/[conf].[ext]" conf="jacocoant"/>
|
---|
[13209] | 392 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
|
---|
[4166] | 393 | </target>
|
---|
[17338] | 394 | <target name="test-clean" depends="init-properties" description="Delete all built test files">
|
---|
[6121] | 395 | <delete dir="${test.dir}/build"/>
|
---|
[4166] | 396 | <delete dir="${test.dir}/report"/>
|
---|
[6133] | 397 | <delete file="${test.dir}/jacoco.exec" />
|
---|
[9501] | 398 | <delete file="${test.dir}/jacocoIT.exec" />
|
---|
[10850] | 399 | <delete file="${test.dir}/config/unit-josm.home" failonerror="false"/>
|
---|
| 400 | <delete file="${test.dir}/config/functional-josm.home" failonerror="false"/>
|
---|
| 401 | <delete file="${test.dir}/config/performance-josm.home" failonerror="false"/>
|
---|
[4166] | 402 | </target>
|
---|
[14065] | 403 | <macrodef name="call-javac">
|
---|
[7068] | 404 | <attribute name="testfamily"/>
|
---|
| 405 | <element name="cp-elements"/>
|
---|
| 406 | <sequential>
|
---|
[14065] | 407 | <javac srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}"
|
---|
[17906] | 408 | release="${java.lang.version}" debug="on"
|
---|
[16346] | 409 | includeantruntime="false" encoding="UTF-8">
|
---|
[14065] | 410 | <compilerarg value="-Xlint:all"/>
|
---|
[16603] | 411 | <compilerarg value="-Xlint:-path"/><!-- Suppress "bad path element .../xmpcore-6.0.6.jar: no such file or directory" warning, see https://github.com/drewnoakes/metadata-extractor/pull/483 -->
|
---|
[14065] | 412 | <compilerarg value="-Xlint:-serial"/>
|
---|
[7068] | 413 | <classpath>
|
---|
| 414 | <cp-elements/>
|
---|
| 415 | </classpath>
|
---|
[14065] | 416 | </javac>
|
---|
[18673] | 417 | <copy todir="${test.dir}/build/@{testfamily}/META-INF">
|
---|
| 418 | <fileset dir="${test.dir}/data/META-INF"/>
|
---|
| 419 | </copy>
|
---|
[7068] | 420 | </sequential>
|
---|
| 421 | </macrodef>
|
---|
[17338] | 422 | <target name="test-compile" depends="test-init,compile,extract-libraries,epsg,copy-resources" description="Compile all tests">
|
---|
[14065] | 423 | <call-javac testfamily="unit">
|
---|
[7068] | 424 | <cp-elements>
|
---|
| 425 | <path refid="test.classpath"/>
|
---|
| 426 | </cp-elements>
|
---|
[14065] | 427 | </call-javac>
|
---|
| 428 | <call-javac testfamily="functional">
|
---|
[7068] | 429 | <cp-elements>
|
---|
| 430 | <path refid="test.classpath"/>
|
---|
| 431 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 432 | </cp-elements>
|
---|
[14065] | 433 | </call-javac>
|
---|
| 434 | <call-javac testfamily="performance">
|
---|
[7068] | 435 | <cp-elements>
|
---|
| 436 | <path refid="test.classpath"/>
|
---|
| 437 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 438 | </cp-elements>
|
---|
[14065] | 439 | </call-javac>
|
---|
[4166] | 440 | </target>
|
---|
[7068] | 441 | <macrodef name="call-junit">
|
---|
| 442 | <attribute name="testfamily"/>
|
---|
[9501] | 443 | <attribute name="testITsuffix" default=""/>
|
---|
[13523] | 444 | <attribute name="coverage" default="${coverageByDefault}"/>
|
---|
[15032] | 445 | <attribute name="includes" default="${default-junit@{testITsuffix}-includes}"/>
|
---|
| 446 | <attribute name="excludes" default="${default-junit@{testITsuffix}-excludes}"/>
|
---|
[7068] | 447 | <sequential>
|
---|
[9501] | 448 | <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
|
---|
[16617] | 449 | <jacoco:agent destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}" dumponexit="true"
|
---|
[18858] | 450 | inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}"
|
---|
| 451 | property="jacocoagent@{testfamily}@{testITsuffix}" if:true="@{coverage}"/>
|
---|
[16617] | 452 | <junitlauncher printsummary="${junit.printsummary}" failureproperty="test.@{testfamily}@{testITsuffix}.failed">
|
---|
| 453 | <classpath>
|
---|
| 454 | <path refid="test.classpath"/>
|
---|
| 455 | <pathelement path="${test.dir}/build/unit"/> <!-- required for functional/etc to have JOSMTestRules -->
|
---|
| 456 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
| 457 | </classpath>
|
---|
| 458 | <testclasses outputDir="${test.dir}/report">
|
---|
| 459 | <fileset dir="${test.dir}/build/@{testfamily}" includes="@{includes}" excludes="@{excludes}"/>
|
---|
[18858] | 460 | <fork>
|
---|
| 461 | <jvmarg value="${jacocoagent@{testfamily}@{testITsuffix}}" if:set="jacocoagent@{testfamily}@{testITsuffix}" />
|
---|
| 462 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
| 463 | <jvmarg value="-Djava.locale.providers=SPI,JRE,CLDR" if:set="isJava9" />
|
---|
| 464 | <jvmarg value="-Djava.security.manager=allow" if:set="isJava17" />
|
---|
| 465 | <jvmarg value="-javaagent:${test.dir}/lib/jmockit.jar"/>
|
---|
| 466 | <jvmarg value="-Djunit.jupiter.extensions.autodetection.enabled=true"/>
|
---|
| 467 | <jvmarg value="-Djunit.jupiter.execution.parallel.enabled=true"/>
|
---|
| 468 | <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
|
---|
| 469 | <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
|
---|
| 470 | <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
|
---|
| 471 | <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
|
---|
| 472 | <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
|
---|
| 473 | <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
|
---|
[17689] | 474 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
[18858] | 475 | <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 476 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 477 | <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 478 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 479 | <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 480 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 481 | <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 482 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 483 | <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 484 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 485 | <jvmarg value="java.base/jdk.internal.loader=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 486 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 487 | <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 488 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
| 489 | <jvmarg value="java.prefs/java.util.prefs=ALL-UNNAMED" if:set="isJava9" />
|
---|
| 490 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
| 491 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
| 492 | <sysproperty key="java.awt.headless" value="${test.headless}"/>
|
---|
| 493 | <sysproperty key="java.security.manager" value="allow" if:set="isJava17" />
|
---|
| 494 | <sysproperty key="glass.platform" value="Monocle"/>
|
---|
| 495 | <sysproperty key="monocle.platform" value="Headless"/>
|
---|
| 496 | <sysproperty key="prism.order" value="sw"/>
|
---|
| 497 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
| 498 | <sysproperty key="junit.jupiter.execution.parallel.enabled" value="${junit.jupiter.execution.parallel.enabled}" if:set="junit.jupiter.execution.parallel.enabled"/>
|
---|
| 499 | <sysproperty key="junit.jupiter.execution.parallel.mode.default" value="${junit.jupiter.execution.parallel.mode.default}" if:set="junit.jupiter.execution.parallel.mode.default"/>
|
---|
| 500 | <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"/>
|
---|
| 501 | </fork>
|
---|
[17966] | 502 | <listener type="legacy-brief" sendSysOut="true" sendSysErr="true"/>
|
---|
[16617] | 503 | <listener type="legacy-plain" />
|
---|
| 504 | <listener type="legacy-xml" />
|
---|
| 505 | </testclasses>
|
---|
| 506 | </junitlauncher>
|
---|
[7068] | 507 | </sequential>
|
---|
| 508 | </macrodef>
|
---|
[9501] | 509 | <target name="test" depends="test-compile" unless="test.notRequired"
|
---|
[12534] | 510 | description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
[7068] | 511 | <call-junit testfamily="unit"/>
|
---|
| 512 | <call-junit testfamily="functional"/>
|
---|
[4166] | 513 | </target>
|
---|
[14141] | 514 | <target name="test-hardfail" depends="test" description="Run 'test' target but abort if tests failed">
|
---|
| 515 | <fail message="'test' failed">
|
---|
| 516 | <condition>
|
---|
| 517 | <or>
|
---|
| 518 | <isset property="test.unit.failed"/>
|
---|
| 519 | <isset property="test.functional.failed"/>
|
---|
| 520 | </or>
|
---|
| 521 | </condition>
|
---|
| 522 | </fail>
|
---|
| 523 | </target>
|
---|
| 524 | <target name="test-unit" depends="test-compile" unless="test-unit.notRequired"
|
---|
| 525 | description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
| 526 | <call-junit testfamily="unit"/>
|
---|
| 527 | </target>
|
---|
| 528 | <target name="test-unit-hardfail" depends="test-unit" description="Run 'test-unit' target but abort if tests failed">
|
---|
| 529 | <fail message="'test-unit' failed" if="test.unit.failed"/>
|
---|
| 530 | </target>
|
---|
[16051] | 531 | <target name="test-it" depends="test-compile,create-revision" unless="test-it.notRequired"
|
---|
[9501] | 532 | description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
| 533 | <call-junit testfamily="unit" testITsuffix="IT"/>
|
---|
| 534 | <call-junit testfamily="functional" testITsuffix="IT"/>
|
---|
| 535 | </target>
|
---|
[14141] | 536 | <target name="test-it-hardfail" depends="test-it" description="Run 'test-it' target but abort if tests failed">
|
---|
| 537 | <fail message="'test-it' failed">
|
---|
| 538 | <condition>
|
---|
| 539 | <or>
|
---|
| 540 | <isset property="test.unitIT.failed"/>
|
---|
| 541 | <isset property="test.functionalIT.failed"/>
|
---|
| 542 | </or>
|
---|
| 543 | </condition>
|
---|
| 544 | </fail>
|
---|
| 545 | </target>
|
---|
[12534] | 546 | <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
|
---|
| 547 | description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
| 548 | <call-junit testfamily="performance" coverage="false"/>
|
---|
| 549 | </target>
|
---|
[14141] | 550 | <target name="test-perf-hardfail" depends="test-perf" description="Run 'test-perf' target but abort if tests failed">
|
---|
| 551 | <fail message="'test-perf' failed" if="test.performance.failed"/>
|
---|
| 552 | </target>
|
---|
[15703] | 553 | <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML, CSV and XML test reports">
|
---|
[4166] | 554 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
| 555 | <junitreport todir="${test.dir}/report">
|
---|
| 556 | <fileset dir="${test.dir}/report">
|
---|
| 557 | <include name="TEST-*.xml"/>
|
---|
| 558 | </fileset>
|
---|
| 559 | <report todir="${test.dir}/report/html"/>
|
---|
| 560 | </junitreport>
|
---|
[6133] | 561 | <jacoco:report>
|
---|
| 562 | <executiondata>
|
---|
[11963] | 563 | <fileset dir="${test.dir}" includes="*.exec"/>
|
---|
[6133] | 564 | </executiondata>
|
---|
| 565 | <structure name="JOSM Test Coverage">
|
---|
| 566 | <classfiles>
|
---|
| 567 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
| 568 | </classfiles>
|
---|
| 569 | <sourcefiles encoding="UTF-8">
|
---|
| 570 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
| 571 | </sourcefiles>
|
---|
| 572 | </structure>
|
---|
[6134] | 573 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
[15703] | 574 | <xml destfile="${test.dir}/report/jacoco.xml"/>
|
---|
| 575 | <csv destfile="${test.dir}/report/jacoco.csv"/>
|
---|
[6133] | 576 | </jacoco:report>
|
---|
[4166] | 577 | </target>
|
---|
[18180] | 578 | <target name="dist-optimized" depends="dist" description="Build an optimized JOSM distribution file">
|
---|
[16243] | 579 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="proguard.classpath" conf="proguard"/>
|
---|
[16169] | 580 | <taskdef resource="proguard/ant/task.properties" classpathref="proguard.classpath"/>
|
---|
[4166] | 581 | <proguard>
|
---|
[12628] | 582 | -injars ${dist.jar}
|
---|
| 583 | -outjars ${dist-optimized.jar}
|
---|
[4166] | 584 |
|
---|
[14244] | 585 | -libraryjars ${java.home}/${java.library.dir}
|
---|
[4166] | 586 |
|
---|
[7367] | 587 | -dontoptimize
|
---|
| 588 | -dontobfuscate
|
---|
[16116] | 589 | -dontwarn org.jetbrains.annotations.**
|
---|
[4166] | 590 |
|
---|
[7367] | 591 | # These options probably are not necessary (and make processing a bit slower)
|
---|
| 592 | -dontskipnonpubliclibraryclasses
|
---|
| 593 | -dontskipnonpubliclibraryclassmembers
|
---|
[4166] | 594 |
|
---|
[7367] | 595 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
| 596 | public static void main(java.lang.String[]);
|
---|
| 597 | }
|
---|
[4166] | 598 |
|
---|
[7367] | 599 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
| 600 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
| 601 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
[10949] | 602 | -keep class org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClasses {
|
---|
[8532] | 603 | static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
|
---|
| 604 | }
|
---|
[4166] | 605 |
|
---|
[7367] | 606 | -keepclassmembers enum * {
|
---|
| 607 | public static **[] values();
|
---|
| 608 | public static ** valueOf(java.lang.String);
|
---|
| 609 | }
|
---|
[4166] | 610 |
|
---|
[12873] | 611 | # Keep unused public classes and methods (needed for plugins)
|
---|
| 612 | -keep public class * {
|
---|
[7367] | 613 | public protected *;
|
---|
| 614 | }
|
---|
[4838] | 615 |
|
---|
[12873] | 616 | # Keep serialization code
|
---|
[10949] | 617 | -keepclassmembers class * implements java.io.Serializable {
|
---|
[16617] | 618 | static final long serialVersionUID;
|
---|
[12873] | 619 | private static final java.io.ObjectStreamField[] serialPersistentFields;
|
---|
[10949] | 620 | private void writeObject(java.io.ObjectOutputStream);
|
---|
| 621 | private void readObject(java.io.ObjectInputStream);
|
---|
[16617] | 622 | java.lang.Object writeReplace();
|
---|
[12873] | 623 | java.lang.Object readResolve();
|
---|
[10949] | 624 | }
|
---|
| 625 |
|
---|
[7367] | 626 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
|
---|
| 627 | # This note should not be a problem as we don't use obfuscation
|
---|
| 628 | -dontnote
|
---|
[6133] | 629 | </proguard>
|
---|
[4166] | 630 | </target>
|
---|
[14244] | 631 | <target name="dist-optimized-report" depends="dist-optimized">
|
---|
[10845] | 632 | <!-- generate difference report between optimized jar and normal one -->
|
---|
| 633 | <exec executable="perl" dir="${basedir}">
|
---|
[13209] | 634 | <arg value="${tools.dir}/japicc/japi-compliance-checker.pl"/>
|
---|
[10845] | 635 | <arg value="--lib=JOSM"/>
|
---|
| 636 | <arg value="--keep-internal"/>
|
---|
| 637 | <arg value="--v1=${version.entry.commit.revision}"/>
|
---|
| 638 | <arg value="--v2=${version.entry.commit.revision}-optimized"/>
|
---|
| 639 | <arg value="--report-path=${dist.dir}/compat_report.html"/>
|
---|
[12628] | 640 | <arg value="${dist.jar}"/>
|
---|
| 641 | <arg value="${dist-optimized.jar}"/>
|
---|
[10845] | 642 | </exec>
|
---|
| 643 | </target>
|
---|
[18858] | 644 | <target name="check-plugins" depends="dist-optimized" description="Check of plugins binary compatibility" unless="isJava21">
|
---|
| 645 | <!-- animal_sniffer doesn't support Java 21 yet. The unless statement can be removed after animal_sniffer is updated to 1.24. -->
|
---|
[4166] | 646 | <local name="dir"/>
|
---|
| 647 | <local name="plugins"/>
|
---|
| 648 | <property name="dir" value="plugin-check"/>
|
---|
[17544] | 649 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="animal.classpath" conf="animal"/>
|
---|
[4166] | 650 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
[17544] | 651 | <classpath refid="animal.classpath"/>
|
---|
[4166] | 652 | </typedef>
|
---|
[13574] | 653 | <delete dir="${dir}" failonerror="false"/>
|
---|
[4166] | 654 | <mkdir dir="${dir}"/>
|
---|
| 655 | <!-- List of deprecated plugins -->
|
---|
[7133] | 656 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
[4166] | 657 | <filterchain>
|
---|
| 658 | <linecontains>
|
---|
| 659 | <contains value="new DeprecatedPlugin("/>
|
---|
| 660 | </linecontains>
|
---|
| 661 | <tokenfilter>
|
---|
| 662 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
| 663 | </tokenfilter>
|
---|
| 664 | <striplinebreaks/>
|
---|
| 665 | <tokenfilter>
|
---|
| 666 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
| 667 | </tokenfilter>
|
---|
| 668 | </filterchain>
|
---|
| 669 | </loadfile>
|
---|
[5498] | 670 | <!-- Download list of plugins -->
|
---|
[4166] | 671 | <loadresource property="plugins">
|
---|
[6955] | 672 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
[4166] | 673 | <filterchain>
|
---|
| 674 | <linecontainsregexp negate="true">
|
---|
| 675 | <regexp pattern="^\t.*"/>
|
---|
| 676 | </linecontainsregexp>
|
---|
| 677 | <linecontainsregexp negate="true">
|
---|
| 678 | <regexp pattern="${deprecated-plugins}"/>
|
---|
| 679 | </linecontainsregexp>
|
---|
[18858] | 680 | <!-- Ideally these would not be hardcoded, and instead read from the manifest file -->
|
---|
[15234] | 681 | <linecontainsregexp negate="true" unless:set="isJava11">
|
---|
[18858] | 682 | <!-- Skip Java 11 plugins -->
|
---|
| 683 | <regexp pattern="(areaselector|http|javafx|josm_magic_wand)\..*"/>
|
---|
[15234] | 684 | </linecontainsregexp>
|
---|
[18858] | 685 | <linecontainsregexp negate="true" unless:set="isJava17">
|
---|
| 686 | <!-- Skip Java 17 plugins -->
|
---|
| 687 | <regexp pattern="(ImageIO|pmtiles|todo|MapRoulette|mapwithai|contourmerge|scripting)\..*"/>
|
---|
| 688 | </linecontainsregexp>
|
---|
| 689 | <linecontainsregexp negate="true" unless:set="isJava21">
|
---|
| 690 | <!-- Skip Java 21 plugins -->
|
---|
| 691 | <regexp pattern="FIT\..*"/>
|
---|
| 692 | </linecontainsregexp>
|
---|
[4166] | 693 | <tokenfilter>
|
---|
| 694 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
| 695 | </tokenfilter>
|
---|
| 696 | </filterchain>
|
---|
[6133] | 697 | </loadresource>
|
---|
| 698 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
| 699 | <loadresource property="file-list">
|
---|
| 700 | <propertyresource name="plugins"/>
|
---|
| 701 | <filterchain>
|
---|
| 702 | <tokenfilter>
|
---|
| 703 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
| 704 | </tokenfilter>
|
---|
| 705 | <striplinebreaks/>
|
---|
| 706 | <tokenfilter>
|
---|
| 707 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
[9765] | 708 | </tokenfilter>
|
---|
[6133] | 709 | </filterchain>
|
---|
| 710 | </loadresource>
|
---|
| 711 | <delete>
|
---|
| 712 | <restrict>
|
---|
| 713 | <fileset dir="${dir}"/>
|
---|
| 714 | <not>
|
---|
| 715 | <name regex="${file-list}"/>
|
---|
| 716 | </not>
|
---|
| 717 | </restrict>
|
---|
| 718 | </delete>
|
---|
| 719 | <!-- Download plugins -->
|
---|
[12874] | 720 | <copy todir="${dir}" flatten="true" verbose="true" failonerror="false">
|
---|
[4166] | 721 | <resourcelist>
|
---|
| 722 | <string value="${plugins}"/>
|
---|
| 723 | </resourcelist>
|
---|
| 724 | </copy>
|
---|
| 725 | <!-- Check plugins -->
|
---|
[5498] | 726 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
| 727 | <path>
|
---|
[12628] | 728 | <fileset file="${dist-optimized.jar}"/>
|
---|
[14244] | 729 | <fileset file="${java.home}/lib/rt.jar" unless:set="isJava9"/>
|
---|
| 730 | <fileset file="${java.home}/lib/jce.jar" unless:set="isJava9"/>
|
---|
| 731 | <fileset file="${java.home}/lib/ext/jfxrt.jar" unless:set="isJava9"/>
|
---|
| 732 | <fileset dir="${java.home}/jmods" if:set="isJava9"/>
|
---|
[14997] | 733 | <fileset dir="/usr/share/openjfx/lib" unless:set="isJava9"/>
|
---|
[5498] | 734 | </path>
|
---|
[6133] | 735 | </as:build-signatures>
|
---|
[12873] | 736 | <as:check-signature signature="${dir}/api.sig" failonerror="false">
|
---|
[13711] | 737 | <ignore classname="afu.*"/>
|
---|
[13921] | 738 | <ignore classname="android.*"/>
|
---|
[12873] | 739 | <ignore classname="au.*"/>
|
---|
[7367] | 740 | <ignore classname="com.*"/>
|
---|
[12873] | 741 | <ignore classname="de.*"/>
|
---|
| 742 | <ignore classname="edu.*"/>
|
---|
| 743 | <ignore classname="groovy.*"/>
|
---|
[13962] | 744 | <ignore classname="io.*"/>
|
---|
[12873] | 745 | <ignore classname="it.*"/>
|
---|
[14167] | 746 | <ignore classname="java.lang.invoke.MethodHandle"/>
|
---|
[15639] | 747 | <ignore classname="java.nio.ByteBuffer"/>
|
---|
| 748 | <ignore classname="java.nio.FloatBuffer"/>
|
---|
[15387] | 749 | <ignore classname="java.util.list.kotlin.*"/>
|
---|
[7367] | 750 | <ignore classname="javax.*"/>
|
---|
[14245] | 751 | <ignore classname="jdk.swing.interop.*"/>
|
---|
[7367] | 752 | <ignore classname="jogamp.*"/>
|
---|
| 753 | <ignore classname="junit.*"/>
|
---|
[12873] | 754 | <ignore classname="kdu_jni.*"/>
|
---|
[15387] | 755 | <ignore classname="kotlin.*"/>
|
---|
[12873] | 756 | <ignore classname="net.*"/>
|
---|
| 757 | <ignore classname="netscape.*"/>
|
---|
| 758 | <ignore classname="nu.*"/>
|
---|
| 759 | <ignore classname="oracle.*"/>
|
---|
[7367] | 760 | <ignore classname="org.apache.*"/>
|
---|
[12873] | 761 | <ignore classname="org.bouncycastle.*"/>
|
---|
[13711] | 762 | <ignore classname="org.checkerframework.*"/>
|
---|
[7367] | 763 | <ignore classname="org.codehaus.*"/>
|
---|
[13921] | 764 | <ignore classname="org.conscrypt.*"/>
|
---|
[7367] | 765 | <ignore classname="org.dom4j.*"/>
|
---|
[12873] | 766 | <ignore classname="org.eclipse.*"/>
|
---|
| 767 | <ignore classname="org.ejml.*"/>
|
---|
[14164] | 768 | <ignore classname="org.fusesource.*"/>
|
---|
[12873] | 769 | <ignore classname="org.gdal.*"/>
|
---|
[15377] | 770 | <ignore classname="org.geotools.data.h2.*"/>
|
---|
| 771 | <ignore classname="org.geotools.gce.imagemosaic.*"/>
|
---|
[12873] | 772 | <ignore classname="org.hibernate.*"/>
|
---|
[7367] | 773 | <ignore classname="org.hsqldb.*"/>
|
---|
| 774 | <ignore classname="org.ibex.*"/>
|
---|
[7934] | 775 | <ignore classname="org.iso_relax.*"/>
|
---|
[7367] | 776 | <ignore classname="org.jaitools.*"/>
|
---|
| 777 | <ignore classname="org.jaxen.*"/>
|
---|
[12873] | 778 | <ignore classname="org.jboss.*"/>
|
---|
[14164] | 779 | <ignore classname="org.jctools.*"/>
|
---|
[13575] | 780 | <ignore classname="org.jdom.*"/>
|
---|
[7367] | 781 | <ignore classname="org.jdom2.*"/>
|
---|
[12873] | 782 | <ignore classname="org.jfree.*"/>
|
---|
[4166] | 783 | <ignore classname="org.jgraph.*"/>
|
---|
[12873] | 784 | <ignore classname="org.joda.*"/>
|
---|
[14164] | 785 | <ignore classname="org.json.*"/>
|
---|
[12873] | 786 | <ignore classname="org.junit.*"/>
|
---|
| 787 | <ignore classname="org.jvnet.*"/>
|
---|
[7367] | 788 | <ignore classname="org.kxml2.*"/>
|
---|
[15639] | 789 | <ignore classname="org.locationtech.*"/>
|
---|
[15462] | 790 | <ignore classname="org.mozilla.*"/>
|
---|
[8090] | 791 | <ignore classname="org.objectweb.*"/>
|
---|
[15387] | 792 | <ignore classname="org.opentest4j.*"/>
|
---|
[12873] | 793 | <ignore classname="org.osgi.*"/>
|
---|
| 794 | <ignore classname="org.postgresql.*"/>
|
---|
[7367] | 795 | <ignore classname="org.python.*"/>
|
---|
[12875] | 796 | <ignore classname="org.seasar.*"/>
|
---|
[7367] | 797 | <ignore classname="org.slf4j.*"/>
|
---|
[12873] | 798 | <ignore classname="org.springframework.*"/>
|
---|
| 799 | <ignore classname="org.testng.*"/>
|
---|
[13113] | 800 | <ignore classname="org.w3c.*"/>
|
---|
[12873] | 801 | <ignore classname="org.zeromq.*"/>
|
---|
[15540] | 802 | <ignore classname="waffle.*"/>
|
---|
[8173] | 803 | <!-- plugins used by another ones -->
|
---|
[7494] | 804 | <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
|
---|
[14244] | 805 | <ignore classname="org.openstreetmap.josm.plugins.jaxb.*"/>
|
---|
[7934] | 806 | <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
|
---|
[7494] | 807 | <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
|
---|
| 808 | <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
|
---|
[14244] | 809 | <ignore classname="org.openstreetmap.josm.plugins.openjfx.*"/>
|
---|
[7494] | 810 | <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
|
---|
[12875] | 811 | <ignore classname="sun.*"/>
|
---|
[4166] | 812 | <path path="${dir}"/>
|
---|
| 813 | </as:check-signature>
|
---|
| 814 | </target>
|
---|
[4838] | 815 |
|
---|
[17338] | 816 | <target name="script-compile" depends="test-compile" description="Compile all scripts">
|
---|
[15033] | 817 | <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="*.java"
|
---|
[17906] | 818 | destdir="${script-build.dir}" release="${java.lang.version}" debug="on"
|
---|
[16346] | 819 | includeantruntime="false" encoding="UTF-8">
|
---|
[15033] | 820 | <classpath>
|
---|
| 821 | <pathelement path="${build.dir}"/>
|
---|
| 822 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 823 | <pathelement path="${commons-lang3.jar}"/>
|
---|
| 824 | </classpath>
|
---|
[14636] | 825 | </javac>
|
---|
| 826 | </target>
|
---|
| 827 |
|
---|
[8687] | 828 | <macrodef name="_taginfo">
|
---|
| 829 | <attribute name="type"/>
|
---|
| 830 | <attribute name="output"/>
|
---|
| 831 | <sequential>
|
---|
| 832 | <echo message="Generating Taginfo for type @{type} to @{output}"/>
|
---|
[14636] | 833 | <java classname="TagInfoExtract" failonerror="true" fork="false">
|
---|
| 834 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
| 835 | <classpath>
|
---|
[16126] | 836 | <pathelement path="${build.dir}"/>
|
---|
[15033] | 837 | <pathelement path="${script-build.dir}"/>
|
---|
| 838 | <pathelement path="${commons-lang3.jar}"/>
|
---|
[14636] | 839 | </classpath>
|
---|
| 840 | <arg value="--type"/>
|
---|
[8687] | 841 | <arg value="@{type}"/>
|
---|
| 842 | <arg value="--noexit"/>
|
---|
| 843 | <arg value="--imgurlprefix"/>
|
---|
[14636] | 844 | <arg value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
|
---|
| 845 | <arg value="--output"/>
|
---|
[8687] | 846 | <arg value="@{output}"/>
|
---|
[14636] | 847 | </java>
|
---|
[8687] | 848 | </sequential>
|
---|
| 849 | </macrodef>
|
---|
| 850 |
|
---|
[17338] | 851 | <target name="taginfo" depends="script-compile" description="Generate project files Taginfo">
|
---|
[9250] | 852 | <_taginfo type="mappaint" output="taginfo_style.json"/>
|
---|
| 853 | <_taginfo type="presets" output="taginfo_presets.json"/>
|
---|
| 854 | <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
|
---|
[8687] | 855 | </target>
|
---|
| 856 |
|
---|
[17338] | 857 | <target name="imageryindex" depends="script-compile" description="Check editor imagery difference">
|
---|
[9505] | 858 | <echo message="Checking editor imagery difference"/>
|
---|
[15033] | 859 | <java classname="SyncEditorLayerIndex" failonerror="true" fork="false">
|
---|
| 860 | <classpath>
|
---|
[16126] | 861 | <pathelement path="${build.dir}"/>
|
---|
[15033] | 862 | <pathelement path="${script-build.dir}"/>
|
---|
| 863 | <pathelement path="${commons-lang3.jar}"/>
|
---|
| 864 | </classpath>
|
---|
| 865 | <arg value="--noeli"/>
|
---|
| 866 | <arg value="-p"/>
|
---|
| 867 | <arg value="imagery_eliout.imagery.xml"/>
|
---|
| 868 | <arg value="-q"/>
|
---|
| 869 | <arg value="imagery_josmout.imagery.xml"/>
|
---|
| 870 | </java>
|
---|
[9505] | 871 | </target>
|
---|
| 872 |
|
---|
[17338] | 873 | <target name="imageryindexdownload" description="Download and check editor imagery">
|
---|
[9505] | 874 | <exec append="false" executable="wget" failifexecutionfails="true">
|
---|
| 875 | <arg value="https://josm.openstreetmap.de/maps"/>
|
---|
| 876 | <arg value="-O"/>
|
---|
[11965] | 877 | <arg value="imagery_josm.imagery.xml"/>
|
---|
[9505] | 878 | <arg value="--unlink"/>
|
---|
| 879 | </exec>
|
---|
| 880 | <exec append="false" executable="wget" failifexecutionfails="true">
|
---|
[11238] | 881 | <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/>
|
---|
| 882 | <arg value="-O"/>
|
---|
[11965] | 883 | <arg value="imagery_josm.ignores.txt"/>
|
---|
[11238] | 884 | <arg value="--unlink"/>
|
---|
| 885 | </exec>
|
---|
| 886 | <exec append="false" executable="wget" failifexecutionfails="true">
|
---|
[16375] | 887 | <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/>
|
---|
[9505] | 888 | <arg value="-O"/>
|
---|
[11965] | 889 | <arg value="imagery_eli.geojson"/>
|
---|
[9505] | 890 | <arg value="--unlink"/>
|
---|
| 891 | </exec>
|
---|
| 892 | <antcall target="imageryindex"/>
|
---|
| 893 | </target>
|
---|
| 894 |
|
---|
[17338] | 895 | <target name="checkstyle-compile" depends="init" description="Compile Checkstyle rules">
|
---|
[16243] | 896 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="checkstyle.classpath" conf="checkstyle"/>
|
---|
[12582] | 897 | <mkdir dir="${checkstyle-build.dir}"/>
|
---|
[13209] | 898 | <javac sourcepath="" srcdir="${checkstyle.dir}/src" failonerror="true"
|
---|
[17906] | 899 | destdir="${checkstyle-build.dir}" release="${java.lang.version}" debug="on"
|
---|
[16346] | 900 | includeantruntime="false"
|
---|
[16171] | 901 | encoding="UTF-8" classpathref="checkstyle.classpath">
|
---|
[12582] | 902 | </javac>
|
---|
| 903 | </target>
|
---|
[17338] | 904 | <target name="checkstyle-changed" depends="checkstyle-compile" description="Run Checkstyle on SVN/Git-changed source files">
|
---|
[13303] | 905 | <exec append="false" osfamily="unix" executable="bash" failifexecutionfails="true">
|
---|
| 906 | <arg value="-c"/>
|
---|
[16171] | 907 | <arg value="(git ls-files src test --modified 2>/dev/null || svn status -q --ignore-externals src test) | grep -o '\(src\|test\)/.*' | xargs java -cp '${toString:checkstyle.classpath}:${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml | sed -e 's:\([^ ]*\) [^:]*/\([^:/]*.java\:[^:]*\):(\2)\1:'"/>
|
---|
[13303] | 908 | </exec>
|
---|
| 909 | <exec append="false" osfamily="windows" executable="powershell" failifexecutionfails="true">
|
---|
| 910 | <arg value="/c"/>
|
---|
[16171] | 911 | <arg value="svn status -q --ignore-externals src test | ForEach-Object {java -cp '${toString:checkstyle.classpath};${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml $_.split(' ')[7]}"/>
|
---|
[13303] | 912 | </exec>
|
---|
| 913 | </target>
|
---|
[17338] | 914 | <target name="checkstyle" depends="checkstyle-compile" description="Run Checkstyle on the source files">
|
---|
[16171] | 915 | <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties">
|
---|
| 916 | <classpath refid="checkstyle.classpath"/>
|
---|
| 917 | <classpath path="${checkstyle-build.dir}"/>
|
---|
| 918 | </taskdef>
|
---|
[13209] | 919 | <checkstyle config="${checkstyle.dir}/josm_checks.xml">
|
---|
[9765] | 920 | <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
|
---|
[9250] | 921 | excludes="gui/mappaint/mapcss/parsergen/*.java"/>
|
---|
[9765] | 922 | <fileset dir="${base.dir}/test" includes="**/*.java"/>
|
---|
[14637] | 923 | <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
|
---|
[11681] | 924 | <formatter type="plain"/>
|
---|
[8508] | 925 | <formatter type="xml" toFile="checkstyle-josm.xml"/>
|
---|
| 926 | </checkstyle>
|
---|
| 927 | </target>
|
---|
| 928 |
|
---|
[17338] | 929 | <target name="spotbugs" depends="dist" description="Run SpotBugs on the source files">
|
---|
[16243] | 930 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="spotbugs.classpath" conf="spotbugs"/>
|
---|
[16169] | 931 | <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpathref="spotbugs.classpath"/>
|
---|
[12801] | 932 | <spotbugs output="xml"
|
---|
| 933 | outputFile="spotbugs-josm.xml"
|
---|
[18055] | 934 | sourcePath="${src.dir}"
|
---|
[16166] | 935 | classpath="${toString:spotbugs.classpath}"
|
---|
[6133] | 936 | pluginList=""
|
---|
[13209] | 937 | excludeFilter="${spotbugs.dir}/josm-filter.xml"
|
---|
[16229] | 938 | onlyAnalyze="org.openstreetmap.josm.-"
|
---|
[6133] | 939 | effort="max"
|
---|
[10223] | 940 | reportLevel="low"
|
---|
[6133] | 941 | >
|
---|
[16229] | 942 | <class location="${dist.jar}" />
|
---|
[12801] | 943 | </spotbugs>
|
---|
[4838] | 944 | </target>
|
---|
[11713] | 945 |
|
---|
[17338] | 946 | <target name="pmd" depends="init" description="Run PMD on the source files">
|
---|
[16243] | 947 | <ivy:cachepath log="download-only" file="${tools.ivy}" pathid="pmd.classpath" conf="pmd"/>
|
---|
[16169] | 948 | <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpathref="pmd.classpath"/>
|
---|
[13209] | 949 | <pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
|
---|
[12628] | 950 | <sourceLanguage name="java" version="${java.lang.version}" />
|
---|
[13209] | 951 | <ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
|
---|
[11713] | 952 | <formatter type="text" toConsole="true" />
|
---|
| 953 | <formatter type="xml" toFile="pmd-josm.xml">
|
---|
| 954 | <param name="encoding" value="UTF-8" />
|
---|
| 955 | </formatter>
|
---|
| 956 | <fileset dir="${src.dir}">
|
---|
| 957 | <include name="org/openstreetmap/josm/**/*.java"/>
|
---|
| 958 | <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
|
---|
| 959 | </fileset>
|
---|
[14638] | 960 | <fileset dir="${base.dir}/scripts" includes="**/*.java"/>
|
---|
[11713] | 961 | </pmd>
|
---|
| 962 | </target>
|
---|
| 963 |
|
---|
[17338] | 964 | <target name="run" depends="dist" description="Run JOSM">
|
---|
[12628] | 965 | <java jar="${dist.jar}" fork="true">
|
---|
[5323] | 966 | <arg value="--set=expert=true"/>
|
---|
[15797] | 967 | <arg value="--set=iso.dates=true"/>
|
---|
[5323] | 968 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
| 969 | </java>
|
---|
| 970 | </target>
|
---|
[17338] | 971 | <target name="epsg-compile" depends="init"
|
---|
| 972 | description="Compile build script for generating projection list">
|
---|
[9765] | 973 | <property name="proj-classpath" location="${build.dir}"/>
|
---|
| 974 | <mkdir dir="${proj-build.dir}"/>
|
---|
[13794] | 975 | <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="BuildProjectionDefinitions.java"
|
---|
[17906] | 976 | destdir="${proj-build.dir}" release="${java.lang.version}" debug="on"
|
---|
[16346] | 977 | includeantruntime="false"
|
---|
[9765] | 978 | encoding="UTF-8" classpath="${proj-classpath}">
|
---|
[9133] | 979 | </javac>
|
---|
| 980 | </target>
|
---|
[17338] | 981 | <target name="epsg" unless="epsg.notRequired" depends="epsg-compile"
|
---|
| 982 | description="Generate projection list">
|
---|
[13236] | 983 | <touch file="${epsg.output}" mkdirs="true"/>
|
---|
[10259] | 984 | <java classname="BuildProjectionDefinitions" failonerror="true" fork="true">
|
---|
[9735] | 985 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
[9133] | 986 | <classpath>
|
---|
[16140] | 987 | <pathelement path="${resources.dir}"/>
|
---|
[9765] | 988 | <pathelement path="${proj-classpath}"/>
|
---|
| 989 | <pathelement path="${proj-build.dir}"/>
|
---|
[9133] | 990 | </classpath>
|
---|
[9765] | 991 | <arg value="${base.dir}"/>
|
---|
[9133] | 992 | </java>
|
---|
| 993 | </target>
|
---|
[17338] | 994 | <target name="update-proj-files" depends="test-compile"
|
---|
| 995 | description="Update projection test files after an update of projection definitions">
|
---|
[14568] | 996 | <java classname="org.openstreetmap.josm.data.projection.ProjectionRefTest" failonerror="true" fork="true">
|
---|
| 997 | <classpath>
|
---|
| 998 | <path refid="test.classpath"/>
|
---|
| 999 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 1000 | </classpath>
|
---|
| 1001 | </java>
|
---|
| 1002 | <java classname="org.openstreetmap.josm.data.projection.ProjectionRegressionTest" failonerror="true" fork="true">
|
---|
| 1003 | <classpath>
|
---|
| 1004 | <path refid="test.classpath"/>
|
---|
| 1005 | <pathelement path="${test.dir}/build/unit"/>
|
---|
| 1006 | </classpath>
|
---|
| 1007 | </java>
|
---|
| 1008 | </target>
|
---|
[17338] | 1009 | <target name="jdeps" depends="compile" description="Generate jdeps dependency graph">
|
---|
[14136] | 1010 | <delete dir="${modules.dir}"/>
|
---|
| 1011 | <mkdir dir="${modules.dir}"/>
|
---|
| 1012 | <!-- JOSM only -->
|
---|
| 1013 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-actions.jar" includes="org/openstreetmap/josm/actions/**/*.class"/>
|
---|
| 1014 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-cli.jar" includes="org/openstreetmap/josm/cli/**/*.class"/>
|
---|
| 1015 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-command.jar" includes="org/openstreetmap/josm/command/**/*.class"/>
|
---|
| 1016 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-data.jar" includes="org/openstreetmap/josm/data/**/*.class"/>
|
---|
| 1017 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-gui.jar" includes="org/openstreetmap/josm/gui/**/*.class"/>
|
---|
| 1018 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-io.jar" includes="org/openstreetmap/josm/io/**/*.class"/>
|
---|
| 1019 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-plugins.jar" includes="org/openstreetmap/josm/plugins/**/*.class"/>
|
---|
| 1020 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-spi.jar" includes="org/openstreetmap/josm/spi/**/*.class"/>
|
---|
| 1021 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/josm-tools.jar" includes="org/openstreetmap/josm/tools/**/*.class"/>
|
---|
| 1022 | <exec executable="jdeps" dir="${modules.dir}">
|
---|
[16050] | 1023 | <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.*|oauth.*|org.apache.*|org.glassfish.*|org.openstreetmap.gui.*'"/>
|
---|
[14136] | 1024 | <arg line="-dotoutput dots *.jar"/>
|
---|
| 1025 | </exec>
|
---|
| 1026 | <exec executable="dot" dir="${modules.dir}/dots">
|
---|
| 1027 | <arg line="-O -Tpng summary.dot"/>
|
---|
| 1028 | </exec>
|
---|
| 1029 | <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-without-dependencies.png"/>
|
---|
| 1030 | <!-- Direct dependencies -->
|
---|
[16050] | 1031 | <copy todir="${modules.dir}" flatten="true">
|
---|
| 1032 | <fileset refid="runtime.fileset" />
|
---|
| 1033 | </copy>
|
---|
[14136] | 1034 | <exec executable="jdeps" dir="${modules.dir}">
|
---|
[16408] | 1035 | <arg line="-f 'java.*|org.xml.*|org.w3c.*|sun.*|com.sun.*|com.google.*|org.tukaani.*'"/>
|
---|
[14136] | 1036 | <arg line="-dotoutput dots *.jar"/>
|
---|
| 1037 | </exec>
|
---|
| 1038 | <exec executable="dot" dir="${modules.dir}/dots">
|
---|
| 1039 | <arg line="-O -Tpng summary.dot"/>
|
---|
| 1040 | </exec>
|
---|
| 1041 | <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-direct-dependencies.png"/>
|
---|
| 1042 | <!-- All dependencies -->
|
---|
| 1043 | <jar basedir="${build.dir}" level="${clevel}" destfile="${modules.dir}/google-gdata.jar" includes="com/google/**/*.class"/>
|
---|
| 1044 | <exec executable="jdeps" dir="${modules.dir}">
|
---|
| 1045 | <arg line="-dotoutput dots *.jar"/>
|
---|
| 1046 | </exec>
|
---|
| 1047 | <exec executable="dot" dir="${modules.dir}/dots">
|
---|
| 1048 | <arg line="-O -Tpng summary.dot"/>
|
---|
| 1049 | </exec>
|
---|
| 1050 | <move file="${modules.dir}/dots/summary.dot.png" tofile="${modules.dir}/josm-with-all-dependencies.png"/>
|
---|
| 1051 | </target>
|
---|
[16050] | 1052 | <target name="resolve" depends="init-ivy" unless="resolve.notRequired" description="Resolve Ivy dependencies">
|
---|
[16125] | 1053 | <ivy:settings file="${base.dir}/ivysettings.xml"/>
|
---|
[16243] | 1054 | <ivy:resolve log="download-only" file="${base.dir}/ivy.xml" keep="true"/>
|
---|
| 1055 | <ivy:cachepath log="download-only" pathid="compile.path" conf="compile"/>
|
---|
| 1056 | <ivy:cachepath log="download-only" pathid="runtime.path" conf="runtime"/>
|
---|
| 1057 | <ivy:cachefileset log="download-only" setid="runtime.fileset" conf="runtime"/>
|
---|
| 1058 | <ivy:cachepath log="download-only" pathid="test.path" conf="test"/>
|
---|
[15977] | 1059 | </target>
|
---|
[17338] | 1060 | <target name="extract-libraries" depends="resolve" description="Extract libraries to build dir">
|
---|
[16002] | 1061 | <unzip dest="${build.dir}">
|
---|
| 1062 | <fileset refid="runtime.fileset"/>
|
---|
| 1063 | <patternset>
|
---|
[16397] | 1064 | <exclude name="META-INF/*"/>
|
---|
| 1065 | <exclude name="META-INF/maven/**"/>
|
---|
[17644] | 1066 | <exclude name="META-INF/resources/webjars/tag2link/*/LICENSE"/>
|
---|
| 1067 | <exclude name="META-INF/resources/webjars/tag2link/*/README.md"/>
|
---|
| 1068 | <exclude name="META-INF/resources/webjars/tag2link/*/build.js"/>
|
---|
| 1069 | <exclude name="META-INF/resources/webjars/tag2link/*/package.json"/>
|
---|
| 1070 | <exclude name="META-INF/resources/webjars/tag2link/*/schema.json"/>
|
---|
| 1071 | <exclude name="META-INF/resources/webjars/tag2link/*/tag2link.sophox.sparql"/>
|
---|
| 1072 | <exclude name="META-INF/resources/webjars/tag2link/*/tag2link.wikidata.sparql"/>
|
---|
[16397] | 1073 | <exclude name="META-INF/versions/**"/>
|
---|
[16002] | 1074 | <exclude name="*"/>
|
---|
[16194] | 1075 | <exclude name="org/openstreetmap/gui/jmapviewer/Demo*"/>
|
---|
[16027] | 1076 | <exclude name="com/drew/imaging/FileTypeDetector*"/>
|
---|
| 1077 | <exclude name="com/drew/imaging/ImageMetadataReader*"/>
|
---|
[16025] | 1078 | <exclude name="com/drew/imaging/avi/**"/>
|
---|
| 1079 | <exclude name="com/drew/imaging/bmp/**"/>
|
---|
| 1080 | <exclude name="com/drew/imaging/eps/**"/>
|
---|
| 1081 | <exclude name="com/drew/imaging/gif/**"/>
|
---|
| 1082 | <exclude name="com/drew/imaging/heif/**"/>
|
---|
| 1083 | <exclude name="com/drew/imaging/ico/**"/>
|
---|
| 1084 | <exclude name="com/drew/imaging/mp3/**"/>
|
---|
| 1085 | <exclude name="com/drew/imaging/mp4/**"/>
|
---|
| 1086 | <exclude name="com/drew/imaging/pcx/**"/>
|
---|
| 1087 | <exclude name="com/drew/imaging/psd/**"/>
|
---|
| 1088 | <exclude name="com/drew/imaging/quicktime/**"/>
|
---|
| 1089 | <exclude name="com/drew/imaging/raf/**"/>
|
---|
| 1090 | <exclude name="com/drew/imaging/riff/**"/>
|
---|
| 1091 | <exclude name="com/drew/imaging/wav/**"/>
|
---|
| 1092 | <exclude name="com/drew/imaging/webp/**"/>
|
---|
| 1093 | <exclude name="com/drew/metadata/avi/**"/>
|
---|
| 1094 | <exclude name="com/drew/metadata/bmp/**"/>
|
---|
| 1095 | <exclude name="com/drew/metadata/eps/**"/>
|
---|
| 1096 | <exclude name="com/drew/metadata/gif/**"/>
|
---|
| 1097 | <exclude name="com/drew/metadata/heif/**"/>
|
---|
| 1098 | <exclude name="com/drew/metadata/ico/**"/>
|
---|
| 1099 | <exclude name="com/drew/metadata/mov/**"/>
|
---|
| 1100 | <exclude name="com/drew/metadata/mp3/**"/>
|
---|
| 1101 | <exclude name="com/drew/metadata/mp4/**"/>
|
---|
| 1102 | <exclude name="com/drew/metadata/pcx/**"/>
|
---|
| 1103 | <exclude name="com/drew/metadata/wav/**"/>
|
---|
| 1104 | <exclude name="com/drew/metadata/webp/**"/>
|
---|
| 1105 | <exclude name="com/drew/tools/**"/>
|
---|
[18072] | 1106 | <exclude name="com/kitfox/svg/app/ant/**"/>
|
---|
| 1107 | <exclude name="com/kitfox/svg/app/*Dialog*"/>
|
---|
| 1108 | <exclude name="com/kitfox/svg/app/*Frame*"/>
|
---|
| 1109 | <exclude name="com/kitfox/svg/app/*Player*"/>
|
---|
| 1110 | <exclude name="com/kitfox/svg/app/*Viewer*"/>
|
---|
[16026] | 1111 | <exclude name="org/apache/commons/compress/PasswordRequiredException*"/>
|
---|
[16023] | 1112 | <exclude name="org/apache/commons/compress/archivers/**"/>
|
---|
| 1113 | <exclude name="org/apache/commons/compress/changes/**"/>
|
---|
[16026] | 1114 | <exclude name="org/apache/commons/compress/compressors/bzip2/BZip2Utils*"/>
|
---|
[16023] | 1115 | <exclude name="org/apache/commons/compress/compressors/brotli/**"/>
|
---|
[16026] | 1116 | <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory*"/>
|
---|
| 1117 | <exclude name="org/apache/commons/compress/compressors/CompressorStreamProvider*"/>
|
---|
| 1118 | <exclude name="org/apache/commons/compress/compressors/CompressorException*"/>
|
---|
| 1119 | <exclude name="org/apache/commons/compress/compressors/FileNameUtil*"/>
|
---|
[16023] | 1120 | <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
|
---|
| 1121 | <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
|
---|
| 1122 | <exclude name="org/apache/commons/compress/compressors/lz4/**"/>
|
---|
| 1123 | <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
|
---|
| 1124 | <exclude name="org/apache/commons/compress/compressors/lz77support/**"/>
|
---|
| 1125 | <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
|
---|
| 1126 | <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
|
---|
[16026] | 1127 | <exclude name="org/apache/commons/compress/compressors/xz/XZUtils*"/>
|
---|
[16023] | 1128 | <exclude name="org/apache/commons/compress/compressors/z/**"/>
|
---|
| 1129 | <exclude name="org/apache/commons/compress/compressors/zstandard/**"/>
|
---|
[18333] | 1130 | <exclude name="org/apache/commons/compress/java/util/jar/Pack200*"/>
|
---|
| 1131 | <exclude name="org/apache/commons/compress/harmony/pack200/**"/>
|
---|
| 1132 | <exclude name="org/apache/commons/compress/harmony/unpack200/**"/>
|
---|
[16023] | 1133 | <exclude name="org/apache/commons/compress/parallel/**"/>
|
---|
[16026] | 1134 | <exclude name="org/apache/commons/compress/utils/ArchiveUtils*"/>
|
---|
[16399] | 1135 | <exclude name="org/apache/commons/jcs3/auxiliary/disk/jdbc/**"/>
|
---|
| 1136 | <exclude name="org/apache/commons/jcs3/auxiliary/remote/http/client/**"/>
|
---|
| 1137 | <exclude name="org/apache/commons/jcs3/auxiliary/remote/http/server/RemoteHttpCacheServlet*"/>
|
---|
| 1138 | <exclude name="org/apache/commons/jcs3/auxiliary/remote/server/RemoteCacheStartupServlet*"/>
|
---|
| 1139 | <exclude name="org/apache/commons/jcs3/log/Log4j2Factory*"/>
|
---|
| 1140 | <exclude name="org/apache/commons/jcs3/log/Log4j2LogAdapter*"/>
|
---|
| 1141 | <exclude name="org/apache/commons/jcs3/utils/servlet/**"/>
|
---|
[16002] | 1142 | </patternset>
|
---|
| 1143 | </unzip>
|
---|
| 1144 | </target>
|
---|
[17338] | 1145 | <target name="sources" description="Generate jar file of JOSM source files and its dependencies" depends="init,epsg,resolve">
|
---|
[16243] | 1146 | <ivy:cachefileset log="download-only" setid="sources.fileset" conf="sources"/>
|
---|
[16141] | 1147 | <jar destfile="${dist-sources.jar}" level="${clevel}">
|
---|
| 1148 | <zipgroupfileset refid="sources.fileset"/>
|
---|
[16350] | 1149 | <fileset dir="${src.dir}"/>
|
---|
[16141] | 1150 | <fileset dir="${resources.dir}"/>
|
---|
| 1151 | </jar>
|
---|
| 1152 | </target>
|
---|
[15977] | 1153 | <target name="bootstrap-workspace" description="Copy libraries from ivy cache to workspace folders for IDE" depends="resolve">
|
---|
| 1154 | <delete dir="${lib.dir}"/>
|
---|
[16229] | 1155 | <ivy:retrieve pattern="${lib.dir}/[conf]/[artifact]-[type].[ext]" conf="compile,runtime,sources,test"/>
|
---|
[16556] | 1156 | <ivy:retrieve pattern="${lib.dir}/tools/[artifact]-[type].[ext]" conf="javacc,checkstyle,pmd,spotbugs,errorprone" file="${tools.ivy}"/>
|
---|
[15977] | 1157 | </target>
|
---|
[17338] | 1158 | <target name="ivy-report" description="Generate Ivy reports of dependency resolving" depends="resolve">
|
---|
[16243] | 1159 | <ivy:report todir="${tools.dir}/ivy-report" graph="false"/>
|
---|
| 1160 | </target>
|
---|
[16898] | 1161 | <target name="ivy-checkdepsupdate" description="Display dependency updates on the console" depends="resolve">
|
---|
[18332] | 1162 | <ivy:resolve log="quiet" file="${tools.ivy}" keep="true" conf="*"/>
|
---|
[16898] | 1163 | <ivy:checkdepsupdate/>
|
---|
[18332] | 1164 | <echo message="${line.separator}"/>
|
---|
| 1165 | <ivy:resolve log="quiet" file="${base.dir}/ivy.xml" keep="true" conf="*"/>
|
---|
| 1166 | <ivy:checkdepsupdate/>
|
---|
[16898] | 1167 | </target>
|
---|
[16229] | 1168 | <target name="api-dependency-tree" description="Displays Ivy dependency tree for JOSM API" depends="resolve">
|
---|
| 1169 | <ivy:dependencytree conf="api"/>
|
---|
| 1170 | </target>
|
---|
| 1171 | <target name="test-dependency-tree" description="Displays Ivy dependency tree for JOSM tests" depends="resolve">
|
---|
| 1172 | <ivy:dependencytree conf="test"/>
|
---|
| 1173 | </target>
|
---|
[4166] | 1174 | </project>
|
---|