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