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