[9095] | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
---|
[36140] | 2 | <project default="all" name="jmapviewer"
|
---|
| 3 | xmlns:jacoco="antlib:org.jacoco.ant"
|
---|
| 4 | xmlns:if="ant:if"
|
---|
| 5 | xmlns:ivy="antlib:org.apache.ivy.ant"
|
---|
| 6 | >
|
---|
[9095] | 7 |
|
---|
[36139] | 8 | <property name="java.lang.version" value="8" />
|
---|
[34669] | 9 | <dirname property="base.dir" file="${ant.file.jmapviewer}"/>
|
---|
| 10 | <property name="jacoco.includes" value="org.openstreetmap.gui.jmapviewer.*" />
|
---|
| 11 | <property name="jacoco.inclbootstrapclasses" value="false" />
|
---|
| 12 | <property name="jacoco.inclnolocationclasses" value="false" />
|
---|
| 13 | <!-- For Java specific stuff by version -->
|
---|
| 14 | <condition property="isJava9"><matches string="${ant.java.version}" pattern="(1.)?(9|1[0-9])" /></condition>
|
---|
[36223] | 15 | <condition property="isJava23"><matches string="${ant.java.version}" pattern="2[3-9]|[3-9][0-9]" /></condition>
|
---|
| 16 | <!-- Disable jacoco 0.8.11 on Java 23+, see https://www.jacoco.org/jacoco/trunk/doc/changes.html for latest supported version -->
|
---|
[34669] | 17 | <condition property="coverageByDefault">
|
---|
| 18 | <not>
|
---|
[36223] | 19 | <isset property="isJava23"/>
|
---|
[34669] | 20 | </not>
|
---|
| 21 | </condition>
|
---|
| 22 | <path id="test.classpath">
|
---|
| 23 | <pathelement location="bin"/>
|
---|
| 24 | </path>
|
---|
[34124] | 25 |
|
---|
[34669] | 26 | <target name="all" depends="clean,build,test,svn_info,pack,create_run_jar,spotbugs,checkstyle,javadoc,create_release_zip,create_source_release_zip" />
|
---|
[9095] | 27 |
|
---|
[34669] | 28 | <target name="clean">
|
---|
| 29 | <mkdir dir="bin" />
|
---|
| 30 | <mkdir dir="bintest" />
|
---|
| 31 | <mkdir dir="javadoc" />
|
---|
| 32 | <mkdir dir="report" />
|
---|
| 33 | <delete>
|
---|
| 34 | <fileset dir="bin">
|
---|
| 35 | <include name="**" />
|
---|
| 36 | </fileset>
|
---|
| 37 | <fileset dir="bintest">
|
---|
| 38 | <include name="**" />
|
---|
| 39 | </fileset>
|
---|
| 40 | <fileset dir="javadoc">
|
---|
| 41 | <include name="**" />
|
---|
| 42 | </fileset>
|
---|
| 43 | <fileset dir="report">
|
---|
| 44 | <include name="**" />
|
---|
| 45 | </fileset>
|
---|
| 46 | <fileset dir="." includes="*.jar,*.exec"/>
|
---|
| 47 | </delete>
|
---|
| 48 | </target>
|
---|
[9095] | 49 |
|
---|
[34669] | 50 | <target name="build" depends="clean">
|
---|
[36139] | 51 | <!-- compile module info - we need to compile everything to ensure that all requires are there -->
|
---|
| 52 | <javac srcdir="src" destdir="bin" release="9" debug="true" includeantruntime="false" encoding="UTF-8" if:set="isJava9">
|
---|
| 53 | <include name="module-info.java" />
|
---|
[34669] | 54 | <include name="org/openstreetmap/gui/jmapviewer/**" />
|
---|
| 55 | </javac>
|
---|
[11783] | 56 |
|
---|
[36139] | 57 | <!-- Remove the files compiled with Java 9 so that the next compile stage will compile to the appropriate version -->
|
---|
| 58 | <delete>
|
---|
| 59 | <fileset dir="bin">
|
---|
| 60 | <include name="org/openstreetmap/gui/jmapviewer/**" />
|
---|
| 61 | </fileset>
|
---|
| 62 | </delete>
|
---|
| 63 |
|
---|
| 64 | <javac srcdir="src" destdir="bin" release="${java.lang.version}" debug="true" includeantruntime="false" encoding="UTF-8">
|
---|
| 65 | <include name="org/openstreetmap/gui/jmapviewer/**" />
|
---|
| 66 | </javac>
|
---|
| 67 |
|
---|
[34669] | 68 | <copy todir="bin">
|
---|
| 69 | <fileset dir="src">
|
---|
| 70 | <include name="**/*.png" />
|
---|
| 71 | </fileset>
|
---|
| 72 | </copy>
|
---|
| 73 | </target>
|
---|
[34124] | 74 |
|
---|
[36140] | 75 | <target name="checkdepsupdate" depends="resolve">
|
---|
| 76 | <ivy:checkdepsupdate/>
|
---|
| 77 | </target>
|
---|
| 78 |
|
---|
[29618] | 79 | <target name="svn_info" description="Get SVN info for use in JAR/ZIP filenames.">
|
---|
[29985] | 80 | <!-- Get the svn ReleaseVersion property -->
|
---|
| 81 | <exec executable="svn" outputproperty="svnReleaseVersion">
|
---|
| 82 | <arg line="propget ReleaseVersion" />
|
---|
[29618] | 83 | <env key="LANG" value="en_US"/>
|
---|
| 84 | </exec>
|
---|
| 85 | </target>
|
---|
[34669] | 86 |
|
---|
| 87 | <target name="pack" depends="build">
|
---|
| 88 | <!-- Create the JAR file containing the compiled class files -->
|
---|
| 89 | <jar destfile="JMapViewer.jar" filesetmanifest="mergewithoutmain">
|
---|
[36139] | 90 | <fileset dir="bin" includes="module-info.class,**/jmapviewer/**" />
|
---|
[34669] | 91 | </jar>
|
---|
| 92 | <!-- Create the JAR file containing the source java files -->
|
---|
| 93 | <jar destfile="JMapViewer_src.jar" filesetmanifest="mergewithoutmain">
|
---|
[36139] | 94 | <fileset dir="src" includes="module-info.java,**/jmapviewer/**" />
|
---|
[34669] | 95 | </jar>
|
---|
| 96 | </target>
|
---|
| 97 |
|
---|
| 98 | <!-- if you want to build outside of svn, use "ant clean build [pack]" -->
|
---|
| 99 |
|
---|
| 100 | <target name="create_run_jar" description="Create a JAR file that can be used to execute the JMapViewer demo app. Requires JMapViewer.jar to be present.">
|
---|
| 101 | <jar destfile="JMapViewer_Demo.jar" filesetmanifest="mergewithoutmain">
|
---|
| 102 | <manifest>
|
---|
| 103 | <attribute name="Main-Class" value="org.openstreetmap.gui.jmapviewer.Demo" />
|
---|
| 104 | <attribute name="Class-Path" value="JMapViewer.jar" />
|
---|
| 105 | </manifest>
|
---|
| 106 | </jar>
|
---|
| 107 | </target>
|
---|
[25370] | 108 |
|
---|
[34669] | 109 | <target name="create_release_zip" description="Create a release zip file containing the binary and source jar files as well as the demo starter">
|
---|
| 110 | <zip basedir="." destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}.zip">
|
---|
| 111 | <include name="JMapViewer*.jar" />
|
---|
| 112 | <include name="Readme.txt" />
|
---|
| 113 | <include name="Gpl.txt" />
|
---|
| 114 | </zip>
|
---|
| 115 | <delete>
|
---|
| 116 | <fileset dir="." includes="JMapViewer*.jar"/>
|
---|
| 117 | </delete>
|
---|
| 118 | </target>
|
---|
| 119 |
|
---|
| 120 | <target name="create_source_release_zip" description="Create a release zip file containing the source files">
|
---|
| 121 | <zip destfile="releases/${svnReleaseVersion}/JMapViewer-${svnReleaseVersion}-Source.zip">
|
---|
| 122 | <zipfileset file="Readme.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
|
---|
| 123 | <zipfileset file="build.xml" prefix="jmapviewer-${svnReleaseVersion}"/>
|
---|
| 124 | <zipfileset file="Gpl.txt" prefix="jmapviewer-${svnReleaseVersion}"/>
|
---|
| 125 | <zipfileset dir="src" includes="**/jmapviewer/**" prefix="jmapviewer-${svnReleaseVersion}/src"/>
|
---|
| 126 | </zip>
|
---|
| 127 | </target>
|
---|
[25370] | 128 |
|
---|
[36140] | 129 | <target name="checkstyle" depends="resolve">
|
---|
| 130 | <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
|
---|
| 131 | classpathref="checkstyle.classpath"/>
|
---|
[36202] | 132 | <checkstyle config="${basedir}/tools/checkstyle/jmapviewer_checks.xml">
|
---|
[36139] | 133 | <!-- Exclude the module-info since checkstyle currently cannot parse it -->
|
---|
| 134 | <fileset dir="${basedir}/src" includes="**/*.java" excludes="module-info.java" />
|
---|
[31428] | 135 | <formatter type="xml" toFile="checkstyle-jmapviewer.xml"/>
|
---|
| 136 | </checkstyle>
|
---|
| 137 | </target>
|
---|
| 138 |
|
---|
[36140] | 139 | <target name="spotbugs" depends="pack,resolve">
|
---|
[33805] | 140 | <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask"
|
---|
[36140] | 141 | classpathref="spotbugs.classpath"/>
|
---|
| 142 | <property name="spotbugs-classpath" refid="spotbugs.classpath"/>
|
---|
[33805] | 143 | <spotbugs output="xml"
|
---|
| 144 | outputFile="spotbugs-jmapviewer.xml"
|
---|
| 145 | classpath="${spotbugs-classpath}"
|
---|
[31428] | 146 | effort="max"
|
---|
| 147 | >
|
---|
| 148 | <sourcePath path="${basedir}/src" />
|
---|
| 149 | <class location="JMapViewer.jar" />
|
---|
[33805] | 150 | </spotbugs>
|
---|
[31428] | 151 | </target>
|
---|
| 152 |
|
---|
[34669] | 153 | <target name="javadoc">
|
---|
[31436] | 154 | <javadoc destdir="javadoc"
|
---|
| 155 | sourcepath="src"
|
---|
| 156 | encoding="UTF-8"
|
---|
| 157 | packagenames="org.openstreetmap.gui.jmapviewer.*"
|
---|
| 158 | windowtitle="JMapViewer"
|
---|
| 159 | use="true"
|
---|
| 160 | private="true"
|
---|
| 161 | linksource="true"
|
---|
| 162 | author="false">
|
---|
[34764] | 163 | <link href="https://docs.oracle.com/javase/8/docs/api"/>
|
---|
[31436] | 164 | <doctitle><![CDATA[<h2>JMapViewer - Javadoc</h2>]]></doctitle>
|
---|
| 165 | <bottom><![CDATA[<a href="https://josm.openstreetmap.de/">JMapViewer</a>]]></bottom>
|
---|
[34124] | 166 | <arg value="-html5" if:set="isJava9" />
|
---|
[31436] | 167 | </javadoc>
|
---|
| 168 | </target>
|
---|
| 169 |
|
---|
[36140] | 170 | <target name="resolve" description="Resolve Ivy dependencies">
|
---|
| 171 | <ivy:resolve/>
|
---|
| 172 | <ivy:cachepath pathid="checkstyle.classpath" conf="checkstyle"/>
|
---|
| 173 | <ivy:cachepath pathid="testlib.classpath" conf="test"/>
|
---|
| 174 | <ivy:cachepath pathid="jacoco.classpath" conf="jacocoant"/>
|
---|
| 175 | <ivy:cachepath pathid="spotbugs.classpath" conf="spotbugs"/>
|
---|
| 176 | </target>
|
---|
| 177 |
|
---|
| 178 | <target name="test" depends="clean, build, resolve">
|
---|
| 179 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpathref="jacoco.classpath"/>
|
---|
[34669] | 180 | <javac srcdir="test" destdir="bintest"
|
---|
| 181 | target="${java.lang.version}" source="${java.lang.version}" debug="on"
|
---|
| 182 | includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
|
---|
| 183 | <compilerarg value="-Xlint:all"/>
|
---|
| 184 | <compilerarg value="-Xlint:-serial"/>
|
---|
| 185 | <classpath>
|
---|
[36140] | 186 | <path refid="testlib.classpath"/>
|
---|
| 187 | <path refid="test.classpath"/>
|
---|
[34669] | 188 | </classpath>
|
---|
| 189 | </javac>
|
---|
[36225] | 190 | <jacoco:agent destfile="report/jacoco.exec" enabled="${coverageByDefault}" includes="${jacoco.includes}" dumponexit="true"
|
---|
[36224] | 191 | inclbootstrapclasses="${jacoco.inclbootstrapclasses}" inclnolocationclasses="${jacoco.inclnolocationclasses}"
|
---|
[36225] | 192 | property="jacocoagent" if:true="${coverageByDefault}"/>
|
---|
[36140] | 193 | <junitlauncher printsummary="yes">
|
---|
| 194 | <classpath>
|
---|
| 195 | <path refid="testlib.classpath"/>
|
---|
| 196 | <path refid="test.classpath"/>
|
---|
| 197 | <pathelement location="bintest"/>
|
---|
| 198 | </classpath>
|
---|
| 199 | <testclasses outputdir="report">
|
---|
| 200 | <fileset dir="bintest" includes="**/*Test.class"/>
|
---|
| 201 | <fork>
|
---|
[36224] | 202 | <jvmarg value="${jacocoagent}" if:set="jacocoagent" />
|
---|
[36140] | 203 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
| 204 | </fork>
|
---|
| 205 | <listener type="legacy-brief" sendSysOut="true" sendSysErr="true"/>
|
---|
| 206 | <listener type="legacy-plain" />
|
---|
| 207 | <listener type="legacy-xml" />
|
---|
| 208 | </testclasses>
|
---|
| 209 | </junitlauncher>
|
---|
[36224] | 210 | <jacoco:report>
|
---|
| 211 | <executiondata>
|
---|
| 212 | <fileset dir="report" includes="*.exec"/>
|
---|
| 213 | </executiondata>
|
---|
| 214 | <structure name="JMapViewer Test Coverage">
|
---|
| 215 | <classfiles>
|
---|
| 216 | <fileset dir="bin" includes="org/openstreetmap/"/>
|
---|
| 217 | </classfiles>
|
---|
| 218 | <sourcefiles encoding="UTF-8">
|
---|
| 219 | <fileset dir="src" includes="org/openstreetmap/"/>
|
---|
| 220 | </sourcefiles>
|
---|
| 221 | </structure>
|
---|
| 222 | <xml destfile="report/jacoco.xml"/>
|
---|
| 223 | </jacoco:report>
|
---|
[34669] | 224 | </target>
|
---|
| 225 |
|
---|
[9095] | 226 | </project>
|
---|