1 | <!--
|
---|
2 | ** This is the build file for the wmsplugin
|
---|
3 | **
|
---|
4 | ** Maintaining versions
|
---|
5 | ** ====================
|
---|
6 | ** see README.template
|
---|
7 | **
|
---|
8 | ** Usage
|
---|
9 | ** =====
|
---|
10 | ** To build it run
|
---|
11 | **
|
---|
12 | ** > ant dist
|
---|
13 | **
|
---|
14 | ** To install the generated plugin locally (in your default plugin directory) run
|
---|
15 | **
|
---|
16 | ** > ant install
|
---|
17 | **
|
---|
18 | ** To build against the core in ../../core, create a correct manifest and deploy to
|
---|
19 | ** SVN, run
|
---|
20 | ** - set the property commit.message
|
---|
21 | ** - set the property plugin.main.version to lowest JOSM release number this
|
---|
22 | ** plugin build is compatible with
|
---|
23 | ** > ant deploy
|
---|
24 | **
|
---|
25 | **
|
---|
26 | -->
|
---|
27 | <project name="wmsplugin" default="dist" basedir=".">
|
---|
28 |
|
---|
29 |
|
---|
30 | <property name="commit.message" value="add commit message" />
|
---|
31 | <property name="plugin.main.version" value="2830" />
|
---|
32 |
|
---|
33 |
|
---|
34 | <property name="josm" location="../../core/dist/josm-custom.jar" />
|
---|
35 | <property name="plugin.dist.dir" value="../../dist" />
|
---|
36 | <property name="plugin.build.dir" value="build" />
|
---|
37 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar" />
|
---|
38 | <property name="ant.build.javac.target" value="1.5" />
|
---|
39 |
|
---|
40 | <target name="init">
|
---|
41 | <mkdir dir="${plugin.build.dir}" />
|
---|
42 | </target>
|
---|
43 | <target name="compile" depends="init">
|
---|
44 | <echo message="creating ${plugin.jar}" />
|
---|
45 | <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
|
---|
46 | <compilerarg value="-Xlint:deprecation" />
|
---|
47 | <compilerarg value="-Xlint:unchecked" />
|
---|
48 | </javac>
|
---|
49 | </target>
|
---|
50 | <target name="dist" depends="compile,revision">
|
---|
51 | <echo message="building ${plugin.jar} with version ${version.entry.commit.revision} for JOSM version ${josm.reference.release} " />
|
---|
52 | <copy todir="${plugin.build.dir}/images">
|
---|
53 | <fileset dir="images" />
|
---|
54 | </copy>
|
---|
55 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
56 | <manifest>
|
---|
57 | <attribute name="Author" value="Tim Waters, Petr Dlouhý" />
|
---|
58 | <attribute name="Plugin-Class" value="wmsplugin.WMSPlugin" />
|
---|
59 | <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
|
---|
60 | <attribute name="Plugin-Description" value="Display georeferenced images as background in JOSM (WMS servers, Yahoo, ...)." />
|
---|
61 | <attribute name="Plugin-Icon" value="images/wms.png"/>
|
---|
62 | <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WMSPlugin" />
|
---|
63 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
|
---|
64 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
|
---|
65 | <attribute name="de_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/DE:JOSM/Plugins/WMSPlugin" />
|
---|
66 | <attribute name="ja_Plugin-Link" value="http://wiki.openstreetmap.org/wiki/Ja:JOSM/Plugins/WMSPlugin?uselang=ja" />
|
---|
67 | </manifest>
|
---|
68 | </jar>
|
---|
69 | </target>
|
---|
70 | <target name="revision">
|
---|
71 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="true" failonerror="true">
|
---|
72 | <env key="LANG" value="C" />
|
---|
73 | <arg value="info" />
|
---|
74 | <arg value="--xml" />
|
---|
75 | <arg value="." />
|
---|
76 | </exec>
|
---|
77 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
|
---|
78 | <delete file="REVISION" />
|
---|
79 | </target>
|
---|
80 | <target name="clean">
|
---|
81 | <delete dir="${plugin.build.dir}" />
|
---|
82 | <delete file="${plugin.jar}" />
|
---|
83 | </target>
|
---|
84 | <target name="install" depends="dist">
|
---|
85 | <property environment="env" />
|
---|
86 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
87 | <and>
|
---|
88 | <os family="windows" />
|
---|
89 | </and>
|
---|
90 | </condition>
|
---|
91 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
|
---|
92 | </target>
|
---|
93 |
|
---|
94 | <!--
|
---|
95 | ************************** Publishing the plugin ***********************************
|
---|
96 | -->
|
---|
97 | <!--
|
---|
98 | ** extracts the JOSM release for the JOSM version in ../core and saves it in the
|
---|
99 | ** property ${coreversion.info.entry.revision}
|
---|
100 | **
|
---|
101 | -->
|
---|
102 | <target name="core-info">
|
---|
103 | <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
|
---|
104 | <env key="LANG" value="C" />
|
---|
105 | <arg value="info" />
|
---|
106 | <arg value="--xml" />
|
---|
107 | <arg value="../../core" />
|
---|
108 | </exec>
|
---|
109 | <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
|
---|
110 | <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
|
---|
111 | <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
|
---|
112 | <delete file="core.info.xml" />
|
---|
113 | </target>
|
---|
114 |
|
---|
115 | <!--
|
---|
116 | ** commits the source tree for this plugin
|
---|
117 | -->
|
---|
118 | <target name="commit-current">
|
---|
119 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
120 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="true" failonerror="true">
|
---|
121 | <env key="LANG" value="C" />
|
---|
122 | <arg value="commit" />
|
---|
123 | <arg value="-m '${commit.message}'" />
|
---|
124 | <arg value="." />
|
---|
125 | </exec>
|
---|
126 | </target>
|
---|
127 |
|
---|
128 | <!--
|
---|
129 | ** updates (svn up) the source tree for this plugin
|
---|
130 | -->
|
---|
131 | <target name="update-current">
|
---|
132 | <echo>Updating plugin source ...</echo>
|
---|
133 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="true" failonerror="true">
|
---|
134 | <env key="LANG" value="C" />
|
---|
135 | <arg value="up" />
|
---|
136 | <arg value="." />
|
---|
137 | </exec>
|
---|
138 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
139 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="true" failonerror="true">
|
---|
140 | <env key="LANG" value="C" />
|
---|
141 | <arg value="up" />
|
---|
142 | <arg value="../dist/${plugin.jar}" />
|
---|
143 | </exec>
|
---|
144 | </target>
|
---|
145 |
|
---|
146 | <!--
|
---|
147 | ** commits the plugin.jar
|
---|
148 | -->
|
---|
149 | <target name="commit-dist">
|
---|
150 | <echo>
|
---|
151 | ***** Properties of published ${plugin.jar} *****
|
---|
152 | Commit message : '${commit.message}'
|
---|
153 | Plugin-Mainversion: ${plugin.main.version}
|
---|
154 | JOSM build version: ${coreversion.info.entry.revision}
|
---|
155 | Plugin-Version : ${version.entry.commit.revision}
|
---|
156 | ***** / Properties of published ${plugin.jar} *****
|
---|
157 |
|
---|
158 | Now commiting ${plugin.jar} ...
|
---|
159 | </echo>
|
---|
160 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="true" failonerror="true">
|
---|
161 | <env key="LANG" value="C" />
|
---|
162 | <arg value="-m '${commit.message}'" />
|
---|
163 | <arg value="commit" />
|
---|
164 | <arg value="${plugin.jar}" />
|
---|
165 | </exec>
|
---|
166 | </target>
|
---|
167 |
|
---|
168 |
|
---|
169 | <!-- ** make sure svn is present as a command line tool ** -->
|
---|
170 | <target name="ensure-svn-present">
|
---|
171 | <exec append="true" output="svn.log" executable="svn" failonerror="false" resultproperty="svn.exit.code">
|
---|
172 | <env key="LANG" value="C" />
|
---|
173 | <arg value="--version" />
|
---|
174 | </exec>
|
---|
175 | <fail message="Fatal: command 'svn' not found. Please make sure svn is installed on your system.">
|
---|
176 | <condition>
|
---|
177 | <isfailure code="${svn.exit.code}" />
|
---|
178 | </condition>
|
---|
179 | </fail>
|
---|
180 | </target>
|
---|
181 |
|
---|
182 | <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
|
---|
183 | </target>
|
---|
184 | </project>
|
---|