[26341] | 1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
| 2 | <!--
|
---|
| 3 | ** Template for the build targets common to all plugins
|
---|
| 4 | ** ====================================================
|
---|
| 5 | **
|
---|
| 6 | ** To override a property, add it to the plugin build.xml _before_
|
---|
| 7 | ** this template has been imported.
|
---|
| 8 | ** To override a target, add it _after_ this template has been imported.
|
---|
| 9 | **
|
---|
| 10 | ** Paths are relative to the build.xml that imports this template.
|
---|
| 11 | **
|
---|
| 12 | -->
|
---|
[30550] | 13 | <project name="plugin_common" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
|
---|
[26341] | 14 |
|
---|
[31508] | 15 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
---|
| 16 | <property name="josm.test.build.dir" location="../../core/test/build"/>
|
---|
[33056] | 17 | <property name="error_prone_ant.jar" location="../00_core_tools/error_prone_ant-2.0.14.jar"/>
|
---|
[33048] | 18 | <property name="checkstyle.jar" location="../00_core_tools/checkstyle/checkstyle-7.2-all.jar"/>
|
---|
[32310] | 19 | <property name="findbugs-ant.jar" location="../00_core_tools/findbugs/findbugs-ant.jar"/>
|
---|
[32188] | 20 | <property name="annotations.jar" location="../00_core_tools/findbugs/annotations.jar"/>
|
---|
[30550] | 21 | <property name="plugin.build.dir" location="build"/>
|
---|
| 22 | <property name="plugin.test.dir" location="test"/>
|
---|
| 23 | <property name="plugin.src.dir" location="src"/>
|
---|
| 24 | <property name="plugin.lib.dir" location="lib"/>
|
---|
[26341] | 25 | <!-- this is the directory where the plugin jar is copied to -->
|
---|
[30550] | 26 | <property name="plugin.dist.dir" location="../../dist"/>
|
---|
[32678] | 27 | <property name="ant.build.javac.target" value="1.8"/>
|
---|
| 28 | <property name="ant.build.javac.source" value="1.8"/>
|
---|
[30550] | 29 | <property name="plugin.jar" location="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
[32777] | 30 | <property name="javac.compiler" value="com.google.errorprone.ErrorProneAntCompilerAdapter" />
|
---|
[26341] | 31 |
|
---|
[30699] | 32 | <!-- For Windows-specific stuff -->
|
---|
| 33 | <condition property="isWindows">
|
---|
| 34 | <os family="Windows"/>
|
---|
| 35 | </condition>
|
---|
[32900] | 36 | <!-- For Java9-specific stuff -->
|
---|
| 37 | <condition property="isJava9">
|
---|
| 38 | <equals arg1="${ant.java.version}" arg2="1.9" />
|
---|
| 39 | </condition>
|
---|
| 40 | <target name="-jaxb_before9" unless="isJava9">
|
---|
| 41 | <property name="xjc" value="${java.home}${file.separator}..${file.separator}bin${file.separator}xjc" />
|
---|
[30699] | 42 | </target>
|
---|
[32900] | 43 | <target name="-jaxb_after9" if="isJava9">
|
---|
| 44 | <property name="xjc" value="${java.home}${file.separator}bin${file.separator}xjc" />
|
---|
[30699] | 45 | </target>
|
---|
| 46 |
|
---|
[30747] | 47 | <!-- To be overriden in plugin build file before inclusion if other plugins are required -->
|
---|
| 48 | <fileset id="plugin.requires.jars" dir="${plugin.dist.dir}" includes="nothing"/>
|
---|
| 49 |
|
---|
[32312] | 50 | <path id="plugin.classpath">
|
---|
| 51 | <pathelement location="${josm}"/>
|
---|
| 52 | <fileset dir="${plugin.lib.dir}" erroronmissingdir="no">
|
---|
| 53 | <include name="**/*.jar"/>
|
---|
| 54 | <exclude name="**/*-sources.jar"/>
|
---|
| 55 | <exclude name="**/*-javadoc.jar"/>
|
---|
| 56 | </fileset>
|
---|
| 57 | <fileset refid="plugin.requires.jars"/>
|
---|
| 58 | </path>
|
---|
| 59 |
|
---|
[26341] | 60 | <!--
|
---|
| 61 | **********************************************************
|
---|
| 62 | ** init - initializes the build
|
---|
| 63 | **********************************************************
|
---|
| 64 | -->
|
---|
| 65 | <target name="init">
|
---|
| 66 | <mkdir dir="${plugin.build.dir}"/>
|
---|
| 67 | </target>
|
---|
| 68 | <!--
|
---|
| 69 | **********************************************************
|
---|
[29442] | 70 | ** compile - compiles the source tree
|
---|
[26341] | 71 | **********************************************************
|
---|
| 72 | -->
|
---|
[32322] | 73 | <target name="pre-compile">
|
---|
| 74 | <!-- to be overidden by plugins that need to perform additional tasks before compiling -->
|
---|
| 75 | </target>
|
---|
| 76 | <target name="compile" depends="init, pre-compile" unless="skip-compile">
|
---|
[28290] | 77 | <echo message="compiling sources for ${plugin.jar} ..."/>
|
---|
[32777] | 78 | <javac compiler="${javac.compiler}" srcdir="src" debug="true" destdir="${plugin.build.dir}" includeantruntime="false" encoding="UTF-8">
|
---|
[32678] | 79 | <compilerclasspath>
|
---|
| 80 | <pathelement location="${error_prone_ant.jar}"/>
|
---|
| 81 | </compilerclasspath>
|
---|
[26341] | 82 | <compilerarg value="-Xlint:deprecation"/>
|
---|
| 83 | <compilerarg value="-Xlint:unchecked"/>
|
---|
[32777] | 84 | <compilerarg value="-Xep:ReferenceEquality:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
[33059] | 85 | <compilerarg value="-Xep:InsecureCryptoUsage:OFF" compiler="com.google.errorprone.ErrorProneAntCompilerAdapter"/>
|
---|
[32737] | 86 | <compilerarg line="-Xmaxwarns 1000"/>
|
---|
[32312] | 87 | <classpath refid="plugin.classpath"/>
|
---|
[26341] | 88 | </javac>
|
---|
| 89 | </target>
|
---|
| 90 | <!--
|
---|
| 91 | **********************************************************
|
---|
[29005] | 92 | ** setup-dist - copies files for distribution
|
---|
[28990] | 93 | **********************************************************
|
---|
| 94 | -->
|
---|
[29005] | 95 | <target name="setup-dist-default">
|
---|
[28990] | 96 | <copy todir="${plugin.build.dir}/resources" failonerror="no" includeemptydirs="no">
|
---|
| 97 | <fileset dir="resources"/>
|
---|
| 98 | </copy>
|
---|
| 99 | <copy todir="${plugin.build.dir}/images" failonerror="no" includeemptydirs="no">
|
---|
| 100 | <fileset dir="images"/>
|
---|
| 101 | </copy>
|
---|
| 102 | <copy todir="${plugin.build.dir}/data" failonerror="no" includeemptydirs="no">
|
---|
| 103 | <fileset dir="data"/>
|
---|
| 104 | </copy>
|
---|
| 105 | <copy todir="${plugin.build.dir}">
|
---|
| 106 | <fileset dir=".">
|
---|
| 107 | <include name="README"/>
|
---|
[28996] | 108 | <include name="LICENSE*"/>
|
---|
| 109 | <include name="*GPL*"/>
|
---|
[28990] | 110 | </fileset>
|
---|
| 111 | </copy>
|
---|
[29005] | 112 | </target>
|
---|
| 113 | <target name="setup-dist">
|
---|
[29007] | 114 | <antcall target="setup-dist-default" />
|
---|
[29005] | 115 | </target>
|
---|
| 116 | <!--
|
---|
| 117 | **********************************************************
|
---|
| 118 | ** dist - creates the plugin jar
|
---|
| 119 | **********************************************************
|
---|
| 120 | -->
|
---|
[32311] | 121 | <target name="dist" depends="compile,revision" unless="skip-dist">
|
---|
[29005] | 122 | <echo message="creating ${ant.project.name}.jar ... "/>
|
---|
[29007] | 123 | <antcall target="setup-dist" />
|
---|
[28990] | 124 | <delete file="MANIFEST" failonerror="no"/>
|
---|
| 125 | <manifest file="MANIFEST" mode="update">
|
---|
| 126 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
| 127 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
| 128 | <attribute name="Plugin-Class" value="${plugin.class}" />
|
---|
| 129 | <attribute name="Plugin-Description" value="${plugin.description}" />
|
---|
| 130 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
---|
| 131 | <attribute name="Author" value="${plugin.author}"/>
|
---|
| 132 | </manifest>
|
---|
| 133 | <antcall target="add-manifest-attribute">
|
---|
| 134 | <param name="manifest.attribute" value="Plugin-Link"/>
|
---|
[30562] | 135 | <param name="property.name" value="plugin.link"/>
|
---|
| 136 | <param name="property.value" value="${plugin.link}"/>
|
---|
[28990] | 137 | </antcall>
|
---|
| 138 | <antcall target="add-manifest-attribute">
|
---|
| 139 | <param name="manifest.attribute" value="Plugin-Icon"/>
|
---|
[30562] | 140 | <param name="property.name" value="plugin.icon"/>
|
---|
| 141 | <param name="property.value" value="${plugin.icon}"/>
|
---|
[28990] | 142 | </antcall>
|
---|
| 143 | <antcall target="add-manifest-attribute">
|
---|
| 144 | <param name="manifest.attribute" value="Plugin-Early"/>
|
---|
[30562] | 145 | <param name="property.name" value="plugin.early"/>
|
---|
| 146 | <param name="property.value" value="${plugin.early}"/>
|
---|
[28990] | 147 | </antcall>
|
---|
| 148 | <antcall target="add-manifest-attribute">
|
---|
| 149 | <param name="manifest.attribute" value="Plugin-Requires"/>
|
---|
[30562] | 150 | <param name="property.name" value="plugin.requires"/>
|
---|
| 151 | <param name="property.value" value="${plugin.requires}"/>
|
---|
[28990] | 152 | </antcall>
|
---|
| 153 | <antcall target="add-manifest-attribute">
|
---|
| 154 | <param name="manifest.attribute" value="Plugin-Stage"/>
|
---|
[30562] | 155 | <param name="property.name" value="plugin.stage"/>
|
---|
| 156 | <param name="property.value" value="${plugin.stage}"/>
|
---|
[28990] | 157 | </antcall>
|
---|
[30952] | 158 | <antcall target="add-manifest-attribute">
|
---|
| 159 | <param name="manifest.attribute" value="Plugin-Canloadatruntime"/>
|
---|
| 160 | <param name="property.name" value="plugin.canloadatruntime"/>
|
---|
| 161 | <param name="property.value" value="${plugin.canloadatruntime}"/>
|
---|
| 162 | </antcall>
|
---|
[29435] | 163 | <antcall target="additional-manifest" />
|
---|
[31768] | 164 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}" manifest="MANIFEST" manifestencoding="UTF-8">
|
---|
[31281] | 165 | <restrict>
|
---|
| 166 | <not><or>
|
---|
| 167 | <name name="META-INF/maven/*"/>
|
---|
| 168 | <name name="META-INF/DEPENDENCIES"/>
|
---|
| 169 | <name name="META-INF/LICENSE"/>
|
---|
| 170 | <name name="META-INF/NOTICE"/>
|
---|
[32175] | 171 | <name name="META-INF/*.RSA"/>
|
---|
| 172 | <name name="META-INF/*.SF"/>
|
---|
[31281] | 173 | </or></not>
|
---|
| 174 | <archives>
|
---|
| 175 | <zips>
|
---|
| 176 | <fileset dir="${plugin.lib.dir}" includes="*.jar" excludes="*-sources.jar, *-javadoc.jar" erroronmissingdir="no"/>
|
---|
| 177 | </zips>
|
---|
| 178 | </archives>
|
---|
| 179 | </restrict>
|
---|
[28990] | 180 | </jar>
|
---|
| 181 | <delete file="MANIFEST" failonerror="no"/>
|
---|
[29007] | 182 | <antcall target="post-dist" />
|
---|
[28990] | 183 | </target>
|
---|
[29007] | 184 | <target name="post-dist">
|
---|
[31281] | 185 | <!-- to be overidden by plugins that need to perform additional tasks on resulting jar -->
|
---|
[29007] | 186 | </target>
|
---|
[30562] | 187 | <target name="add-manifest-attribute" depends="check-manifest-attribute" if="have-${property.name}">
|
---|
[28990] | 188 | <manifest file="MANIFEST" mode="update">
|
---|
[30562] | 189 | <attribute name="${manifest.attribute}" value="${property.value}" />
|
---|
[28990] | 190 | </manifest>
|
---|
| 191 | </target>
|
---|
[29435] | 192 | <!-- target to add additional entries, empty in commons -->
|
---|
| 193 | <target name="additional-manifest">
|
---|
| 194 | </target>
|
---|
[28990] | 195 | <target name="check-manifest-attribute">
|
---|
[30562] | 196 | <condition property="have-${property.name}">
|
---|
[28990] | 197 | <and>
|
---|
[30562] | 198 | <isset property="${property.name}"/>
|
---|
[28990] | 199 | <not>
|
---|
[30562] | 200 | <equals arg1="${property.value}" arg2=""/>
|
---|
[28990] | 201 | </not>
|
---|
| 202 | <not>
|
---|
[30562] | 203 | <equals arg1="${property.value}" arg2="..."/>
|
---|
[28990] | 204 | </not>
|
---|
| 205 | </and>
|
---|
| 206 | </condition>
|
---|
| 207 | </target>
|
---|
| 208 | <!--
|
---|
| 209 | **********************************************************
|
---|
[26341] | 210 | ** revision - extracts the current revision number for the
|
---|
| 211 | ** file build.number and stores it in the XML property
|
---|
| 212 | ** version.*
|
---|
| 213 | **********************************************************
|
---|
| 214 | -->
|
---|
[30161] | 215 | <!--
|
---|
| 216 | ** Initializes the REVISION.XML file from SVN information
|
---|
| 217 | -->
|
---|
[32334] | 218 | <target name="init-svn-revision-xml" unless="skip-revision">
|
---|
[30161] | 219 | <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
|
---|
[26341] | 220 | <env key="LANG" value="C"/>
|
---|
| 221 | <arg value="info"/>
|
---|
| 222 | <arg value="--xml"/>
|
---|
| 223 | <arg value="."/>
|
---|
| 224 | </exec>
|
---|
[32334] | 225 | <condition property="svn.info.fail">
|
---|
| 226 | <not><equals arg1="${svn.info.result}" arg2="0" /></not>
|
---|
[30161] | 227 | </condition>
|
---|
[26341] | 228 | </target>
|
---|
| 229 | <!--
|
---|
[30306] | 230 | ** Initializes the REVISION.XML file from git-svn information.
|
---|
| 231 | Obtains the revision from the git-svn-id field.
|
---|
[30161] | 232 | -->
|
---|
[32334] | 233 | <target name="init-git-svn-revision-xml" if="svn.info.fail" unless="skip-revision">
|
---|
[30306] | 234 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.svn.info.result">
|
---|
[30161] | 235 | <arg value="log"/>
|
---|
| 236 | <arg value="-1"/>
|
---|
| 237 | <arg value="--grep=git-svn-id"/>
|
---|
| 238 | <!--
|
---|
| 239 | %B: raw body (unwrapped subject and body)
|
---|
| 240 | %n: new line
|
---|
| 241 | %ai: author date, ISO 8601 format
|
---|
| 242 | -->
|
---|
| 243 | <arg value="--pretty=format:%B%n%ai"/>
|
---|
[31886] | 244 | <arg value="."/>
|
---|
[30161] | 245 | </exec>
|
---|
| 246 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
| 247 | match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 248 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[30306] | 249 | <condition property="git.svn.fail">
|
---|
| 250 | <not>
|
---|
| 251 | <and>
|
---|
| 252 | <equals arg1="${git.svn.info.result}" arg2="0" />
|
---|
| 253 | <length file="REVISION.XML" when="greater" length="1" />
|
---|
| 254 | </and>
|
---|
| 255 | </not>
|
---|
| 256 | </condition>
|
---|
[30562] | 257 | </target>
|
---|
[30306] | 258 | <!--
|
---|
| 259 | ** Initializes the REVISION.XML file from git (w/o svn) information.
|
---|
| 260 | Uses Unix date as revision number.
|
---|
| 261 | -->
|
---|
[32334] | 262 | <target name="init-git-revision-xml" if="git.svn.fail" unless="skip-revision">
|
---|
[30309] | 263 | <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.info.result">
|
---|
[30306] | 264 | <arg value="log"/>
|
---|
| 265 | <arg value="-1"/>
|
---|
| 266 | <arg value="--pretty=format:%at%n%ai"/>
|
---|
[31886] | 267 | <arg value="."/>
|
---|
[30306] | 268 | </exec>
|
---|
| 269 | <replaceregexp file="REVISION.XML" flags="s"
|
---|
| 270 | match="\s*(\d*)\s+(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
|
---|
| 271 | replace="<info><entry><commit revision="\1"><date>\2</date></commit></entry></info>"/>
|
---|
[30309] | 272 | <condition property="git.fail">
|
---|
| 273 | <not>
|
---|
| 274 | <and>
|
---|
| 275 | <equals arg1="${git.info.result}" arg2="0" />
|
---|
| 276 | <length file="REVISION.XML" when="greater" length="1" />
|
---|
| 277 | </and>
|
---|
| 278 | </not>
|
---|
| 279 | </condition>
|
---|
[30161] | 280 | </target>
|
---|
[32334] | 281 | <target name="init-revision-fallback" if="git.fail" unless="skip-revision">
|
---|
[30309] | 282 | <tstamp>
|
---|
| 283 | <format property="current.time" pattern="yyyy-MM-dd'T'HH:mm:ss.SSS" />
|
---|
| 284 | </tstamp>
|
---|
| 285 | <echo file="REVISION.XML"><![CDATA[<info><entry><commit revision="UNKNOWN"><date>${current.time}</date></commit></entry></info>]]></echo>
|
---|
| 286 | </target>
|
---|
[32311] | 287 | <target name="revision" depends="init-svn-revision-xml, init-git-svn-revision-xml, init-git-revision-xml, init-revision-fallback" unless="skip-revision">
|
---|
[30161] | 288 | <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
| 289 | <delete file="REVISION.XML"/>
|
---|
| 290 | </target>
|
---|
| 291 | <!--
|
---|
[26341] | 292 | **********************************************************
|
---|
| 293 | ** clean - clean up the build environment
|
---|
| 294 | **********************************************************
|
---|
| 295 | -->
|
---|
| 296 | <target name="clean">
|
---|
| 297 | <delete dir="${plugin.build.dir}"/>
|
---|
| 298 | <delete file="${plugin.jar}"/>
|
---|
| 299 | </target>
|
---|
| 300 | <!--
|
---|
| 301 | **********************************************************
|
---|
| 302 | ** install - install the plugin in your local JOSM installation
|
---|
| 303 | **********************************************************
|
---|
| 304 | -->
|
---|
| 305 | <target name="install" depends="dist">
|
---|
| 306 | <property environment="env"/>
|
---|
[30907] | 307 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins">
|
---|
[26341] | 308 | <and>
|
---|
| 309 | <os family="windows"/>
|
---|
| 310 | </and>
|
---|
| 311 | </condition>
|
---|
[30896] | 312 | <condition property="josm.plugins.dir" value="${user.home}/Library/JOSM/plugins">
|
---|
| 313 | <and>
|
---|
| 314 | <os family="mac"/>
|
---|
| 315 | </and>
|
---|
| 316 | </condition>
|
---|
| 317 | <condition property="josm.plugins.dir" value="${user.home}/.josm/plugins">
|
---|
| 318 | <and>
|
---|
| 319 | <not><os family="windows"/></not>
|
---|
| 320 | <not><os family="mac"/></not>
|
---|
| 321 | </and>
|
---|
| 322 | </condition>
|
---|
[26341] | 323 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
| 324 | </target>
|
---|
| 325 | <!--
|
---|
[32052] | 326 | ************************** Publishing the plugin ***********************************
|
---|
[26341] | 327 | -->
|
---|
| 328 | <!--
|
---|
[32052] | 329 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
[26341] | 330 | ** property ${coreversion.info.entry.revision}
|
---|
| 331 | **
|
---|
| 332 | -->
|
---|
| 333 | <target name="core-info">
|
---|
| 334 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
| 335 | <env key="LANG" value="C"/>
|
---|
| 336 | <arg value="info"/>
|
---|
| 337 | <arg value="--xml"/>
|
---|
| 338 | <arg value="../../core"/>
|
---|
| 339 | </exec>
|
---|
| 340 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
| 341 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
| 342 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
| 343 | <delete file="core.info.xml"/>
|
---|
| 344 | </target>
|
---|
| 345 | <!--
|
---|
| 346 | ** commits the source tree for this plugin
|
---|
| 347 | -->
|
---|
| 348 | <target name="commit-current">
|
---|
| 349 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
| 350 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 351 | <env key="LANG" value="C"/>
|
---|
| 352 | <arg value="commit"/>
|
---|
[28400] | 353 | <arg value="-m"/>
|
---|
| 354 | <arg value="${commit.message}"/>
|
---|
[26341] | 355 | <arg value="."/>
|
---|
| 356 | </exec>
|
---|
| 357 | </target>
|
---|
| 358 | <!--
|
---|
| 359 | ** updates (svn up) the source tree for this plugin
|
---|
| 360 | -->
|
---|
| 361 | <target name="update-current">
|
---|
| 362 | <echo>Updating plugin source ...</echo>
|
---|
| 363 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 364 | <env key="LANG" value="C"/>
|
---|
| 365 | <arg value="up"/>
|
---|
| 366 | <arg value="."/>
|
---|
| 367 | </exec>
|
---|
| 368 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
| 369 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 370 | <env key="LANG" value="C"/>
|
---|
| 371 | <arg value="up"/>
|
---|
| 372 | <arg value="../dist/${plugin.jar}"/>
|
---|
| 373 | </exec>
|
---|
| 374 | </target>
|
---|
| 375 | <!--
|
---|
[32052] | 376 | ** commits the plugin.jar
|
---|
[26341] | 377 | -->
|
---|
| 378 | <target name="commit-dist">
|
---|
| 379 | <echo>
|
---|
| 380 | ***** Properties of published ${plugin.jar} *****
|
---|
[27960] | 381 | Commit message : '${commit.message}'
|
---|
[26341] | 382 | Plugin-Mainversion: ${plugin.main.version}
|
---|
| 383 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
| 384 | Plugin-Version : ${version.entry.commit.revision}
|
---|
[27960] | 385 | ***** / Properties of published ${plugin.jar} *****
|
---|
| 386 |
|
---|
[26341] | 387 | Now commiting ${plugin.jar} ...
|
---|
| 388 | </echo>
|
---|
| 389 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
| 390 | <env key="LANG" value="C"/>
|
---|
[28400] | 391 | <arg value="-m"/>
|
---|
| 392 | <arg value="${commit.message}"/>
|
---|
[26341] | 393 | <arg value="commit"/>
|
---|
| 394 | <arg value="${plugin.jar}"/>
|
---|
| 395 | </exec>
|
---|
| 396 | </target>
|
---|
| 397 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
| 398 | <target name="ensure-svn-present">
|
---|
| 399 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
| 400 | <env key="LANG" value="C"/>
|
---|
| 401 | <arg value="--version"/>
|
---|
| 402 | </exec>
|
---|
| 403 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
| 404 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
| 405 | <condition>
|
---|
| 406 | <not>
|
---|
| 407 | <isset property="svn.exit.code"/>
|
---|
| 408 | </not>
|
---|
| 409 | </condition>
|
---|
| 410 | </fail>
|
---|
| 411 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
| 412 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
| 413 | <condition>
|
---|
| 414 | <isfailure code="${svn.exit.code}"/>
|
---|
| 415 | </condition>
|
---|
| 416 | </fail>
|
---|
| 417 | </target>
|
---|
[28807] | 418 |
|
---|
[26341] | 419 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
| 420 | </target>
|
---|
[31281] | 421 |
|
---|
[30550] | 422 | <path id="test.classpath">
|
---|
[30552] | 423 | <fileset dir="../00_core_test_lib">
|
---|
[30550] | 424 | <include name="**/*.jar"/>
|
---|
| 425 | </fileset>
|
---|
| 426 | <fileset dir="${plugin.test.dir}/lib" erroronmissingdir="no">
|
---|
| 427 | <include name="**/*.jar"/>
|
---|
[30820] | 428 | <exclude name="**/*-sources.jar"/>
|
---|
| 429 | <exclude name="**/*-javadoc.jar"/>
|
---|
[30550] | 430 | </fileset>
|
---|
| 431 | <fileset dir="lib" erroronmissingdir="no">
|
---|
| 432 | <include name="**/*.jar"/>
|
---|
[30820] | 433 | <exclude name="**/*-sources.jar"/>
|
---|
| 434 | <exclude name="**/*-javadoc.jar"/>
|
---|
[30550] | 435 | </fileset>
|
---|
[32052] | 436 | <pathelement path="${plugin.test.dir}/data"/>
|
---|
[30553] | 437 | <pathelement path="${josm.test.build.dir}/unit"/>
|
---|
[30550] | 438 | <pathelement path="${josm}"/>
|
---|
| 439 | <pathelement path="${plugin.jar}"/>
|
---|
[32188] | 440 | <pathelement path="${annotations.jar}"/>
|
---|
[30550] | 441 | </path>
|
---|
| 442 | <macrodef name="init-test-preferences">
|
---|
| 443 | <sequential>
|
---|
[32326] | 444 | <copy file="../00_core_test_config/preferences.template.xml" tofile="../00_core_test_config/unit-josm.home/preferences.xml"/>
|
---|
| 445 | <replace file="../00_core_test_config/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
|
---|
| 446 | <replace file="../00_core_test_config/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
|
---|
[30550] | 447 | </sequential>
|
---|
| 448 | </macrodef>
|
---|
[32306] | 449 | <target name="check-test">
|
---|
| 450 | <available file="${plugin.test.dir}" type="dir" property="test.present"/>
|
---|
| 451 | </target>
|
---|
| 452 | <target name="test-init" depends="check-test" if="test.present">
|
---|
[30550] | 453 | <mkdir dir="${plugin.test.dir}/build"/>
|
---|
| 454 | <mkdir dir="${plugin.test.dir}/build/unit"/>
|
---|
| 455 | <mkdir dir="${plugin.test.dir}/report"/>
|
---|
[30562] | 456 | <init-test-preferences/>
|
---|
[30550] | 457 | </target>
|
---|
| 458 | <target name="test-clean">
|
---|
| 459 | <delete dir="${plugin.test.dir}/build"/>
|
---|
| 460 | <delete dir="${plugin.test.dir}/report"/>
|
---|
| 461 | <delete file="${plugin.test.dir}/jacoco.exec" />
|
---|
[32326] | 462 | <delete file="../00_core_test_config/unit-josm.home/preferences.xml" />
|
---|
| 463 | <delete dir="../00_core_test_config/unit-josm.home/cache" failonerror="false"/>
|
---|
[30550] | 464 | </target>
|
---|
[32306] | 465 | <target name="test-compile" depends="test-init,dist" if="test.present">
|
---|
[30550] | 466 | <sequential>
|
---|
[32926] | 467 | <javac debug="on" srcdir="${plugin.test.dir}/unit" destdir="${plugin.test.dir}/build/unit" encoding="UTF-8">
|
---|
[30550] | 468 | <classpath>
|
---|
[30747] | 469 | <fileset refid="plugin.requires.jars"/>
|
---|
[30562] | 470 | <path refid="test.classpath"/>
|
---|
[30550] | 471 | </classpath>
|
---|
[32926] | 472 | <compilerarg value="-Xlint:all"/>
|
---|
| 473 | <compilerarg value="-Xlint:-serial"/>
|
---|
| 474 | </javac>
|
---|
[30550] | 475 | </sequential>
|
---|
| 476 | </target>
|
---|
[32306] | 477 | <target name="test" depends="dist, test-clean, test-compile" if="test.present"
|
---|
[30747] | 478 | description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
|
---|
| 479 | <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="../00_core_tools/jacocoant.jar" />
|
---|
[30550] | 480 | <sequential>
|
---|
[30562] | 481 | <echo message="Running unit tests with JUnit"/>
|
---|
[30550] | 482 | <jacoco:coverage destfile="${plugin.test.dir}/jacoco.exec">
|
---|
[30556] | 483 | <junit printsummary="yes" fork="true" forkmode="once" dir="${basedir}">
|
---|
[30562] | 484 | <jvmarg value="-Dfile.encoding=UTF-8"/>
|
---|
[32326] | 485 | <sysproperty key="josm.home" value="../00_core_test_config/unit-josm.home"/>
|
---|
[30550] | 486 | <sysproperty key="josm.test.data" value="${plugin.test.dir}/data"/>
|
---|
| 487 | <sysproperty key="java.awt.headless" value="true"/>
|
---|
| 488 | <sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
|
---|
| 489 | <classpath>
|
---|
[30747] | 490 | <fileset refid="plugin.requires.jars"/>
|
---|
[30550] | 491 | <path refid="test.classpath"/>
|
---|
| 492 | <pathelement path="${plugin.test.dir}/build/unit"/>
|
---|
| 493 | </classpath>
|
---|
| 494 | <formatter type="plain"/>
|
---|
| 495 | <formatter type="xml"/>
|
---|
| 496 | <batchtest fork="yes" todir="${plugin.test.dir}/report">
|
---|
[30562] | 497 | <fileset dir="${plugin.test.dir}/build/unit" includes="**/*Test.class"/>
|
---|
[30550] | 498 | </batchtest>
|
---|
| 499 | </junit>
|
---|
| 500 | </jacoco:coverage>
|
---|
| 501 | </sequential>
|
---|
[30562] | 502 | </target>
|
---|
[31281] | 503 |
|
---|
[32310] | 504 | <target name="checkstyle">
|
---|
| 505 | <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" classpath="${checkstyle.jar}"/>
|
---|
| 506 | <checkstyle config="../00_core_tools/checkstyle/josm_checks.xml">
|
---|
[33061] | 507 | <fileset dir="${basedir}/src" includes="**/*.java" excludes="boofcv/**/*.java,
|
---|
| 508 | com/google/**/*.java,
|
---|
[32317] | 509 | crosby/**/*.java,
|
---|
| 510 | edu/princeton/**/*.java,
|
---|
| 511 | net/boplicity/**/*.java,
|
---|
| 512 | org/apache/**/*.java,
|
---|
| 513 | org/dinopolis/**/*.java,
|
---|
| 514 | org/kaintoch/**/*.java,
|
---|
| 515 | org/marvinproject/**/*.java,
|
---|
| 516 | org/netbeans/**/*.java,
|
---|
[33025] | 517 | org/openstreetmap/josm/plugins/dataimport/io/tcx/**/*.java,
|
---|
[32765] | 518 | org/openstreetmap/josm/plugins/ohe/parser/**/*.java,
|
---|
| 519 | org/openstreetmap/josm/plugins/roadsigns/javacc/**/*.java,
|
---|
| 520 | org/osgeo/**/*.java,
|
---|
| 521 | pdfimport/pdfbox/operators/**/*.java
|
---|
| 522 | "/>
|
---|
[32310] | 523 | <fileset dir="${basedir}/test" includes="**/*.java" erroronmissingdir="false"/>
|
---|
| 524 | <formatter type="xml" toFile="checkstyle-josm-${ant.project.name}.xml"/>
|
---|
| 525 | </checkstyle>
|
---|
| 526 | </target>
|
---|
| 527 |
|
---|
| 528 | <target name="findbugs" depends="dist">
|
---|
| 529 | <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="${findbugs-ant.jar}"/>
|
---|
| 530 | <path id="findbugs-classpath">
|
---|
| 531 | <fileset dir="../00_core_tools/findbugs/">
|
---|
| 532 | <include name="*.jar"/>
|
---|
| 533 | </fileset>
|
---|
| 534 | </path>
|
---|
| 535 | <property name="findbugs-classpath" refid="findbugs-classpath"/>
|
---|
| 536 | <findbugs output="xml"
|
---|
| 537 | outputFile="findbugs-josm-${ant.project.name}.xml"
|
---|
| 538 | classpath="${findbugs-classpath}"
|
---|
| 539 | pluginList=""
|
---|
[32311] | 540 | excludeFilter="../findbugs-filter.xml"
|
---|
[32310] | 541 | effort="default"
|
---|
| 542 | reportLevel="low"
|
---|
| 543 | >
|
---|
[32317] | 544 | <auxClasspath refid="plugin.classpath" />
|
---|
[32310] | 545 | <sourcePath path="${basedir}/src" />
|
---|
| 546 | <class location="${plugin.jar}" />
|
---|
| 547 | </findbugs>
|
---|
| 548 | </target>
|
---|
| 549 |
|
---|
[28807] | 550 | <target name="runjosm" depends="install">
|
---|
[32311] | 551 | <java jar="${josm}" fork="true"/>
|
---|
[28807] | 552 | </target>
|
---|
| 553 |
|
---|
| 554 | <target name="profilejosm" depends="install">
|
---|
| 555 | <nbprofiledirect>
|
---|
| 556 | </nbprofiledirect>
|
---|
| 557 | <java jar="${josm}" fork="true">
|
---|
| 558 | <jvmarg value="${profiler.info.jvmargs.agent}"/>
|
---|
| 559 | </java>
|
---|
| 560 | </target>
|
---|
[29004] | 561 | <!--
|
---|
[32052] | 562 | ** shows a help text
|
---|
[29004] | 563 | -->
|
---|
| 564 | <target name="help">
|
---|
| 565 | <echo>
|
---|
| 566 | You can use following targets:
|
---|
| 567 | * dist This default target builds the plugin jar file
|
---|
[29006] | 568 | * clean Cleanup automatical created files
|
---|
[31281] | 569 | * test Run unit tests (if any)
|
---|
[29004] | 570 | * publish Checkin source code, build jar and checkin plugin jar
|
---|
| 571 | (requires proper entry for SVN commit message!)
|
---|
| 572 | * install Install the plugin in current system
|
---|
| 573 | * runjosm Install plugin and start josm
|
---|
| 574 | * profilejosm Install plugin and start josm in profiling mode
|
---|
[32052] | 575 |
|
---|
[29004] | 576 | There are other targets, which usually should not be called manually.
|
---|
| 577 | </echo>
|
---|
| 578 | </target>
|
---|
[26341] | 579 | </project>
|
---|