source: osm/applications/editors/josm/plugins/opendata/modules/fr.paca/build.xml@ 31940

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