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