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