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="10407"/>
|
---|
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}" manifestencoding="UTF-8">
|
---|
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: https://josm.openstreetmap.de/wiki/Plugins.
|
---|
67 | **
|
---|
68 | ************************************************
|
---|
69 | -->
|
---|
70 | <manifest>
|
---|
71 | <attribute name="Author" value="Dieter Muecke"/>
|
---|
72 | <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.dataimport.DataImportPlugin"/>
|
---|
73 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
74 | <attribute name="Plugin-Description" value="Allows to import various file formats into JOSM directly. Currently supported: TangoGPS, Garmin Trainings Center TCX."/>
|
---|
75 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
76 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
77 | </manifest>
|
---|
78 | </jar>
|
---|
79 | </target>
|
---|
80 | <!--
|
---|
81 | **********************************************************
|
---|
82 | ** revision - extracts the current revision number for the
|
---|
83 | ** file build.number and stores it in the XML property
|
---|
84 | ** version.*
|
---|
85 | **********************************************************
|
---|
86 | -->
|
---|
87 | <target name="revision">
|
---|
88 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
89 | <env key="LANG" value="C"/>
|
---|
90 | <arg value="info"/>
|
---|
91 | <arg value="--xml"/>
|
---|
92 | <arg value="."/>
|
---|
93 | </exec>
|
---|
94 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
95 | <delete file="REVISION"/>
|
---|
96 | </target>
|
---|
97 | <!--
|
---|
98 | **********************************************************
|
---|
99 | ** clean - clean up the build environment
|
---|
100 | **********************************************************
|
---|
101 | -->
|
---|
102 | <target name="clean">
|
---|
103 | <delete dir="${plugin.build.dir}"/>
|
---|
104 | <delete file="${plugin.jar}"/>
|
---|
105 | </target>
|
---|
106 | <!--
|
---|
107 | **********************************************************
|
---|
108 | ** install - install the plugin in your local JOSM installation
|
---|
109 | **********************************************************
|
---|
110 | -->
|
---|
111 | <target name="install" depends="dist">
|
---|
112 | <property environment="env"/>
|
---|
113 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
114 | <and>
|
---|
115 | <os family="windows"/>
|
---|
116 | </and>
|
---|
117 | </condition>
|
---|
118 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
119 | </target>
|
---|
120 | <!--
|
---|
121 | ************************** Publishing the plugin ***********************************
|
---|
122 | -->
|
---|
123 | <!--
|
---|
124 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
125 | ** property ${coreversion.info.entry.revision}
|
---|
126 | **
|
---|
127 | -->
|
---|
128 | <target name="core-info">
|
---|
129 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
130 | <env key="LANG" value="C"/>
|
---|
131 | <arg value="info"/>
|
---|
132 | <arg value="--xml"/>
|
---|
133 | <arg value="../../core"/>
|
---|
134 | </exec>
|
---|
135 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
|
---|
136 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
137 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
138 | <delete file="core.info.xml"/>
|
---|
139 | </target>
|
---|
140 | <!--
|
---|
141 | ** commits the source tree for this plugin
|
---|
142 | -->
|
---|
143 | <target name="commit-current">
|
---|
144 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
145 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
146 | <env key="LANG" value="C"/>
|
---|
147 | <arg value="commit"/>
|
---|
148 | <arg value="-m '${commit.message}'"/>
|
---|
149 | <arg value="."/>
|
---|
150 | </exec>
|
---|
151 | </target>
|
---|
152 | <!--
|
---|
153 | ** updates (svn up) the source tree for this plugin
|
---|
154 | -->
|
---|
155 | <target name="update-current">
|
---|
156 | <echo>Updating plugin source ...</echo>
|
---|
157 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
158 | <env key="LANG" value="C"/>
|
---|
159 | <arg value="up"/>
|
---|
160 | <arg value="."/>
|
---|
161 | </exec>
|
---|
162 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
163 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
164 | <env key="LANG" value="C"/>
|
---|
165 | <arg value="up"/>
|
---|
166 | <arg value="../dist/${plugin.jar}"/>
|
---|
167 | </exec>
|
---|
168 | </target>
|
---|
169 | <!--
|
---|
170 | ** commits the plugin.jar
|
---|
171 | -->
|
---|
172 | <target name="commit-dist">
|
---|
173 | <echo>
|
---|
174 | ***** Properties of published ${plugin.jar} *****
|
---|
175 | Commit message : '${commit.message}'
|
---|
176 | Plugin-Mainversion: ${plugin.main.version}
|
---|
177 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
178 | Plugin-Version : ${version.entry.commit.revision}
|
---|
179 | ***** / Properties of published ${plugin.jar} *****
|
---|
180 |
|
---|
181 | Now commiting ${plugin.jar} ...
|
---|
182 | </echo>
|
---|
183 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
184 | <env key="LANG" value="C"/>
|
---|
185 | <arg value="-m '${commit.message}'"/>
|
---|
186 | <arg value="commit"/>
|
---|
187 | <arg value="${plugin.jar}"/>
|
---|
188 | </exec>
|
---|
189 | </target>
|
---|
190 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
191 | <target name="ensure-svn-present">
|
---|
192 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
|
---|
193 | <env key="LANG" value="C"/>
|
---|
194 | <arg value="--version"/>
|
---|
195 | </exec>
|
---|
196 | <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
|
---|
197 | <!-- return code not set at all? Most likely svn isn't installed -->
|
---|
198 | <condition>
|
---|
199 | <not>
|
---|
200 | <isset property="svn.exit.code"/>
|
---|
201 | </not>
|
---|
202 | </condition>
|
---|
203 | </fail>
|
---|
204 | <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
|
---|
205 | <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
|
---|
206 | <condition>
|
---|
207 | <isfailure code="${svn.exit.code}"/>
|
---|
208 | </condition>
|
---|
209 | </fail>
|
---|
210 | </target>
|
---|
211 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
212 | </target>
|
---|
213 | </project>
|
---|