1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
2 | <project name="mapdust" default="dist" basedir=".">
|
---|
3 |
|
---|
4 | <!-- properties -->
|
---|
5 | <property name="commit.message" value="MapDust bug reporter plugin" />
|
---|
6 | <property name="plugin.main.version" value="3592" />
|
---|
7 | <property name="josm.dir" value="../../core/dist/" />
|
---|
8 | <property name="plugin.build.dir" value="build/classes" />
|
---|
9 | <property name="apidoc.dir" value="build/doc" />
|
---|
10 | <property name="plugin.src.dir" value="src" />
|
---|
11 | <property name="plugin.lib.dir" value="lib" />
|
---|
12 | <property name="plugin.dist.dir" value="../../dist" />
|
---|
13 | <property name="ant.build.javac.target" value="1.5" />
|
---|
14 | <property name="plugin.dist.dir" value="../../dist" />
|
---|
15 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar" />
|
---|
16 |
|
---|
17 | <!-- classpath -->
|
---|
18 | <path id="classpath">
|
---|
19 | <fileset dir="${plugin.lib.dir}" includes="**/*.jar" />
|
---|
20 | <fileset dir="${josm.dir}" includes="josm-custom.jar" />
|
---|
21 | </path>
|
---|
22 |
|
---|
23 | <!-- clean the build -->
|
---|
24 | <target name="clean">
|
---|
25 | <delete dir="${plugin.build.dir}" />
|
---|
26 | <delete file="${plugin.jar}" />
|
---|
27 | </target>
|
---|
28 |
|
---|
29 | <!-- initialize the build -->
|
---|
30 | <target name="init" depends="clean">
|
---|
31 | <mkdir dir="${plugin.build.dir}" />
|
---|
32 | </target>
|
---|
33 |
|
---|
34 | <!-- compiles the sources -->
|
---|
35 | <target name="compile" depends="init">
|
---|
36 | <echo message="compiling sources for ${plugin.jar} ... " />
|
---|
37 | <javac srcdir="src" classpathref="classpath" debug="true" destdir="${plugin.build.dir}" includeantruntime="true" target="1.5" source="1.5">
|
---|
38 | <compilerarg value="-Xlint:deprecation" />
|
---|
39 | <compilerarg value="-Xlint:unchecked" />
|
---|
40 | </javac>
|
---|
41 | </target>
|
---|
42 |
|
---|
43 | <!-- creates the javadocs -->
|
---|
44 | <target name="javadoc">
|
---|
45 | <mkdir dir="${apidoc.dir}" />
|
---|
46 | <javadoc destdir="${apidoc.dir}" source="1.6" classpathref="classpath" windowtitle="MapDust plugin API">
|
---|
47 | <link href="http://java.sun.com/javase/6/docs/api/" />
|
---|
48 | <link href="http://docs.jboss.org/hibernate/stable/core/api/" />
|
---|
49 | <packageset dir="${plugin.src.dir}">
|
---|
50 | </packageset>
|
---|
51 | </javadoc>
|
---|
52 |
|
---|
53 | </target>
|
---|
54 |
|
---|
55 | <!-- revision -->
|
---|
56 | <target name="revision">
|
---|
57 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
58 | <env key="LANG" value="C" />
|
---|
59 | <arg value="info" />
|
---|
60 | <arg value="--xml" />
|
---|
61 | <arg value="." />
|
---|
62 | </exec>
|
---|
63 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
|
---|
64 | <delete file="REVISION" />
|
---|
65 | </target>
|
---|
66 |
|
---|
67 | <!-- creates the .jar file of the plugin -->
|
---|
68 | <target name="dist" depends="compile,revision">
|
---|
69 | <echo message="creating ${ant.project.name}.jar ... " />
|
---|
70 | <copy todir="${plugin.build.dir}">
|
---|
71 | <fileset dir="conf" />
|
---|
72 | </copy>
|
---|
73 | <copy todir="${plugin.build.dir}/images">
|
---|
74 | <fileset dir="images" />
|
---|
75 | </copy>
|
---|
76 | <copy todir="${plugin.build.dir}">
|
---|
77 | <fileset dir=".">
|
---|
78 | <include name="README" />
|
---|
79 | <include name="LICENSE" />
|
---|
80 | </fileset>
|
---|
81 | </copy>
|
---|
82 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
83 | <zipfileset src="lib/gson-1.5.jar" includes="**/*.class" />
|
---|
84 | <manifest>
|
---|
85 | <attribute name="Author" value="Beata Jancso" />
|
---|
86 | <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.mapdust.MapdustPlugin" />
|
---|
87 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
---|
88 | <attribute name="Plugin-Description" value="The MapDust Plug-In shows the MapDust bug reports
|
---|
89 | on the map. You can create, close, invalidate, re-open and
|
---|
90 | comment bug reports by using this plugin." />
|
---|
91 | <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/MapDust" />
|
---|
92 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
|
---|
93 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
|
---|
94 | <attribute name="Plugin-Icon" value="images/dialogs/mapdust_icon25.png" />
|
---|
95 | </manifest>
|
---|
96 | </jar>
|
---|
97 | </target>
|
---|
98 |
|
---|
99 | <!-- installs the plugin -->
|
---|
100 | <target name="install" depends="dist">
|
---|
101 | <property environment="env" />
|
---|
102 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
103 | <and>
|
---|
104 | <os family="windows" />
|
---|
105 | </and>
|
---|
106 | </condition>
|
---|
107 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
|
---|
108 | </target>
|
---|
109 |
|
---|
110 | <!-- displays the information about the core josm -->
|
---|
111 | <target name="core-info">
|
---|
112 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
113 | <env key="LANG" value="C" />
|
---|
114 | <arg value="info" />
|
---|
115 | <arg value="--xml" />
|
---|
116 | <arg value="../../core" />
|
---|
117 | </exec>
|
---|
118 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
|
---|
119 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
120 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
121 | <delete file="core.info.xml" />
|
---|
122 | </target>
|
---|
123 |
|
---|
124 | <!-- commits the current sources -->
|
---|
125 | <target name="commit-current">
|
---|
126 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
127 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
128 | <env key="LANG" value="C" />
|
---|
129 | <arg value="commit" />
|
---|
130 | <arg value="-m '${commit.message}'" />
|
---|
131 | <arg value="." />
|
---|
132 | </exec>
|
---|
133 | </target>
|
---|
134 |
|
---|
135 | <!-- updates the plugin -->
|
---|
136 | <target name="update-current">
|
---|
137 | <echo>Updating plugin source ...</echo>
|
---|
138 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
139 | <env key="LANG" value="C" />
|
---|
140 | <arg value="up" />
|
---|
141 | <arg value="." />
|
---|
142 | </exec>
|
---|
143 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
144 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
145 | <env key="LANG" value="C" />
|
---|
146 | <arg value="up" />
|
---|
147 | <arg value="../dist/${plugin.jar}" />
|
---|
148 | </exec>
|
---|
149 | </target>
|
---|
150 |
|
---|
151 | <!-- commit the .jar of the plugin -->
|
---|
152 | <target name="commit-dist">
|
---|
153 | <echo>
|
---|
154 | ***** Properties of published ${plugin.jar} *****
|
---|
155 | Commit message : '${commit.message}'
|
---|
156 | Plugin-Mainversion: ${plugin.main.version}
|
---|
157 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
158 | Plugin-Version : ${version.entry.commit.revision}
|
---|
159 | ***** / Properties of published ${plugin.jar} *****
|
---|
160 |
|
---|
161 | Now commiting ${plugin.jar} ...
|
---|
162 | </echo>
|
---|
163 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
164 | <env key="LANG" value="C" />
|
---|
165 | <arg value="-m '${commit.message}'" />
|
---|
166 | <arg value="commit" />
|
---|
167 | <arg value="${plugin.jar}" />
|
---|
168 | </exec>
|
---|
169 | </target>
|
---|
170 |
|
---|
171 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
172 | <target name="ensure-svn-present">
|
---|
173 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
174 | <env key="LANG" value="C" />
|
---|
175 | <arg value="--version" />
|
---|
176 | </exec>
|
---|
177 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
178 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
179 | <condition>
|
---|
180 | <not>
|
---|
181 | <isset property="svn.exit.code" />
|
---|
182 | </not>
|
---|
183 | </condition>
|
---|
184 | </fail>
|
---|
185 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
186 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
187 | <condition>
|
---|
188 | <isfailure code="${svn.exit.code}" />
|
---|
189 | </condition>
|
---|
190 | </fail>
|
---|
191 | </target>
|
---|
192 |
|
---|
193 | <!-- publish the plugin -->
|
---|
194 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
195 | </target>
|
---|
196 | </project>
|
---|