source: osm/applications/editors/josm/plugins/opendata/modules/fr.lemans/build.xml@ 28087

Last change on this file since 28087 was 28087, checked in by donvip, 12 years ago

opendata: initial support of Le Mans data

File size: 9.8 KB
Line 
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3** This is a template build file for a module of the JOSM opendata plugin.
4**
5** Usage
6** =====
7** To build it run
8**
9** > ant dist
10**
11** To install the generated module locally (in you default opendata modules directory) run
12**
13** > ant install
14**
15** The generated module jar is not automatically available in JOSMs opendata plugin configuration
16** dialog. You have to check it in first.
17**
18** Use the ant target 'publish' to check in the module and make it available to other
19** JOSM users:
20** set the property commit.message
21** and run
22** > ant publish
23**
24-->
25<project name="fr.lemans" default="dist" basedir=".">
26 <!-- enter the SVN commit message -->
27 <property name="commit.message" value="Commit message"/>
28 <!-- should not be necessary to change the following properties -->
29 <property name="josm" location="../../../../core/dist/josm-custom.jar"/>
30 <property name="plugin.dist.dir" value="../../../../dist"/>
31 <property name="opendata" location="${plugin.dist.dir}/opendata.jar"/>
32 <property name="module.build.dir" value="build"/>
33 <property name="module.src.dir" value="src"/>
34 <property name="ant.build.javac.source" value="1.6"/>
35 <property name="ant.build.javac.target" value="1.6"/>
36 <!-- this is the directory where the module jar is copied to -->
37 <property name="module.dist.dir" value="../../dist"/>
38 <property name="module.jar" value="${module.dist.dir}/${ant.project.name}.jar"/>
39 <!-- conditions -->
40 <condition property="resources.exist">
41 <available file="resources" type="dir" />
42 </condition>
43 <condition property="images.exist">
44 <available file="images" type="dir" />
45 </condition>
46 <!--
47 **********************************************************
48 ** init - initializes the build
49 **********************************************************
50 -->
51 <target name="init">
52 <mkdir dir="${module.build.dir}"/>
53 <mkdir dir="${module.build.dir}/META-INF"/>
54 </target>
55 <!--
56 **********************************************************
57 ** compile - compiles the source tree
58 **********************************************************
59 -->
60 <target name="compile" depends="init">
61 <echo message="compiling sources for ${module.jar} ... "/>
62 <javac srcdir="${module.src.dir}" debug="true" destdir="${module.build.dir}" includeAntRuntime="false">
63 <classpath>
64 <pathelement location="${josm}"/>
65 <pathelement location="${opendata}"/>
66 </classpath>
67 <compilerarg value="-Xlint:deprecation"/>
68 <compilerarg value="-Xlint:unchecked"/>
69 </javac>
70 </target>
71 <!--
72 **********************************************************
73 ** copy-resources - copies resources dir to build dir
74 **********************************************************
75 -->
76 <target name="copy-resources" if="resources.exist">
77 <copy todir="${module.build.dir}">
78 <fileset dir="resources" />
79 </copy>
80 </target>
81 <!--
82 **********************************************************
83 ** copy-images - copies images dir to build dir
84 **********************************************************
85 -->
86 <target name="copy-images" if="images.exist">
87 <copy todir="${module.build.dir}/images">
88 <fileset dir="images" />
89 </copy>
90 </target>
91 <!--
92 **********************************************************
93 ** dist - creates the module jar
94 **********************************************************
95 -->
96 <target name="dist" depends="compile,revision,copy-resources, copy-images">
97 <echo message="creating ${ant.project.name}.jar ... "/>
98 <copy todir="${module.build.dir}">
99 <fileset dir=".">
100 <include name="README"/>
101 <include name="gpl-3.0.txt"/>
102 </fileset>
103 </copy>
104 <jar destfile="${module.jar}" basedir="${module.build.dir}">
105 <!--
106 ************************************************
107 ** configure these properties. Most of them will
108 ** be copied to the module manifest file.
109 **
110 ************************************************
111 -->
112 <manifest>
113 <attribute name="Author" value="Don-vip"/>
114 <attribute name="Module-Class" value="org.openstreetmap.josm.plugins.opendata.modules.fr.lemans.LeMansModule"/>
115 <attribute name="Module-Date" value="${version.entry.commit.date}"/>
116 <attribute name="Module-Description" value="Informations publiques du Mans Métropole."/>
117 <!--<attribute name="Module-Icon" value="images/dialogs/your_image_of_24_px.png"/>
118 <attribute name="Module-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/OpenData/YourModule"/>-->
119 <attribute name="Module-Version" value="${version.entry.commit.revision}"/>
120 </manifest>
121 </jar>
122 </target>
123 <!--
124 **********************************************************
125 ** revision - extracts the current revision number for the
126 ** file build.number and stores it in the XML property
127 ** version.*
128 **********************************************************
129 -->
130 <target name="revision">
131 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
132 <env key="LANG" value="C"/>
133 <arg value="info"/>
134 <arg value="--xml"/>
135 <arg value="."/>
136 </exec>
137 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
138 <delete file="REVISION"/>
139 </target>
140 <!--
141 **********************************************************
142 ** clean - clean up the build environment
143 **********************************************************
144 -->
145 <target name="clean">
146 <delete dir="${module.build.dir}"/>
147 <delete file="${module.jar}"/>
148 </target>
149 <!--
150 **********************************************************
151 ** install - install the module in your local JOSM installation
152 **********************************************************
153 -->
154 <target name="install" depends="dist">
155 <property environment="env"/>
156 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
157 <and>
158 <os family="windows"/>
159 </and>
160 </condition>
161 <copy file="${module.jar}" todir="${josm.plugins.dir}/opendata/modules" overwrite="yes"/>
162 </target>
163 <!--
164 ************************** Publishing the module ***********************************
165 -->
166 <!-- commits the source tree for this module -->
167 <target name="commit-current">
168 <echo>Commiting the module source with message '${commit.message}' ...</echo>
169 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
170 <env key="LANG" value="C"/>
171 <arg value="commit"/>
172 <arg value="-m '${commit.message}'"/>
173 <arg value="."/>
174 </exec>
175 </target>
176 <!-- updates (svn up) the source tree for this module -->
177 <target name="update-current">
178 <echo>Updating module source ...</echo>
179 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
180 <env key="LANG" value="C"/>
181 <arg value="up"/>
182 <arg value="."/>
183 </exec>
184 <echo>Updating ${module.jar} ...</echo>
185 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
186 <env key="LANG" value="C"/>
187 <arg value="up"/>
188 <arg value="../dist/${module.jar}"/>
189 </exec>
190 </target>
191 <!-- commits the module.jar -->
192 <target name="commit-dist">
193 <echo>
194 ***** Properties of published ${module.jar} *****
195 Commit message : '${commit.message}'
196 Module-Version : ${version.entry.commit.revision}
197 ***** / Properties of published ${module.jar} *****
198
199 Now commiting ${module.jar} ...
200 </echo>
201 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
202 <env key="LANG" value="C"/>
203 <arg value="-m '${commit.message}'"/>
204 <arg value="commit"/>
205 <arg value="${module.jar}"/>
206 </exec>
207 </target>
208 <!-- make sure svn is present as a command line tool -->
209 <target name="ensure-svn-present">
210 <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
211 <env key="LANG" value="C"/>
212 <arg value="--version"/>
213 </exec>
214 <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
215 <!-- return code not set at all? Most likely svn isn't installed -->
216 <condition>
217 <not>
218 <isset property="svn.exit.code"/>
219 </not>
220 </condition>
221 </fail>
222 <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
223 <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
224 <condition>
225 <isfailure code="${svn.exit.code}"/>
226 </condition>
227 </fail>
228 </target>
229 <target name="publish" depends="ensure-svn-present,commit-current,update-current,clean,dist,commit-dist">
230 </target>
231</project>
Note: See TracBrowser for help on using the repository browser.