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