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