-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
154 lines (144 loc) · 8.05 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?xml version="1.0" encoding="utf-8"?>
<project name="markseen" default="dist" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
<property environment="env"/>
<!-- the *lowest* JOSM version this plugin is currently known to be compatible with -->
<property name="plugin.main.version" value="13265"/>
<!--
See https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
-->
<property name="plugin.author" value="Robert Scott"/>
<property name="plugin.version" value="14"/>
<property name="plugin.class" value="org.openstreetmap.josm.plugins.markseen.MarkSeenPlugin"/>
<property name="plugin.description" value="Marks 'seen' areas of the map"/>
<property name="plugin.icon" value="images/icons/24x24/markseen.png"/>
<property name="plugin.link" value="https://github.com/risicle/josm-markseen"/>
<property name="plugin.canloadatruntime" value="true"/>
<property name="plugin.13053.plugin.url" value="9;https://github.com/risicle/josm-markseen/releases/download/v9/markseen.jar"/>
<property name="error_prone_ant.jar" location="${env.JOSM_SRC_DIR}/tools/error_prone_ant.jar"/>
<property name="checkstyle.jar" location="${env.JOSM_SRC_DIR}/tools/checkstyle/checkstyle-all.jar"/>
<property name="findbugs-ant.jar" location="${env.JOSM_SRC_DIR}/tools/findbugs/findbugs-ant.jar"/>
<property name="annotations.jar" location="${env.JOSM_SRC_DIR}/tools/findbugs/annotations.jar"/>
<property name="jacocoant.jar" location="${env.JOSM_SRC_DIR}/tools/jacocoant.jar"/>
<property name="jmockit.jar" location="${env.JOSM_SRC_DIR}/test/lib/jmockit.jar"/>
<property name="plugin.tools.dir" location="${env.JOSM_PLUGINS_SRC_DIR}/plugins/00_tools/"/>
<!-- technique from https://stackoverflow.com/a/8576319 -->
<first id="firstGroovyJar">
<fileset dir="${env.JOSM_SRC_DIR}/tools" includes="groovy-all*.jar" />
</first>
<property name="groovy.jar" location="${toString:firstGroovyJar}"/>
<property name="josm.test.build.dir" location="${env.JOSM_TEST_BUILD_DIR}"/>
<property name="josm" location="${env.JOSM_JAR}"/>
<property name="plugin.dist.dir" location="dist"/>
<property name="testconfig.dir" location="test/config"/>
<condition property="inkscape.path" value="${env.INKSCAPE_PATH}" else="inkscape">
<isset property="env.INKSCAPE_PATH" />
</condition>
<target name="additional-manifest">
<antcall target="add-manifest-attribute">
<param name="manifest.attribute" value="13053_Plugin-Url"/>
<param name="property.name" value="plugin.13053.plugin.url"/>
<param name="property.value" value="${plugin.13053.plugin.url}"/>
</antcall>
</target>
<!-- ** include targets that all plugins have in common ** -->
<import file="${env.JOSM_PLUGINS_SRC_DIR}/plugins/build-common.xml"/>
<macrodef name="init-test-preferences">
<sequential>
<copy file="${env.JOSM_SRC_DIR}/test/config/preferences.template.xml" tofile="${testconfig.dir}/unit-josm.home/preferences.xml"/>
<replace file="${testconfig.dir}/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_USERNAME@" value="${osm.username}"/>
<replace file="${testconfig.dir}/unit-josm.home/preferences.xml" encoding="UTF-8" token="@OSM_PASSWORD@" value="${osm.password}"/>
</sequential>
</macrodef>
<target name="clean">
<delete dir="${plugin.build.dir}"/>
<delete file="${plugin.jar}"/>
<delete dir="images"/>
</target>
<target name="test-clean">
<delete dir="${plugin.test.dir}/build"/>
<delete dir="${plugin.test.dir}/report"/>
<delete file="${plugin.test.dir}/jacoco.exec" />
<delete file="${testconfig.dir}/unit-josm.home/preferences.xml" />
<delete dir="${testconfig.dir}/unit-josm.home/cache" failonerror="false"/>
</target>
<path id="test.classpath">
<pathelement path="${env.CLASSPATH}"/><!-- jmockit should apparently come before junit4, hence CLASSPATH here -->
<fileset dir="${env.JOSM_SRC_DIR}/test/lib">
<include name="**/*.jar"/>
</fileset>
<fileset dir="${plugin.test.dir}/lib" erroronmissingdir="no">
<include name="**/*.jar"/>
<exclude name="**/*-sources.jar"/>
<exclude name="**/*-javadoc.jar"/>
</fileset>
<fileset dir="lib" erroronmissingdir="no">
<include name="**/*.jar"/>
<exclude name="**/*-sources.jar"/>
<exclude name="**/*-javadoc.jar"/>
</fileset>
<pathelement path="${plugin.test.dir}/data"/>
<pathelement path="${josm.test.build.dir}/unit"/>
<pathelement path="${josm}"/>
<pathelement path="${plugin.jar}"/>
<pathelement path="${groovy.jar}"/>
<pathelement path="${annotations.jar}"/>
</path>
<target name="init-revision-fallback" if="git.fail" unless="skip-revision">
<tstamp>
<format property="current.time" pattern="yyyy-MM-dd'T'HH:mm:ss.SSS"/>
</tstamp>
<echo file="REVISION.XML"><![CDATA[<info><entry><commit revision="${plugin.version}"><date>${current.time}</date></commit></entry></info>]]></echo>
</target>
<target name="rendericons">
<sequential>
<apply executable="mkdir" dest="images" parallel="false" failonerror="true" addsourcefile="false">
<arg value="-p"/>
<targetfile/>
<fileset dir="images_src" includes="**/*.svg" erroronmissingdir="true"/>
<mapper type="regexp" from="(.*\/)[^\/]*$" to="\1"/>
</apply>
<apply executable="${inkscape.path}" dest="images" parallel="false" failonerror="true">
<arg value="-z"/>
<arg value="-C"/>
<arg value="-f"/>
<srcfile/>
<arg value="-e"/>
<targetfile/>
<fileset dir="images_src" includes="**/*.svg" erroronmissingdir="true"/>
<mapper type="glob" from="*.svg" to="*.png"/>
</apply>
</sequential>
</target>
<target name="setup-dist" depends="rendericons">
<antcall target="setup-dist-default" />
</target>
<target name="test" depends="dist, test-clean, test-compile" if="test.present"
description="Run unit tests. OSM API (TEST) account shall be set with -Dosm.username and -Dosm.password">
<taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="${jacocoant.jar}" />
<sequential>
<echo message="Running unit tests with JUnit"/>
<jacoco:coverage destfile="${plugin.test.dir}/jacoco.exec">
<junit printsummary="yes" fork="true" forkmode="once" dir="${basedir}">
<jvmarg value="-javaagent:${jmockit.jar}"/>
<jvmarg value="-Dfile.encoding=UTF-8"/>
<jvmarg value="-ea"/>
<!--<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=y,address=9888"/>-->
<sysproperty key="josm.home" value="${testconfig.dir}/unit-josm.home"/>
<sysproperty key="josm.test.data" value="${plugin.test.dir}/data"/>
<sysproperty key="java.awt.headless" value="true"/>
<sysproperty key="suppressPermanentFailure" value="${suppressPermanentFailure}"/>
<classpath>
<fileset refid="plugin.requires.jars"/>
<path refid="test.classpath"/>
<pathelement path="${plugin.test.dir}/build/unit"/>
</classpath>
<formatter type="plain"/>
<formatter type="xml"/>
<batchtest fork="yes" todir="${plugin.test.dir}/report">
<fileset dir="${plugin.test.dir}/build/unit" includes="**/*Test.class"/>
</batchtest>
</junit>
</jacoco:coverage>
</sequential>
</target>
</project>