source: osm/applications/editors/josm/plugins/opendata/modules/fr.paris/build.xml@ 30197

Last change on this file since 30197 was 29935, checked in by donvip, 11 years ago

[josm_opendata] update modules build.xml

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