1 | <?xml version="1.0" encoding="utf-8"?>
|
---|
2 | <!--
|
---|
3 | ** This is a template build file for a JOSM plugin.
|
---|
4 | **
|
---|
5 | ** Maintaining versions
|
---|
6 | ** ====================
|
---|
7 | ** see README.template
|
---|
8 | **
|
---|
9 | ** Usage
|
---|
10 | ** =====
|
---|
11 | ** To build it run
|
---|
12 | **
|
---|
13 | ** > ant dist
|
---|
14 | **
|
---|
15 | ** To install the generated plugin locally (in you default plugin directory) run
|
---|
16 | **
|
---|
17 | ** > ant install
|
---|
18 | **
|
---|
19 | ** The generated plugin jar is not automatically available in JOSMs plugin configuration
|
---|
20 | ** dialog. You have to check it in first.
|
---|
21 | **
|
---|
22 | ** Use the ant target 'publish' to check in the plugin and make it available to other
|
---|
23 | ** JOSM users:
|
---|
24 | ** set the properties commit.message and plugin.main.version
|
---|
25 | ** and run
|
---|
26 | ** > ant publish
|
---|
27 | **
|
---|
28 | **
|
---|
29 | -->
|
---|
30 | <project name="smed" basedir=".">
|
---|
31 | <!-- enter the SVN commit message -->
|
---|
32 | <property name="commit.message" value="some new internationalized messages"/>
|
---|
33 | <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
|
---|
34 | <property name="plugin.main.version" value="3835"/>
|
---|
35 | <!--
|
---|
36 | ************************************************
|
---|
37 | ** should not be necessary to change the following properties
|
---|
38 | -->
|
---|
39 | <property name="josm" location="../../core/dist/josm-custom.jar"/>
|
---|
40 | <property name="plugin.build.dir" value="build/"/>
|
---|
41 | <property name="plugin.src.dir" value="src/"/>
|
---|
42 | <property name="smed.dist.dir" value="dist/"/>
|
---|
43 | <!-- this is the directory where the plugin jar is copied to -->
|
---|
44 | <property name="plugin.dist.dir" value="../../dist/"/>
|
---|
45 | <property name="smed_core.dist.dir" value="core/dist/"/>
|
---|
46 | <property name="ant.build.javac.target" value="1.5"/>
|
---|
47 | <property name="plugin.jar" value="${plugin.dist.dir}${ant.project.name}.jar"/>
|
---|
48 | <!--
|
---|
49 | **********************************************************
|
---|
50 | ** init - initializes the build
|
---|
51 | **********************************************************
|
---|
52 | -->
|
---|
53 | <target name="init">
|
---|
54 | <mkdir dir="${plugin.build.dir}"/>
|
---|
55 | <mkdir dir="${smed_core.dist.dir}"/>
|
---|
56 | <mkdir dir="${smed.dist.dir}"/>
|
---|
57 | </target>
|
---|
58 | <!--
|
---|
59 | **********************************************************
|
---|
60 | ** compile - complies the source tree
|
---|
61 | **********************************************************
|
---|
62 | -->
|
---|
63 | <target name="compile" depends="init">
|
---|
64 | <echo message="compiling sources for ${plugin.jar} ... "/>
|
---|
65 | <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
|
---|
66 | <compilerarg value="-Xlint:deprecation"/>
|
---|
67 | <compilerarg value="-Xlint:unchecked"/>
|
---|
68 | </javac>
|
---|
69 | </target>
|
---|
70 | <!--
|
---|
71 | **********************************************************
|
---|
72 | ** dist - creates the plugin jar
|
---|
73 | **********************************************************
|
---|
74 | -->
|
---|
75 | <target name="dist" depends="compile, revision">
|
---|
76 | <echo message="creating ${ant.project.name}.jar ... "/>
|
---|
77 | <copy todir="${plugin.build.dir}/images">
|
---|
78 | <fileset dir="images"/>
|
---|
79 | </copy>
|
---|
80 | <copy todir="${plugin.build.dir}/data">
|
---|
81 | <fileset dir="data"/>
|
---|
82 | </copy>
|
---|
83 | <copy todir="${plugin.build.dir}/smed/msg">
|
---|
84 | <fileset dir="${plugin.src.dir}/smed/msg"/>
|
---|
85 | </copy>
|
---|
86 | <copy todir="${plugin.build.dir}">
|
---|
87 | <fileset dir="${smed.dist.dir}"/>
|
---|
88 | </copy>
|
---|
89 | <copy todir="${plugin.build.dir}">
|
---|
90 | <fileset dir=".">
|
---|
91 | <include name="*.txt"/>
|
---|
92 | </fileset>
|
---|
93 | </copy>
|
---|
94 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
95 | <!--
|
---|
96 | ************************************************
|
---|
97 | ** configure these properties. Most of them will be copied to the plugins
|
---|
98 | ** manifest file. Property values will also show up in the list available
|
---|
99 | ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
|
---|
100 | **
|
---|
101 | ************************************************
|
---|
102 | -->
|
---|
103 | <manifest>
|
---|
104 | <attribute name="Author" value="Werner, Malcolm"/>
|
---|
105 | <attribute name="Plugin-Class" value="smed.Smed"/>
|
---|
106 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
107 | <attribute name="Plugin-Description" value="Create and edit seamaps for OpenSeaMap"/>
|
---|
108 | <attribute name="Plugin-Icon" value="images/Smed.png"/>
|
---|
109 | <attribute name="Plugin-Link" value="http://openseamap.org/"/>
|
---|
110 | <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
|
---|
111 | <!--
|
---|
112 | <attribute name="Plugin-Version" value="23456"/>
|
---|
113 | -->
|
---|
114 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
115 | </manifest>
|
---|
116 | </jar>
|
---|
117 | <!-- install interface -->
|
---|
118 | <copy file="${plugin.jar}" todir="${smed_core.dist.dir}"/>
|
---|
119 | </target>
|
---|
120 | <!--
|
---|
121 | **********************************************************
|
---|
122 | ** revision - extracts the current revision number for the
|
---|
123 | ** file build.number and stores it in the XML property
|
---|
124 | ** version.*
|
---|
125 | **********************************************************
|
---|
126 | -->
|
---|
127 | <target name="revision">
|
---|
128 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
129 | <env key="LANG" value="C"/>
|
---|
130 | <arg value="info"/>
|
---|
131 | <arg value="--xml"/>
|
---|
132 | <arg value="."/>
|
---|
133 | </exec>
|
---|
134 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
135 | <!--
|
---|
136 | <delete file="REVISION"/>
|
---|
137 | -->
|
---|
138 | </target>
|
---|
139 | <!--
|
---|
140 | **********************************************************
|
---|
141 | ** clean - clean up the build environment
|
---|
142 | **********************************************************
|
---|
143 | -->
|
---|
144 | <target name="clean">
|
---|
145 | <delete dir="${plugin.build.dir}"/>
|
---|
146 | <delete file="${plugin.jar}"/>
|
---|
147 | </target>
|
---|
148 | <!--
|
---|
149 | **********************************************************
|
---|
150 | ** install - install the plugin in your local JOSM installation
|
---|
151 | **********************************************************
|
---|
152 | -->
|
---|
153 | <target name="install" depends="dist">
|
---|
154 | <property environment="env"/>
|
---|
155 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
156 | <and>
|
---|
157 | <os family="windows"/>
|
---|
158 | </and>
|
---|
159 | </condition>
|
---|
160 | <delete dir="${josm.plugins.dir}/splug"/>
|
---|
161 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
162 | </target>
|
---|
163 | <!--
|
---|
164 | ** commits the source tree for this plugin
|
---|
165 | -->
|
---|
166 | <target name="commit-current">
|
---|
167 | <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
|
---|
168 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
169 | <env key="LANG" value="C"/>
|
---|
170 | <arg value="commit"/>
|
---|
171 | <arg value="-m '${commit.message}'"/>
|
---|
172 | <arg value="."/>
|
---|
173 | </exec>
|
---|
174 | </target>
|
---|
175 | <!--
|
---|
176 | ** updates (svn up) the source tree for this plugin
|
---|
177 | -->
|
---|
178 | <target name="update-current">
|
---|
179 | <echo>Updating plugin source ...</echo>
|
---|
180 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
181 | <env key="LANG" value="C"/>
|
---|
182 | <arg value="up"/>
|
---|
183 | <arg value="."/>
|
---|
184 | </exec>
|
---|
185 | <echo>Updating ${plugin.jar} ...</echo>
|
---|
186 | <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
|
---|
187 | <env key="LANG" value="C"/>
|
---|
188 | <arg value="up"/>
|
---|
189 | <arg value="../dist/${plugin.jar}"/>
|
---|
190 | </exec>
|
---|
191 | </target>
|
---|
192 | </project>
|
---|