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 xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless">
|
---|
12 | <target name="init-properties">
|
---|
13 | <property environment="env"/>
|
---|
14 | <!-- Load properties in a target and not at top level, so this build file can be
|
---|
15 | imported from an IDE ant file (Netbeans) without messing up IDE properties.
|
---|
16 | When imported from another file, ${basedir} will point to the parent directory
|
---|
17 | of the importing ant file. Use ${base.dir} instead, which is always the parent
|
---|
18 | directory of this file. -->
|
---|
19 | <dirname property="base.dir" file="${ant.file.josm}"/>
|
---|
20 | <property name="test.dir" location="${base.dir}/test"/>
|
---|
21 | <property name="src.dir" location="${base.dir}/src"/>
|
---|
22 | <condition property="noJavaFX">
|
---|
23 | <or>
|
---|
24 | <isset property="env.JOSM_NOJAVAFX"/>
|
---|
25 | <not>
|
---|
26 | <available classname="javafx.scene.media.Media"/>
|
---|
27 | </not>
|
---|
28 | </or>
|
---|
29 | </condition>
|
---|
30 | <property name="build.dir" location="${base.dir}/build"/>
|
---|
31 | <property name="dist.dir" location="${base.dir}/dist"/>
|
---|
32 | <property name="tools.dir" location="${base.dir}/tools"/>
|
---|
33 | <property name="pmd.dir" location="${tools.dir}/pmd"/>
|
---|
34 | <property name="checkstyle.dir" location="${tools.dir}/checkstyle"/>
|
---|
35 | <property name="spotbugs.dir" location="${tools.dir}/spotbugs"/>
|
---|
36 | <property name="javacc.home" location="${tools.dir}"/>
|
---|
37 | <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
|
---|
38 | <property name="proj-build.dir" location="${base.dir}/build2"/>
|
---|
39 | <property name="checkstyle-build.dir" location="${base.dir}/build2"/>
|
---|
40 | <property name="epsg.output" location="${base.dir}/data/projection/custom-epsg"/>
|
---|
41 | <property name="error_prone_ant.jar" location="${tools.dir}/error_prone_ant.jar"/>
|
---|
42 | <property name="dist.jar" location="${dist.dir}/josm-custom.jar"/>
|
---|
43 | <property name="dist-optimized.jar" location="${dist.dir}/josm-custom-optimized.jar"/>
|
---|
44 | <property name="java.lang.version" value="1.8" />
|
---|
45 | <property name="test.headless" value="true" />
|
---|
46 | <property name="jacoco.includes" value="org.openstreetmap.josm.*" />
|
---|
47 | <property name="jacoco.inclbootstrapclasses" value="false" />
|
---|
48 | <property name="jacoco.inclnolocationclasses" value="false" />
|
---|
49 | <!-- build parameter: compression level (ant -Dclevel=N)
|
---|
50 | N ranges from 0 (no compression) to 9 (maximum compression)
|
---|
51 | default: 9 -->
|
---|
52 | <condition property="clevel" value="${clevel}" else="9">
|
---|
53 | <isset property="clevel"/>
|
---|
54 | </condition>
|
---|
55 | <!-- For Java9-specific stuff -->
|
---|
56 | <condition property="isJava9">
|
---|
57 | <matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" />
|
---|
58 | </condition>
|
---|
59 | <!-- For Java10-specific stuff -->
|
---|
60 | <condition property="isJava10">
|
---|
61 | <matches string="${ant.java.version}" pattern="1[0-9]" />
|
---|
62 | </condition>
|
---|
63 | <!-- For Java11-specific stuff -->
|
---|
64 | <condition property="isJava11">
|
---|
65 | <matches string="${ant.java.version}" pattern="1[1-9]" />
|
---|
66 | </condition>
|
---|
67 | <!-- Disable error_prone on Java 10+, see https://github.com/google/error-prone/issues/860 -->
|
---|
68 | <condition property="javac.compiler" value="modern" else="com.google.errorprone.ErrorProneAntCompilerAdapter">
|
---|
69 | <isset property="isJava10"/>
|
---|
70 | </condition>
|
---|
71 | <!-- Disable jacoco on Java 11+, see https://github.com/jacoco/jacoco/issues/629 -->
|
---|
72 | <condition property="coverageByDefault">
|
---|
73 | <not>
|
---|
74 | <isset property="isJava11"/>
|
---|
75 | </not>
|
---|
76 | </condition>
|
---|
77 | <path id="groovy.classpath">
|
---|
78 | <fileset dir="${tools.dir}/groovy">
|
---|
79 | <include name="*.jar"/>
|
---|
80 | </fileset>
|
---|
81 | </path>
|
---|
82 | <path id="test.classpath">
|
---|
83 | <fileset dir="${test.dir}/lib">
|
---|
84 | <include name="**/*.jar"/>
|
---|
85 | </fileset>
|
---|
86 | <pathelement path="${dist.jar}"/>
|
---|
87 | <pathelement path="${toString:groovy.classpath}"/>
|
---|
88 | <pathelement path="${spotbugs.dir}/spotbugs-annotations.jar"/>
|
---|
89 | </path>
|
---|
90 | <path id="pmd.classpath">
|
---|
91 | <fileset dir="${pmd.dir}">
|
---|
92 | <include name="*.jar"/>
|
---|
93 | </fileset>
|
---|
94 | </path>
|
---|
95 | </target>
|
---|
96 |
|
---|
97 | <!--
|
---|
98 | ** Used by Eclipse ant builder for updating
|
---|
99 | ** the REVISION file used by JOSM
|
---|
100 | -->
|
---|
101 | <target name="create-revision-eclipse">
|
---|
102 | <property name="revision.dir" value="bin"/>
|
---|
103 | <antcall target="create-revision"/>
|
---|
104 | <mkdir dir="bin/META-INF/services"/>
|
---|
105 | <echo encoding="UTF-8" file="bin/META-INF/services/java.text.spi.DecimalFormatSymbolsProvider">org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider</echo>
|
---|
106 | </target>
|
---|
107 | <!--
|
---|
108 | ** Initializes the REVISION.XML file from SVN information
|
---|
109 | -->
|
---|
110 | <target name="init-svn-revision-xml" depends="init-properties">
|
---|
111 | <exec append="false" output="${base.dir}/REVISION.XML" executable="svn" dir="${base.dir}" failifexecutionfails="false" resultproperty="svn.info.result">
|
---|
112 | <env key="LANG" value="C"/>
|
---|
113 | <arg value="info"/>
|
---|
114 | <arg value="--xml"/>
|
---|
115 | <arg value="."/>
|
---|
116 | </exec>
|
---|
117 | <condition property="svn.info.success">
|
---|
118 | <equals arg1="${svn.info.result}" arg2="0" />
|
---|
119 | </condition>
|
---|
120 | </target>
|
---|
121 | <!--
|
---|
122 | ** Initializes the REVISION.XML file from git information
|
---|
123 | -->
|
---|
124 | <target name="init-git-revision-xml" unless="svn.info.success" depends="init-properties">
|
---|
125 | <exec append="false" output="${base.dir}/REVISION.XML" executable="git" dir="${base.dir}" failifexecutionfails="false">
|
---|
126 | <arg value="log"/>
|
---|
127 | <arg value="-1"/>
|
---|
128 | <arg value="--grep=git-svn-id"/>
|
---|
129 | <!--
|
---|
130 | %B: raw body (unwrapped subject and body)
|
---|
131 | %n: new line
|
---|
132 | %ai: author date, ISO 8601 format
|
---|
133 | -->
|
---|
134 | <arg value="--pretty=format:%B%n%ai"/>
|
---|
135 | <arg value="HEAD"/>
|
---|
136 | </exec>
|
---|
137 | <replaceregexp file="${base.dir}/REVISION.XML" flags="s"
|
---|
138 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
139 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
140 | </target>
|
---|
141 | <!--
|
---|
142 | ** Creates the REVISION file to be included in the distribution
|
---|
143 | -->
|
---|
144 | <target name="create-revision" depends="init-properties,init-svn-revision-xml,init-git-revision-xml">
|
---|
145 | <property name="revision.dir" value="${build.dir}"/>
|
---|
146 | <xmlproperty file="${base.dir}/REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
147 | <delete file="${base.dir}/REVISION.XML"/>
|
---|
148 | <tstamp>
|
---|
149 | <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
|
---|
150 | </tstamp>
|
---|
151 | <property name="version.entry.commit.revision" value="UNKNOWN"/>
|
---|
152 | <property name="version.entry.commit.date" value="UNKNOWN"/>
|
---|
153 | <mkdir dir="${revision.dir}"/>
|
---|
154 | <!-- add Build-Name: ... when making special builds, e.g. DEBIAN -->
|
---|
155 | <echo file="${revision.dir}/REVISION">
|
---|
156 | # automatically generated by JOSM build.xml - do not edit
|
---|
157 | Revision: ${version.entry.commit.revision}
|
---|
158 | Is-Local-Build: true
|
---|
159 | Build-Date: ${build.tstamp}
|
---|
160 | </echo>
|
---|
161 | </target>
|
---|
162 | <!--
|
---|
163 | ** Check internal XML files against their XSD
|
---|
164 | -->
|
---|
165 | <target name="check-schemas" unless="check-schemas.notRequired" depends="init-properties">
|
---|
166 | <schemavalidate file="data/defaultpresets.xml" >
|
---|
167 | <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
|
---|
168 | </schemavalidate>
|
---|
169 | </target>
|
---|
170 | <!--
|
---|
171 | ** Main target that builds JOSM and checks XML against schemas
|
---|
172 | -->
|
---|
173 | <target name="dist" depends="compile,create-revision,check-schemas,epsg">
|
---|
174 | <echo>Revision ${version.entry.commit.revision}</echo>
|
---|
175 | <copy file="CONTRIBUTION" todir="${build.dir}"/>
|
---|
176 | <copy file="README" todir="${build.dir}"/>
|
---|
177 | <copy file="LICENSE" todir="${build.dir}"/>
|
---|
178 | <!-- create josm-custom.jar -->
|
---|
179 | <delete file="${dist.jar}"/>
|
---|
180 | <jar destfile="${dist.jar}" basedir="${build.dir}" level="${clevel}">
|
---|
181 | <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
|
---|
182 | <manifest>
|
---|
183 | <attribute name="Main-class" value="org.openstreetmap.josm.gui.MainApplication"/>
|
---|
184 | <attribute name="Main-Version" value="${version.entry.commit.revision} SVN"/>
|
---|
185 | <attribute name="Main-Date" value="${version.entry.commit.date}"/>
|
---|
186 | <attribute name="Permissions" value="all-permissions"/>
|
---|
187 | <attribute name="Codebase" value="josm.openstreetmap.de"/>
|
---|
188 | <attribute name="Application-Name" value="JOSM - Java OpenStreetMap Editor"/>
|
---|
189 | <!-- Java 9 stuff. Entries are safely ignored by Java 8 -->
|
---|
190 | <attribute name="Add-Exports" value="java.base/sun.security.util java.base/sun.security.x509 java.desktop/com.apple.eawt java.desktop/com.sun.imageio.spi javafx.graphics/com.sun.javafx.application jdk.deploy/com.sun.deploy.config" />
|
---|
191 | <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" />
|
---|
192 | </manifest>
|
---|
193 | <service type="java.text.spi.DecimalFormatSymbolsProvider" provider="org.openstreetmap.josm.tools.JosmDecimalFormatSymbolsProvider" />
|
---|
194 | <zipfileset dir="images" prefix="images"/>
|
---|
195 | <zipfileset dir="data" prefix="data"/>
|
---|
196 | <zipfileset dir="styles" prefix="styles"/>
|
---|
197 | <zipfileset dir="${src.dir}/org/openstreetmap/gui/jmapviewer/images" prefix="org/openstreetmap/gui/jmapviewer/images"/>
|
---|
198 | </jar>
|
---|
199 | </target>
|
---|
200 | <!-- Mac OS X target -->
|
---|
201 | <target name="mac" depends="init-properties">
|
---|
202 | <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
|
---|
203 | <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="${tools.dir}/appbundler-1.0ea.jar"/>
|
---|
204 | <!-- create MacOS X application bundle -->
|
---|
205 | <bundleapp outputdirectory="${bundle.outdir}" name="JOSM" displayname="JOSM" executablename="JOSM" identifier="org.openstreetmap.josm"
|
---|
206 | mainclassname="org.openstreetmap.josm.gui.MainApplication"
|
---|
207 | copyright="JOSM, and all its integral parts, are released under the GNU General Public License v2 or later"
|
---|
208 | applicationCategory="public.app-category.utilities"
|
---|
209 | shortversion="${version.entry.commit.revision} SVN"
|
---|
210 | version="${version.entry.commit.revision} SVN"
|
---|
211 | icon="macosx/JOSM.app/Contents/Resources/JOSM.icns"
|
---|
212 | highResolutionCapable="true">
|
---|
213 |
|
---|
214 | <arch name="x86_64"/>
|
---|
215 | <arch name="i386"/>
|
---|
216 |
|
---|
217 | <classpath file="${bundle.jar}"/>
|
---|
218 |
|
---|
219 | <option value="-Xmx2048m"/>
|
---|
220 |
|
---|
221 | <option value="-Xdock:icon=Contents/Resources/JOSM.icns"/>
|
---|
222 | <option value="-Xdock:name=JOSM"/>
|
---|
223 |
|
---|
224 | <!-- OSX specific options, optional -->
|
---|
225 | <option value="-Dapple.laf.useScreenMenuBar=true"/>
|
---|
226 | <option value="-Dcom.apple.macos.use-file-dialog-packages=true"/>
|
---|
227 | <option value="-Dcom.apple.macos.useScreenMenuBar=true"/>
|
---|
228 | <option value="-Dcom.apple.mrj.application.apple.menu.about.name=JOSM"/>
|
---|
229 | <option value="-Dcom.apple.smallTabs=true"/>
|
---|
230 | </bundleapp>
|
---|
231 |
|
---|
232 | <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
|
---|
233 | <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="${tools.dir}/xmltask.jar"/>
|
---|
234 |
|
---|
235 | <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
|
---|
236 | <!-- remove empty CFBundleDocumentTypes definition -->
|
---|
237 | <remove path="/plist/dict/key[text()='CFBundleDocumentTypes']|/plist/dict/key[text()='CFBundleDocumentTypes']/following-sibling::array[1]"/>
|
---|
238 | <!-- insert our own keys -->
|
---|
239 | <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
|
---|
240 | </xmltask>
|
---|
241 |
|
---|
242 | <!-- create ZIP file with MacOS X application bundle -->
|
---|
243 | <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
|
---|
244 | <zipfileset dir="." includes="CONTRIBUTION README LICENSE"/>
|
---|
245 | <zipfileset dir="${bundle.outdir}" includes="JOSM.app/**/*" filemode="755" />
|
---|
246 | </zip>
|
---|
247 | </target>
|
---|
248 | <target name="distmac" depends="dist">
|
---|
249 | <antcall target="mac">
|
---|
250 | <param name="bundle.outdir" value="${dist.dir}"/>
|
---|
251 | <param name="bundle.jar" value="${dist.jar}"/>
|
---|
252 | </antcall>
|
---|
253 | </target>
|
---|
254 | <!-- Windows target -->
|
---|
255 | <target name="distwin" depends="dist">
|
---|
256 | <exec dir="windows" executable="./josm-setup-unix.sh">
|
---|
257 | <arg value="${version.entry.commit.revision}"/>
|
---|
258 | <arg value="${dist.jar}"/>
|
---|
259 | </exec>
|
---|
260 | </target>
|
---|
261 | <target name="javacc" depends="init" unless="javacc.notRequired">
|
---|
262 | <mkdir dir="${mapcss.dir}/parsergen"/>
|
---|
263 | <java classname="javacc" fork="true" failonerror="true">
|
---|
264 | <classpath path="${javacc.home}/javacc.jar"/>
|
---|
265 | <arg value="-DEBUG_PARSER=false"/>
|
---|
266 | <arg value="-DEBUG_TOKEN_MANAGER=false"/>
|
---|
267 | <arg value="-JDK_VERSION=${java.lang.version}"/>
|
---|
268 | <arg value="-GRAMMAR_ENCODING=UTF-8"/>
|
---|
269 | <arg value="-OUTPUT_DIRECTORY=${mapcss.dir}/parsergen"/>
|
---|
270 | <arg value="${mapcss.dir}/MapCSSParser.jj"/>
|
---|
271 | </java>
|
---|
272 | </target>
|
---|
273 | <target name="compile-cots" depends="init">
|
---|
274 | <!-- COTS -->
|
---|
275 | <javac srcdir="${src.dir}" includes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/tukaani/**,gnu/**" nowarn="on" encoding="iso-8859-1"
|
---|
276 | destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeAntRuntime="false" createMissingPackageInfoClass="false">
|
---|
277 | <!-- get rid of "internal proprietary API" warning -->
|
---|
278 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
279 | <exclude name="org/apache/commons/compress/PasswordRequiredException.java"/>
|
---|
280 | <exclude name="org/apache/commons/compress/archivers/**"/>
|
---|
281 | <exclude name="org/apache/commons/compress/changes/**"/>
|
---|
282 | <exclude name="org/apache/commons/compress/compressors/bzip2/BZip2Utils.java"/>
|
---|
283 | <exclude name="org/apache/commons/compress/compressors/brotli/**"/>
|
---|
284 | <exclude name="org/apache/commons/compress/compressors/CompressorStreamFactory.java"/>
|
---|
285 | <exclude name="org/apache/commons/compress/compressors/CompressorStreamProvider.java"/>
|
---|
286 | <exclude name="org/apache/commons/compress/compressors/CompressorException.java"/>
|
---|
287 | <exclude name="org/apache/commons/compress/compressors/FileNameUtil.java"/>
|
---|
288 | <exclude name="org/apache/commons/compress/compressors/deflate/**"/>
|
---|
289 | <exclude name="org/apache/commons/compress/compressors/gzip/**"/>
|
---|
290 | <exclude name="org/apache/commons/compress/compressors/lz4/**"/>
|
---|
291 | <exclude name="org/apache/commons/compress/compressors/lzma/**"/>
|
---|
292 | <exclude name="org/apache/commons/compress/compressors/lz77support/**"/>
|
---|
293 | <exclude name="org/apache/commons/compress/compressors/pack200/**"/>
|
---|
294 | <exclude name="org/apache/commons/compress/compressors/snappy/**"/>
|
---|
295 | <exclude name="org/apache/commons/compress/compressors/xz/XZUtils.java"/>
|
---|
296 | <exclude name="org/apache/commons/compress/compressors/z/**"/>
|
---|
297 | <exclude name="org/apache/commons/compress/compressors/zstandard/**"/>
|
---|
298 | <exclude name="org/apache/commons/compress/parallel/**"/>
|
---|
299 | <exclude name="org/apache/commons/compress/utils/ArchiveUtils.java"/>
|
---|
300 | <exclude name="org/apache/commons/jcs/JCS.java"/>
|
---|
301 | <exclude name="org/apache/commons/jcs/access/GroupCacheAccess.java"/>
|
---|
302 | <exclude name="org/apache/commons/jcs/access/PartitionedCacheAccess.java"/>
|
---|
303 | <exclude name="org/apache/commons/jcs/access/behavior/IGroupCacheAccess.java"/>
|
---|
304 | <exclude name="org/apache/commons/jcs/access/exception/InvalidGroupException.java"/>
|
---|
305 | <exclude name="org/apache/commons/jcs/admin/servlet/**"/>
|
---|
306 | <exclude name="org/apache/commons/jcs/auxiliary/AbstractAuxiliaryCacheMonitor.java"/>
|
---|
307 | <exclude name="org/apache/commons/jcs/auxiliary/disk/jdbc/**"/>
|
---|
308 | <exclude name="org/apache/commons/jcs/auxiliary/lateral/**"/>
|
---|
309 | <exclude name="org/apache/commons/jcs/auxiliary/remote/**"/>
|
---|
310 | <exclude name="org/apache/commons/jcs/engine/CacheAdaptor.java"/>
|
---|
311 | <exclude name="org/apache/commons/jcs/engine/CacheGroup.java"/>
|
---|
312 | <exclude name="org/apache/commons/jcs/engine/CacheWatchRepairable.java"/>
|
---|
313 | <exclude name="org/apache/commons/jcs/engine/Zombie*.java"/>
|
---|
314 | <exclude name="org/apache/commons/jcs/engine/logging/CacheEventLoggerDebugLogger.java"/>
|
---|
315 | <exclude name="org/apache/commons/jcs/utils/access/**"/>
|
---|
316 | <exclude name="org/apache/commons/jcs/utils/discovery/**"/>
|
---|
317 | <exclude name="org/apache/commons/jcs/utils/net/**"/>
|
---|
318 | <exclude name="org/apache/commons/jcs/utils/props/**"/>
|
---|
319 | <exclude name="org/apache/commons/jcs/utils/servlet/**"/>
|
---|
320 | <exclude name="org/apache/commons/logging/impl/AvalonLogger.java"/>
|
---|
321 | <exclude name="org/apache/commons/logging/impl/Jdk13LumberjackLogger.java"/>
|
---|
322 | <exclude name="org/apache/commons/logging/impl/Log4JLogger.java"/>
|
---|
323 | <exclude name="org/apache/commons/logging/impl/LogKitLogger.java"/>
|
---|
324 | <exclude name="org/apache/commons/logging/impl/ServletContextCleaner.java"/>
|
---|
325 | </javac>
|
---|
326 | </target>
|
---|
327 | <target name="compile-jmapviewer" depends="init">
|
---|
328 | <!-- JMapViewer -->
|
---|
329 | <javac compiler="${javac.compiler}" sourcepath="" srcdir="${src.dir}"
|
---|
330 | excludes="com/**,javax/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/gui/jmapviewer/JMapViewerTree.java,org/openstreetmap/gui/jmapviewer/checkBoxTree/**,org/openstreetmap/josm/**,org/tukaani/**,gnu/**"
|
---|
331 | destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
332 | <compilerclasspath>
|
---|
333 | <pathelement location="${error_prone_ant.jar}"/>
|
---|
334 | </compilerclasspath>
|
---|
335 | <compilerarg value="-Xlint:cast"/>
|
---|
336 | <compilerarg value="-Xlint:deprecation"/>
|
---|
337 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
338 | <compilerarg value="-Xlint:divzero"/>
|
---|
339 | <compilerarg value="-Xlint:empty"/>
|
---|
340 | <compilerarg value="-Xlint:finally"/>
|
---|
341 | <compilerarg value="-Xlint:overrides"/>
|
---|
342 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
343 | <compilerarg value="-Xlint:static"/>
|
---|
344 | <compilerarg value="-Xlint:try"/>
|
---|
345 | <compilerarg value="-Xlint:unchecked"/>
|
---|
346 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
|
---|
347 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
348 | <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
349 | <compilerarg value="-Xep:StringSplitter:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
350 | <compilerarg line="-Xmaxwarns 1000"/>
|
---|
351 | </javac>
|
---|
352 | </target>
|
---|
353 | <target name="compile" depends="init,javacc,compile-cots,compile-jmapviewer">
|
---|
354 | <!-- JOSM -->
|
---|
355 | <javac compiler="${javac.compiler}" sourcepath="" srcdir="${src.dir}"
|
---|
356 | excludes="com/**,javax/**,gnu/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/**,org/tukaani/**"
|
---|
357 | destdir="${build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
358 | <compilerclasspath>
|
---|
359 | <pathelement location="${error_prone_ant.jar}"/>
|
---|
360 | </compilerclasspath>
|
---|
361 | <compilerarg value="-Xlint:cast"/>
|
---|
362 | <compilerarg value="-Xlint:deprecation"/>
|
---|
363 | <compilerarg value="-Xlint:dep-ann"/>
|
---|
364 | <compilerarg value="-Xlint:divzero"/>
|
---|
365 | <compilerarg value="-Xlint:empty"/>
|
---|
366 | <compilerarg value="-Xlint:finally"/>
|
---|
367 | <compilerarg value="-Xlint:overrides"/>
|
---|
368 | <!--<compilerarg value="-Xlint:rawtypes"/>-->
|
---|
369 | <compilerarg value="-Xlint:static"/>
|
---|
370 | <compilerarg value="-Xlint:try"/>
|
---|
371 | <compilerarg value="-Xlint:unchecked"/>
|
---|
372 | <!-- Undocumented argument to ignore "Sun internal proprietary API" warning, see http://stackoverflow.com/a/13862308/2257172 -->
|
---|
373 | <compilerarg value="-XDignore.symbol.file"/>
|
---|
374 | <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
375 | <compilerarg value="-Xep:ImmutableEnumChecker:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
376 | <compilerarg value="-Xep:FutureReturnValueIgnored:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
377 | <compilerarg value="-Xep:FloatingPointLiteralPrecision:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
378 | <compilerarg value="-Xep:ShortCircuitBoolean:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
379 | <compilerarg value="-Xep:StringSplitter:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
380 | <compilerarg value="-Xep:JdkObsolete:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
381 | <compilerarg line="-Xmaxwarns 1000"/>
|
---|
382 | <exclude name="org/openstreetmap/josm/io/audio/fx/*.java" if:set="noJavaFX"/>
|
---|
383 | </javac>
|
---|
384 |
|
---|
385 | <copy todir="build" failonerror="no" includeemptydirs="no">
|
---|
386 | <fileset dir="resources"/>
|
---|
387 | </copy>
|
---|
388 | </target>
|
---|
389 | <target name="init" depends="init-properties">
|
---|
390 | <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
|
---|
391 | <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
|
---|
392 | </uptodate>
|
---|
393 | <mkdir dir="${build.dir}"/>
|
---|
394 | <mkdir dir="${dist.dir}"/>
|
---|
395 | </target>
|
---|
396 | <target name="javadoc" depends="init-properties">
|
---|
397 | <javadoc destdir="javadoc"
|
---|
398 | sourcepath="${src.dir}"
|
---|
399 | encoding="UTF-8"
|
---|
400 | packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
|
---|
401 | excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
|
---|
402 | windowtitle="JOSM"
|
---|
403 | use="true"
|
---|
404 | private="true"
|
---|
405 | linksource="true"
|
---|
406 | author="false">
|
---|
407 | <link href="http://docs.oracle.com/javase/8/docs/api"/>
|
---|
408 | <doctitle><![CDATA[<h2>JOSM - Javadoc</h2>]]></doctitle>
|
---|
409 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JOSM</a>]]></bottom>
|
---|
410 | <arg value="-html5" if:set="isJava9" />
|
---|
411 | <arg value="--add-exports" if:set="isJava9" />
|
---|
412 | <arg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
|
---|
413 | <arg value="--add-exports" if:set="isJava9" />
|
---|
414 | <arg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
|
---|
415 | <arg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
|
---|
416 | <arg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
|
---|
417 | <excludepackage name="org/openstreetmap/josm/io/audio/fx" if:set="noJavaFX" />
|
---|
418 | </javadoc>
|
---|
419 | </target>
|
---|
420 | <target name="clean" depends="init-properties">
|
---|
421 | <delete dir="${build.dir}"/>
|
---|
422 | <delete dir="${proj-build.dir}"/>
|
---|
423 | <delete dir="${checkstyle-build.dir}"/>
|
---|
424 | <delete dir="${dist.dir}"/>
|
---|
425 | <delete dir="${mapcss.dir}/parsergen"/>
|
---|
426 | <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
|
---|
427 | <delete dir="${src.dir}/org/openstreetmap/josm/data/imagery/types"/>
|
---|
428 | <delete file="${epsg.output}"/>
|
---|
429 | <delete file="${pmd.dir}/cache"/>
|
---|
430 | </target>
|
---|
431 | <macrodef name="init-test-preferences">
|
---|
432 | <attribute name="testfamily"/>
|
---|
433 | <sequential>
|
---|
434 | <copy file="${test.dir}/config/preferences.template.xml" tofile="${test.dir}/config/@{testfamily}-josm.home/preferences.xml"/>
|
---|
435 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
436 | <replace file="${test.dir}/config/@{testfamily}-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
437 | </sequential>
|
---|
438 | </macrodef>
|
---|
439 | <target name="test-init" depends="init-properties">
|
---|
440 | <mkdir dir="${test.dir}/build"/>
|
---|
441 | <mkdir dir="${test.dir}/build/unit"/>
|
---|
442 | <mkdir dir="${test.dir}/build/functional"/>
|
---|
443 | <mkdir dir="${test.dir}/build/performance"/>
|
---|
444 | <mkdir dir="${test.dir}/report"/>
|
---|
445 | <init-test-preferences testfamily="unit"/>
|
---|
446 | <init-test-preferences testfamily="functional"/>
|
---|
447 | <init-test-preferences testfamily="performance"/>
|
---|
448 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${tools.dir}/jacocoant.jar" />
|
---|
449 | </target>
|
---|
450 | <target name="test-clean" depends="init-properties">
|
---|
451 | <delete dir="${test.dir}/build"/>
|
---|
452 | <delete dir="${test.dir}/report"/>
|
---|
453 | <delete file="${test.dir}/jacoco.exec" />
|
---|
454 | <delete file="${test.dir}/jacocoIT.exec" />
|
---|
455 | <delete file="${test.dir}/config/unit-josm.home" failonerror="false"/>
|
---|
456 | <delete file="${test.dir}/config/functional-josm.home" failonerror="false"/>
|
---|
457 | <delete file="${test.dir}/config/performance-josm.home" failonerror="false"/>
|
---|
458 | </target>
|
---|
459 | <macrodef name="call-javac">
|
---|
460 | <attribute name="testfamily"/>
|
---|
461 | <element name="cp-elements"/>
|
---|
462 | <sequential>
|
---|
463 | <javac srcdir="${test.dir}/@{testfamily}" destdir="${test.dir}/build/@{testfamily}"
|
---|
464 | target="${java.lang.version}" source="${java.lang.version}" debug="on"
|
---|
465 | includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
466 | <compilerarg value="-Xlint:all"/>
|
---|
467 | <compilerarg value="-Xlint:-serial"/>
|
---|
468 | <classpath>
|
---|
469 | <cp-elements/>
|
---|
470 | </classpath>
|
---|
471 | </javac>
|
---|
472 | </sequential>
|
---|
473 | </macrodef>
|
---|
474 | <target name="test-compile" depends="test-init,dist">
|
---|
475 | <call-javac testfamily="unit">
|
---|
476 | <cp-elements>
|
---|
477 | <path refid="test.classpath"/>
|
---|
478 | </cp-elements>
|
---|
479 | </call-javac>
|
---|
480 | <call-javac testfamily="functional">
|
---|
481 | <cp-elements>
|
---|
482 | <path refid="test.classpath"/>
|
---|
483 | <pathelement path="${test.dir}/build/unit"/>
|
---|
484 | </cp-elements>
|
---|
485 | </call-javac>
|
---|
486 | <call-javac testfamily="performance">
|
---|
487 | <cp-elements>
|
---|
488 | <path refid="test.classpath"/>
|
---|
489 | <pathelement path="${test.dir}/build/unit"/>
|
---|
490 | </cp-elements>
|
---|
491 | </call-javac>
|
---|
492 | </target>
|
---|
493 | <macrodef name="call-junit">
|
---|
494 | <attribute name="testfamily"/>
|
---|
495 | <attribute name="testITsuffix" default=""/>
|
---|
496 | <attribute name="coverage" default="${coverageByDefault}"/>
|
---|
497 | <sequential>
|
---|
498 | <echo message="Running @{testfamily}@{testITsuffix} tests with JUnit"/>
|
---|
499 | <jacoco:coverage destfile="${test.dir}/jacoco@{testITsuffix}.exec" enabled="@{coverage}" includes="${jacoco.includes}"
|
---|
500 | inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}">
|
---|
501 | <junit printsummary="yes" fork="true" forkmode="once">
|
---|
502 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
503 | <jvmarg value="-javaagent:${test.dir}/lib/jmockit-1.40.jar"/>
|
---|
504 | <jvmarg value="--add-modules" if:set="isJava9" unless:set="isJava11" />
|
---|
505 | <jvmarg value="java.activation,java.se.ee" if:set="isJava9" unless:set="isJava11" />
|
---|
506 | <jvmarg value="--add-exports" if:set="isJava9" />
|
---|
507 | <jvmarg value="java.base/sun.security.util=ALL-UNNAMED" if:set="isJava9" />
|
---|
508 | <jvmarg value="--add-exports" if:set="isJava9" />
|
---|
509 | <jvmarg value="java.base/sun.security.x509=ALL-UNNAMED" if:set="isJava9" />
|
---|
510 | <jvmarg value="--add-exports" if:set="isJava9" unless:set="noJavaFX" />
|
---|
511 | <jvmarg value="javafx.graphics/com.sun.javafx.application=ALL-UNNAMED" if:set="isJava9" unless:set="noJavaFX" />
|
---|
512 | <jvmarg value="--add-exports" if:set="isJava9" unless:set="isJava11" />
|
---|
513 | <jvmarg value="jdk.deploy/com.sun.deploy.config=ALL-UNNAMED" if:set="isJava9" unless:set="isJava11" />
|
---|
514 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
515 | <jvmarg value="java.base/java.io=ALL-UNNAMED" if:set="isJava9" />
|
---|
516 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
517 | <jvmarg value="java.base/java.lang=ALL-UNNAMED" if:set="isJava9" />
|
---|
518 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
519 | <jvmarg value="java.base/java.nio=ALL-UNNAMED" if:set="isJava9" />
|
---|
520 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
521 | <jvmarg value="java.base/java.text=ALL-UNNAMED" if:set="isJava9" />
|
---|
522 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
523 | <jvmarg value="java.base/java.util=ALL-UNNAMED" if:set="isJava9" />
|
---|
524 | <jvmarg value="--add-opens" if:set="isJava9" />
|
---|
525 | <jvmarg value="java.desktop/java.awt=ALL-UNNAMED" if:set="isJava9" />
|
---|
526 | <sysproperty key="josm.home" value="${test.dir}/config/@{testfamily}-josm.home"/>
|
---|
527 | <sysproperty key="josm.test.data" value="${test.dir}/data"/>
|
---|
528 | <sysproperty key="java.awt.headless" value="${test.headless}"/>
|
---|
529 | <sysproperty key="glass.platform" value="Monocle"/>
|
---|
530 | <sysproperty key="monocle.platform" value="Headless"/>
|
---|
531 | <sysproperty key="prism.order" value="sw"/>
|
---|
532 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
533 | <classpath>
|
---|
534 | <path refid="test.classpath"/>
|
---|
535 | <pathelement path="${test.dir}/build/unit"/>
|
---|
536 | <pathelement path="${test.dir}/build/@{testfamily}"/>
|
---|
537 | <pathelement path="${test.dir}/config"/>
|
---|
538 | </classpath>
|
---|
539 | <formatter type="plain"/>
|
---|
540 | <formatter type="xml"/>
|
---|
541 | <batchtest fork="yes" todir="${test.dir}/report">
|
---|
542 | <fileset dir="${test.dir}/build/@{testfamily}" includes="**/*Test@{testITsuffix}.class"/>
|
---|
543 | </batchtest>
|
---|
544 | </junit>
|
---|
545 | </jacoco:coverage>
|
---|
546 | </sequential>
|
---|
547 | </macrodef>
|
---|
548 | <target name="test" depends="test-compile" unless="test.notRequired"
|
---|
549 | description="Run unit and functional tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
550 | <call-junit testfamily="unit"/>
|
---|
551 | <call-junit testfamily="functional"/>
|
---|
552 | </target>
|
---|
553 | <target name="test-it" depends="test-compile" unless="test-it.notRequired"
|
---|
554 | description="Run integration tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
555 | <call-junit testfamily="unit" testITsuffix="IT"/>
|
---|
556 | <call-junit testfamily="functional" testITsuffix="IT"/>
|
---|
557 | </target>
|
---|
558 | <target name="test-perf" depends="test-compile" unless="test-perf.notRequired"
|
---|
559 | description="Run performance tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
560 | <call-junit testfamily="performance" coverage="false"/>
|
---|
561 | </target>
|
---|
562 | <target name="test-html" depends="test, test-it, test-perf" description="Generate HTML test reports">
|
---|
563 | <!-- May require additional ant dependencies like ant-trax package -->
|
---|
564 | <junitreport todir="${test.dir}/report">
|
---|
565 | <fileset dir="${test.dir}/report">
|
---|
566 | <include name="TEST-*.xml"/>
|
---|
567 | </fileset>
|
---|
568 | <report todir="${test.dir}/report/html"/>
|
---|
569 | </junitreport>
|
---|
570 | <jacoco:report>
|
---|
571 | <executiondata>
|
---|
572 | <fileset dir="${test.dir}" includes="*.exec"/>
|
---|
573 | </executiondata>
|
---|
574 | <structure name="JOSM Test Coverage">
|
---|
575 | <classfiles>
|
---|
576 | <fileset dir="${build.dir}" includes="org/openstreetmap/"/>
|
---|
577 | </classfiles>
|
---|
578 | <sourcefiles encoding="UTF-8">
|
---|
579 | <fileset dir="${src.dir}" includes="org/openstreetmap/"/>
|
---|
580 | </sourcefiles>
|
---|
581 | </structure>
|
---|
582 | <html destdir="${test.dir}/report/jacoco"/>
|
---|
583 | </jacoco:report>
|
---|
584 | </target>
|
---|
585 | <target name="dist-optimized" depends="dist">
|
---|
586 | <taskdef resource="proguard/ant/task.properties" classpath="${tools.dir}/proguard.jar"/>
|
---|
587 | <proguard>
|
---|
588 | -injars ${dist.jar}
|
---|
589 | -outjars ${dist-optimized.jar}
|
---|
590 |
|
---|
591 | -libraryjars ${java.home}/lib
|
---|
592 |
|
---|
593 | -dontoptimize
|
---|
594 | -dontobfuscate
|
---|
595 |
|
---|
596 | # These options probably are not necessary (and make processing a bit slower)
|
---|
597 | -dontskipnonpubliclibraryclasses
|
---|
598 | -dontskipnonpubliclibraryclassmembers
|
---|
599 |
|
---|
600 | -keepclasseswithmembers public class org.openstreetmap.josm.gui.MainApplication {
|
---|
601 | public static void main(java.lang.String[]);
|
---|
602 | }
|
---|
603 |
|
---|
604 | -keep class * extends org.openstreetmap.josm.io.FileImporter
|
---|
605 | -keep class * extends org.openstreetmap.josm.io.FileExporter
|
---|
606 | -keep class org.openstreetmap.josm.actions.search.SearchCompiler$Never
|
---|
607 | -keep class org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClasses {
|
---|
608 | static boolean *(org.openstreetmap.josm.gui.mappaint.Environment);
|
---|
609 | }
|
---|
610 | -keep class org.apache.commons.logging.impl.*
|
---|
611 |
|
---|
612 | -keepclassmembers enum * {
|
---|
613 | public static **[] values();
|
---|
614 | public static ** valueOf(java.lang.String);
|
---|
615 | }
|
---|
616 |
|
---|
617 | # Keep unused public classes and methods (needed for plugins)
|
---|
618 | -keep public class * {
|
---|
619 | public protected *;
|
---|
620 | }
|
---|
621 |
|
---|
622 | # Keep serialization code
|
---|
623 | -keepclassmembers class * implements java.io.Serializable {
|
---|
624 | static final long serialVersionUID;
|
---|
625 | private static final java.io.ObjectStreamField[] serialPersistentFields;
|
---|
626 | private void writeObject(java.io.ObjectOutputStream);
|
---|
627 | private void readObject(java.io.ObjectInputStream);
|
---|
628 | java.lang.Object writeReplace();
|
---|
629 | java.lang.Object readResolve();
|
---|
630 | }
|
---|
631 |
|
---|
632 | # Disable annoying [proguard] Note: the configuration keeps the entry point '...', but not the descriptor class '...'.
|
---|
633 | # This note should not be a problem as we don't use obfuscation
|
---|
634 | -dontnote
|
---|
635 | </proguard>
|
---|
636 | </target>
|
---|
637 | <!-- Proguard does not support Java 9 : http://sourceforge.net/p/proguard/bugs/551/ -->
|
---|
638 | <target name="dist-optimized-report" depends="dist-optimized" unless="isJava9">
|
---|
639 | <!-- generate difference report between optimized jar and normal one -->
|
---|
640 | <exec executable="perl" dir="${basedir}">
|
---|
641 | <arg value="${tools.dir}/japicc/japi-compliance-checker.pl"/>
|
---|
642 | <arg value="--lib=JOSM"/>
|
---|
643 | <arg value="--keep-internal"/>
|
---|
644 | <arg value="--v1=${version.entry.commit.revision}"/>
|
---|
645 | <arg value="--v2=${version.entry.commit.revision}-optimized"/>
|
---|
646 | <arg value="--report-path=${dist.dir}/compat_report.html"/>
|
---|
647 | <arg value="${dist.jar}"/>
|
---|
648 | <arg value="${dist-optimized.jar}"/>
|
---|
649 | </exec>
|
---|
650 | </target>
|
---|
651 | <target name="check-plugins" depends="dist-optimized" description="Check of plugins binary compatibility">
|
---|
652 | <local name="dir"/>
|
---|
653 | <local name="plugins"/>
|
---|
654 | <property name="dir" value="plugin-check"/>
|
---|
655 | <typedef uri="antlib:org.codehaus.mojo.animal_sniffer">
|
---|
656 | <classpath path="${tools.dir}/animal-sniffer-ant-tasks.jar"/>
|
---|
657 | </typedef>
|
---|
658 | <delete dir="${dir}" failonerror="false"/>
|
---|
659 | <mkdir dir="${dir}"/>
|
---|
660 | <!-- List of deprecated plugins -->
|
---|
661 | <loadfile property="deprecated-plugins" srcFile="${src.dir}/org/openstreetmap/josm/plugins/PluginHandler.java">
|
---|
662 | <filterchain>
|
---|
663 | <linecontains>
|
---|
664 | <contains value="new DeprecatedPlugin("/>
|
---|
665 | </linecontains>
|
---|
666 | <tokenfilter>
|
---|
667 | <replaceregex pattern=".*new DeprecatedPlugin\("(.+?)".*" replace="\1|" flags="gi"/>
|
---|
668 | </tokenfilter>
|
---|
669 | <striplinebreaks/>
|
---|
670 | <tokenfilter>
|
---|
671 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
672 | </tokenfilter>
|
---|
673 | </filterchain>
|
---|
674 | </loadfile>
|
---|
675 | <!-- Download list of plugins -->
|
---|
676 | <loadresource property="plugins">
|
---|
677 | <url url="https://josm.openstreetmap.de/plugin"/>
|
---|
678 | <filterchain>
|
---|
679 | <linecontainsregexp negate="true">
|
---|
680 | <regexp pattern="^\t.*"/>
|
---|
681 | </linecontainsregexp>
|
---|
682 | <linecontainsregexp negate="true">
|
---|
683 | <regexp pattern="${deprecated-plugins}"/>
|
---|
684 | </linecontainsregexp>
|
---|
685 | <tokenfilter>
|
---|
686 | <replaceregex pattern="^.*;" replace="" flags="gi"/>
|
---|
687 | </tokenfilter>
|
---|
688 | </filterchain>
|
---|
689 | </loadresource>
|
---|
690 | <!-- Delete files that are not in plugin list (like old plugins) -->
|
---|
691 | <loadresource property="file-list">
|
---|
692 | <propertyresource name="plugins"/>
|
---|
693 | <filterchain>
|
---|
694 | <tokenfilter>
|
---|
695 | <replaceregex pattern="^.*/(.*)$" replace="\1\|" flags=""/>
|
---|
696 | </tokenfilter>
|
---|
697 | <striplinebreaks/>
|
---|
698 | <tokenfilter>
|
---|
699 | <replaceregex pattern="\|$" replace="" flags="gi"/>
|
---|
700 | </tokenfilter>
|
---|
701 | </filterchain>
|
---|
702 | </loadresource>
|
---|
703 | <delete>
|
---|
704 | <restrict>
|
---|
705 | <fileset dir="${dir}"/>
|
---|
706 | <not>
|
---|
707 | <name regex="${file-list}"/>
|
---|
708 | </not>
|
---|
709 | </restrict>
|
---|
710 | </delete>
|
---|
711 | <!-- Download plugins -->
|
---|
712 | <copy todir="${dir}" flatten="true" verbose="true" failonerror="false">
|
---|
713 | <resourcelist>
|
---|
714 | <string value="${plugins}"/>
|
---|
715 | </resourcelist>
|
---|
716 | </copy>
|
---|
717 | <!-- Check plugins -->
|
---|
718 | <as:build-signatures destfile="${dir}/api.sig">
|
---|
719 | <path>
|
---|
720 | <fileset file="${dist-optimized.jar}"/>
|
---|
721 | <fileset file="${java.home}/lib/rt.jar"/>
|
---|
722 | <fileset file="${java.home}/lib/jce.jar"/>
|
---|
723 | <fileset file="${java.home}/lib/ext/jfxrt.jar"/>
|
---|
724 | </path>
|
---|
725 | </as:build-signatures>
|
---|
726 | <as:check-signature signature="${dir}/api.sig" failonerror="false">
|
---|
727 | <ignore classname="afu.*"/>
|
---|
728 | <ignore classname="android.*"/>
|
---|
729 | <ignore classname="au.*"/>
|
---|
730 | <ignore classname="com.*"/>
|
---|
731 | <ignore classname="de.*"/>
|
---|
732 | <ignore classname="edu.*"/>
|
---|
733 | <ignore classname="groovy.*"/>
|
---|
734 | <ignore classname="io.*"/>
|
---|
735 | <ignore classname="it.*"/>
|
---|
736 | <ignore classname="javax.*"/>
|
---|
737 | <ignore classname="jogamp.*"/>
|
---|
738 | <ignore classname="junit.*"/>
|
---|
739 | <ignore classname="kdu_jni.*"/>
|
---|
740 | <ignore classname="net.*"/>
|
---|
741 | <ignore classname="netscape.*"/>
|
---|
742 | <ignore classname="nu.*"/>
|
---|
743 | <ignore classname="oracle.*"/>
|
---|
744 | <ignore classname="org.apache.*"/>
|
---|
745 | <ignore classname="org.bouncycastle.*"/>
|
---|
746 | <ignore classname="org.checkerframework.*"/>
|
---|
747 | <ignore classname="org.codehaus.*"/>
|
---|
748 | <ignore classname="org.conscrypt.*"/>
|
---|
749 | <ignore classname="org.dom4j.*"/>
|
---|
750 | <ignore classname="org.eclipse.*"/>
|
---|
751 | <ignore classname="org.ejml.*"/>
|
---|
752 | <ignore classname="org.gdal.*"/>
|
---|
753 | <ignore classname="org.hibernate.*"/>
|
---|
754 | <ignore classname="org.hsqldb.*"/>
|
---|
755 | <ignore classname="org.ibex.*"/>
|
---|
756 | <ignore classname="org.iso_relax.*"/>
|
---|
757 | <ignore classname="org.jaitools.*"/>
|
---|
758 | <ignore classname="org.jaxen.*"/>
|
---|
759 | <ignore classname="org.jboss.*"/>
|
---|
760 | <ignore classname="org.jdom.*"/>
|
---|
761 | <ignore classname="org.jdom2.*"/>
|
---|
762 | <ignore classname="org.jfree.*"/>
|
---|
763 | <ignore classname="org.jgraph.*"/>
|
---|
764 | <ignore classname="org.joda.*"/>
|
---|
765 | <ignore classname="org.junit.*"/>
|
---|
766 | <ignore classname="org.jvnet.*"/>
|
---|
767 | <ignore classname="org.kxml2.*"/>
|
---|
768 | <ignore classname="org.objectweb.*"/>
|
---|
769 | <ignore classname="org.osgi.*"/>
|
---|
770 | <ignore classname="org.postgresql.*"/>
|
---|
771 | <ignore classname="org.python.*"/>
|
---|
772 | <ignore classname="org.seasar.*"/>
|
---|
773 | <ignore classname="org.slf4j.*"/>
|
---|
774 | <ignore classname="org.springframework.*"/>
|
---|
775 | <ignore classname="org.testng.*"/>
|
---|
776 | <ignore classname="org.w3c.*"/>
|
---|
777 | <ignore classname="org.zeromq.*"/>
|
---|
778 | <!-- plugins used by another ones -->
|
---|
779 | <ignore classname="org.openstreetmap.josm.plugins.geotools.*"/>
|
---|
780 | <ignore classname="org.openstreetmap.josm.plugins.jna.*"/>
|
---|
781 | <ignore classname="org.openstreetmap.josm.plugins.jts.*"/>
|
---|
782 | <ignore classname="org.openstreetmap.josm.plugins.log4j.*"/>
|
---|
783 | <ignore classname="org.openstreetmap.josm.plugins.utilsplugin2.*"/>
|
---|
784 | <ignore classname="sun.*"/>
|
---|
785 | <path path="${dir}"/>
|
---|
786 | </as:check-signature>
|
---|
787 | </target>
|
---|
788 |
|
---|
789 | <macrodef name="_taginfo">
|
---|
790 | <attribute name="type"/>
|
---|
791 | <attribute name="output"/>
|
---|
792 | <sequential>
|
---|
793 | <echo message="Generating Taginfo for type @{type} to @{output}"/>
|
---|
794 | <groovy src="${taginfoextract}" classpath="${dist.jar};${toString:groovy.classpath};${spotbugs.dir}/spotbugs-annotations.jar">
|
---|
795 | <arg value="-t"/>
|
---|
796 | <arg value="@{type}"/>
|
---|
797 | <arg value="--noexit"/>
|
---|
798 | <arg value="--svnweb"/>
|
---|
799 | <arg value="--imgurlprefix"/>
|
---|
800 | <arg value="${imgurlprefix}"/>
|
---|
801 | <arg value="-o"/>
|
---|
802 | <arg value="@{output}"/>
|
---|
803 | </groovy>
|
---|
804 | </sequential>
|
---|
805 | </macrodef>
|
---|
806 |
|
---|
807 | <target name="taginfo" depends="dist">
|
---|
808 | <!-- http://docs.groovy-lang.org/2.5.1/html/documentation/#_the_groovy_ant_task -->
|
---|
809 | <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath"/>
|
---|
810 | <property name="taginfoextract" value="scripts/TagInfoExtract.groovy"/>
|
---|
811 | <property name="imgurlprefix" value="http://josm.openstreetmap.de/download/taginfo/taginfo-img"/>
|
---|
812 | <_taginfo type="mappaint" output="taginfo_style.json"/>
|
---|
813 | <_taginfo type="presets" output="taginfo_presets.json"/>
|
---|
814 | <_taginfo type="external_presets" output="taginfo_external_presets.json"/>
|
---|
815 | </target>
|
---|
816 |
|
---|
817 | <target name="imageryindex" depends="init-properties">
|
---|
818 | <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpathref="groovy.classpath"/>
|
---|
819 | <echo message="Checking editor imagery difference"/>
|
---|
820 | <groovy src="scripts/SyncEditorLayerIndex.groovy" classpath="${dist.jar}">
|
---|
821 | <arg value="-noeli"/>
|
---|
822 | <arg value="-p"/>
|
---|
823 | <arg value="imagery_eliout.imagery.xml"/>
|
---|
824 | <arg value="-q"/>
|
---|
825 | <arg value="imagery_josmout.imagery.xml"/>
|
---|
826 | </groovy>
|
---|
827 | </target>
|
---|
828 |
|
---|
829 | <target name="imageryindexdownload">
|
---|
830 | <exec append="false" executable="wget" failifexecutionfails="true">
|
---|
831 | <arg value="https://josm.openstreetmap.de/maps"/>
|
---|
832 | <arg value="-O"/>
|
---|
833 | <arg value="imagery_josm.imagery.xml"/>
|
---|
834 | <arg value="--unlink"/>
|
---|
835 | </exec>
|
---|
836 | <exec append="false" executable="wget" failifexecutionfails="true">
|
---|
837 | <arg value="https://josm.openstreetmap.de/wiki/ImageryCompareIgnores?format=txt"/>
|
---|
838 | <arg value="-O"/>
|
---|
839 | <arg value="imagery_josm.ignores.txt"/>
|
---|
840 | <arg value="--unlink"/>
|
---|
841 | </exec>
|
---|
842 | <exec append="false" executable="wget" failifexecutionfails="true">
|
---|
843 | <arg value="https://raw.githubusercontent.com/osmlab/editor-layer-index/gh-pages/imagery.geojson"/>
|
---|
844 | <arg value="-O"/>
|
---|
845 | <arg value="imagery_eli.geojson"/>
|
---|
846 | <arg value="--unlink"/>
|
---|
847 | </exec>
|
---|
848 | <antcall target="imageryindex"/>
|
---|
849 | </target>
|
---|
850 |
|
---|
851 | <target name="checkstyle-compile" depends="init-properties">
|
---|
852 | <mkdir dir="${checkstyle-build.dir}"/>
|
---|
853 | <javac sourcepath="" srcdir="${checkstyle.dir}/src" failonerror="true"
|
---|
854 | destdir="${checkstyle-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
|
---|
855 | includeantruntime="false" createMissingPackageInfoClass="false"
|
---|
856 | encoding="UTF-8" classpath="${checkstyle.dir}/checkstyle-all.jar">
|
---|
857 | </javac>
|
---|
858 | </target>
|
---|
859 | <target name="checkstyle-changed" depends="checkstyle-compile">
|
---|
860 | <exec append="false" osfamily="unix" executable="bash" failifexecutionfails="true">
|
---|
861 | <arg value="-c"/>
|
---|
862 | <arg value="svn status -q --ignore-externals src test | grep -o '\(src\|test\)/.*' | xargs java -cp '${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml | sed -e 's:\([^ ]*\) [^:]*/\([^:/]*.java\:[^:]*\):(\2)\1:'"/>
|
---|
863 | </exec>
|
---|
864 | <exec append="false" osfamily="windows" executable="powershell" failifexecutionfails="true">
|
---|
865 | <arg value="/c"/>
|
---|
866 | <arg value="svn status -q --ignore-externals src test | ForEach-Object {java -cp '${checkstyle.dir}/checkstyle-all.jar;${checkstyle-build.dir}' com.puppycrawl.tools.checkstyle.Main -c ${checkstyle.dir}/josm_checks.xml $_.split(' ')[7]}"/>
|
---|
867 | </exec>
|
---|
868 | </target>
|
---|
869 | <target name="checkstyle" depends="checkstyle-compile">
|
---|
870 | <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
|
---|
871 | classpath="${checkstyle.dir}/checkstyle-all.jar:${checkstyle-build.dir}"/>
|
---|
872 | <checkstyle config="${checkstyle.dir}/josm_checks.xml">
|
---|
873 | <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
|
---|
874 | excludes="gui/mappaint/mapcss/parsergen/*.java"/>
|
---|
875 | <fileset dir="${base.dir}/test" includes="**/*.java"/>
|
---|
876 | <formatter type="plain"/>
|
---|
877 | <formatter type="xml" toFile="checkstyle-josm.xml"/>
|
---|
878 | </checkstyle>
|
---|
879 | </target>
|
---|
880 |
|
---|
881 | <target name="spotbugs" depends="dist">
|
---|
882 | <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${spotbugs.dir}/spotbugs-ant.jar"/>
|
---|
883 | <path id="spotbugs-classpath">
|
---|
884 | <fileset dir="${spotbugs.dir}">
|
---|
885 | <include name="*.jar"/>
|
---|
886 | </fileset>
|
---|
887 | </path>
|
---|
888 | <property name="spotbugs-classpath" refid="spotbugs-classpath"/>
|
---|
889 | <spotbugs output="xml"
|
---|
890 | outputFile="spotbugs-josm.xml"
|
---|
891 | classpath="${spotbugs-classpath}"
|
---|
892 | pluginList=""
|
---|
893 | excludeFilter="${spotbugs.dir}/josm-filter.xml"
|
---|
894 | effort="max"
|
---|
895 | reportLevel="low"
|
---|
896 | >
|
---|
897 | <sourcePath path="${base.dir}/src" />
|
---|
898 | <class location="${dist.jar}" />
|
---|
899 | </spotbugs>
|
---|
900 | </target>
|
---|
901 |
|
---|
902 | <target name="pmd" depends="init-properties">
|
---|
903 | <taskdef name="pmd" classname="net.sourceforge.pmd.ant.PMDTask" classpath="${toString:pmd.classpath}"/>
|
---|
904 | <pmd shortFilenames="true" cacheLocation="${pmd.dir}/cache" encoding="UTF-8">
|
---|
905 | <sourceLanguage name="java" version="${java.lang.version}" />
|
---|
906 | <ruleset>${pmd.dir}/josm-ruleset.xml</ruleset>
|
---|
907 | <formatter type="text" toConsole="true" />
|
---|
908 | <formatter type="xml" toFile="pmd-josm.xml">
|
---|
909 | <param name="encoding" value="UTF-8" />
|
---|
910 | </formatter>
|
---|
911 | <fileset dir="${src.dir}">
|
---|
912 | <include name="org/openstreetmap/josm/**/*.java"/>
|
---|
913 | <exclude name="org/openstreetmap/josm/gui/mappaint/mapcss/parsergen/*.java" />
|
---|
914 | </fileset>
|
---|
915 | </pmd>
|
---|
916 | </target>
|
---|
917 |
|
---|
918 | <target name="run" depends="dist">
|
---|
919 | <java jar="${dist.jar}" fork="true">
|
---|
920 | <arg value="--set=expert=true"/>
|
---|
921 | <arg value="--set=remotecontrol.enabled=true"/>
|
---|
922 | <arg value="--set=debug.edt-checker.enable=false"/>
|
---|
923 | <jvmarg value="-Djosm.home=/tmp/.josm/"/>
|
---|
924 | </java>
|
---|
925 | </target>
|
---|
926 | <!--
|
---|
927 | ** Compile build script for generating projection list.
|
---|
928 | -->
|
---|
929 | <target name="epsg-compile" depends="init-properties">
|
---|
930 | <property name="proj-classpath" location="${build.dir}"/>
|
---|
931 | <mkdir dir="${proj-build.dir}"/>
|
---|
932 | <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true" includes="BuildProjectionDefinitions.java"
|
---|
933 | destdir="${proj-build.dir}" target="${java.lang.version}" source="${java.lang.version}" debug="on"
|
---|
934 | includeantruntime="false" createMissingPackageInfoClass="false"
|
---|
935 | encoding="UTF-8" classpath="${proj-classpath}">
|
---|
936 | </javac>
|
---|
937 | </target>
|
---|
938 | <!--
|
---|
939 | ** generate projection list.
|
---|
940 | -->
|
---|
941 | <target name="epsg" depends="epsg-compile">
|
---|
942 | <touch file="${epsg.output}" mkdirs="true"/>
|
---|
943 | <java classname="BuildProjectionDefinitions" failonerror="true" fork="true">
|
---|
944 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
945 | <classpath>
|
---|
946 | <pathelement path="${base.dir}"/>
|
---|
947 | <pathelement path="${proj-classpath}"/>
|
---|
948 | <pathelement path="${proj-build.dir}"/>
|
---|
949 | </classpath>
|
---|
950 | <arg value="${base.dir}"/>
|
---|
951 | </java>
|
---|
952 | </target>
|
---|
953 | </project>
|
---|