source: osm/applications/editors/josm/plugins/00_plugin_dir_template/build.xml@ 14428

Last change on this file since 14428 was 14428, checked in by guggis, 17 years ago

inital version

File size: 6.8 KB
Line 
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. To check in run
21**
22** > ant publish
23**
24-->
25<project name="myPluginName" default="dist" basedir=".">
26
27
28 <!--
29 ************************************************
30 ** configure these properties. Most of them will be copied to the plugins
31 ** manifest file. Property values will also show up in the list available
32 ** plugins: http://josm.openstreetmap.de/wiki/Plugins.
33 **
34 ************************************************
35 -->
36 <property name="plugin.author" value="Your Name"/>
37 <property name="plugin.class" value="fully.qualified.name.of.your.PluginClass"/>
38 <property name="plugin.description" value="A Short description of your plugin (one line, to be displayed in the JOSMs plugin configuration dialog)"/>
39 <property name="plugin.doc.url" value="http://wiki.openstreetmap.org/index.php/JOSM/Plugins/YourPlugin"/>
40 <property name="plugin.main.version" value="0.1"/>
41 <property name="plugin.jar.name" value="${ant.project.name}.jar"/>
42
43
44 <!--
45 ************************************************
46 ** should not be necessary to change the following properties
47 -->
48 <property name="josm" location="../../core/dist/josm-custom.jar"/>
49 <property name="plugin.build.dir" value="build"/>
50 <property name="plugin.src.dir" value="src"/>
51 <!-- this is the directory where the plugin jar is copied to -->
52 <property name="plugin.dist.dir" value="../../dist"/>
53 <property name="ant.build.javac.target" value="1.5"/>
54 <property name="plugin.dist.dir" value="../../dist"/>
55 <property name="plugin.jar" value="${plugin.dist.dir}/${plugin.jar.name}"/>
56
57 <!--
58 **********************************************************
59 ** init - initializes the build
60 **********************************************************
61 -->
62 <target name="init">
63 <!-- make sure we increment the build number ... -->
64 <buildnumber file="build.number" />
65
66 <!-- ... and check it back in -->
67 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
68 <env key="LANG" value="C"/>
69 <arg value="commit"/>
70 <arg value="--message"/>
71 <arg value="increment build number"/>
72 <arg value="build.number"/>
73 </exec>
74 <mkdir dir="${plugin.build.dir}"/>
75 </target>
76
77 <!--
78 **********************************************************
79 ** compile - complies the source tree
80 **********************************************************
81 -->
82 <target name="compile" depends="init">
83 <echo message="compiling sources for ${plugin.jar.name} ... "/>
84 <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
85 <compilerarg value="-Xlint:deprecation"/>
86 <compilerarg value="-Xlint:unchecked"/>
87 </javac>
88 </target>
89
90 <!--
91 **********************************************************
92 ** dist - creates the plugin jar
93 **********************************************************
94 -->
95 <target name="dist" depends="compile,revision">
96 <echo message="creating ${plugin.jar.name} ... "/>
97 <copy todir="${plugin.build.dir}/resources">
98 <fileset dir="resources"/>
99 </copy>
100 <copy todir="${plugin.build.dir}">
101 <fileset dir=".">
102 <include name="README" />
103 <include name="LICENSE" />
104 </fileset>
105 </copy>
106 <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
107 <manifest>
108 <attribute name="Author" value="${plugin.author}"/>
109 <attribute name="Plugin-Class" value="${plugin.class}"/>
110 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
111 <attribute name="Plugin-Description" value="${plugin.description}"/>
112 <attribute name="Plugin-Link" value="${plugin.doc.url}"/>
113 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
114 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
115 </manifest>
116 </jar>
117 </target>
118
119 <!--
120 **********************************************************
121 ** revision - extracts the current revision number for the
122 ** file build.number and stores it in the XML property
123 ** version.*
124 **********************************************************
125 -->
126 <target name="revision">
127
128 <!-- extract the SVN revision information for file build.number -->
129 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
130 <env key="LANG" value="C"/>
131 <arg value="info"/>
132 <arg value="--xml"/>
133 <arg value="build.number"/>
134 </exec>
135 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
136 <delete file="REVISION"/>
137 </target>
138
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 **********************************************************
151 ** install - install the plugin in your local JOSM installation
152 **********************************************************
153 -->
154 <target name="install" depends="dist">
155 <property environment="env"/>
156 <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
157 <and>
158 <os family="windows"/>
159 </and>
160 </condition>
161 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
162 </target>
163
164 <!--
165 **********************************************************
166 ** publish - publish the plugin jar
167 **********************************************************
168 -->
169 <target name="publish">
170 <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
171 <env key="LANG" value="C"/>
172 <arg value="commit"/>
173 <arg value="--message"/>
174 <arg value="manual build"/>
175 <arg value="${plugin.jar}"/>
176 </exec>
177 </target>
178
179</project>
Note: See TracBrowser for help on using the repository browser.