1 | <!--
|
---|
2 | ** To build it run
|
---|
3 | **
|
---|
4 | ** > ant dist
|
---|
5 | **
|
---|
6 | ** To install the generated plugin locally (in you default plugin directory) run
|
---|
7 | **
|
---|
8 | ** > ant install
|
---|
9 | -->
|
---|
10 | <project name="wms-turbo-challenge2" default="dist" basedir=".">
|
---|
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="ant.build.javac.target" value="1.5"/>
|
---|
16 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
17 | <property name="plugin.jar" value="${plugin.dist.dir}/${ant.project.name}.jar"/>
|
---|
18 | <property name="wmsplugin" location="${plugin.dist.dir}/wmsplugin.jar:${user.home}/.josm/plugins/wmsplugin.jar"/>
|
---|
19 |
|
---|
20 | <!--
|
---|
21 | **********************************************************
|
---|
22 | ** init - initializes the build
|
---|
23 | **********************************************************
|
---|
24 | -->
|
---|
25 | <target name="init">
|
---|
26 | <mkdir dir="${plugin.build.dir}"/>
|
---|
27 | </target>
|
---|
28 |
|
---|
29 | <!--
|
---|
30 | **********************************************************
|
---|
31 | ** compile - compiles the source tree
|
---|
32 | **********************************************************
|
---|
33 | -->
|
---|
34 | <target name="compile" depends="init">
|
---|
35 | <echo message="compiling sources for ${plugin.jar} ... "/>
|
---|
36 | <javac srcdir="src" classpath="${josm}:${wmsplugin}" debug="true" destdir="${plugin.build.dir}">
|
---|
37 | <compilerarg value="-Xlint:deprecation"/>
|
---|
38 | <compilerarg value="-Xlint:unchecked"/>
|
---|
39 | </javac>
|
---|
40 | </target>
|
---|
41 |
|
---|
42 | <!--
|
---|
43 | **********************************************************
|
---|
44 | ** dist - creates the plugin jar
|
---|
45 | **********************************************************
|
---|
46 | -->
|
---|
47 | <target name="dist" depends="compile,revision">
|
---|
48 | <echo message="creating ${plugin.jar.name} ... "/>
|
---|
49 | <copy todir="${plugin.build.dir}/resources">
|
---|
50 | <fileset dir="resources"/>
|
---|
51 | </copy>
|
---|
52 | <copy todir="${plugin.build.dir}/images">
|
---|
53 | <fileset dir="images"/>
|
---|
54 | </copy>
|
---|
55 | <copy todir="${plugin.build.dir}">
|
---|
56 | <fileset dir=".">
|
---|
57 | <include name="README" />
|
---|
58 | <include name="LICENSE" />
|
---|
59 | </fileset>
|
---|
60 | </copy>
|
---|
61 | <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
|
---|
62 | <manifest>
|
---|
63 | <attribute name="Author" value="Andrzej Zaborowski"/>
|
---|
64 | <attribute name="Plugin-Class" value="wmsturbochallenge.WMSRacer"/>
|
---|
65 | <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
|
---|
66 | <attribute name="Plugin-Description" value="Drive a race car from point A to point B over aerial imagery, leave cacti behind."/>
|
---|
67 | <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/WMS_Racer"/>
|
---|
68 | <attribute name="Plugin-Mainversion" value="3096"/>
|
---|
69 | <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
|
---|
70 | </manifest>
|
---|
71 | </jar>
|
---|
72 | </target>
|
---|
73 |
|
---|
74 | <!--
|
---|
75 | **********************************************************
|
---|
76 | ** revision - extracts the current revision number for the
|
---|
77 | ** file build.number and stores it in the XML property
|
---|
78 | ** version.*
|
---|
79 | **********************************************************
|
---|
80 | -->
|
---|
81 | <target name="revision">
|
---|
82 |
|
---|
83 | <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
|
---|
84 | <env key="LANG" value="C"/>
|
---|
85 | <arg value="info"/>
|
---|
86 | <arg value="--xml"/>
|
---|
87 | <arg value="."/>
|
---|
88 | </exec>
|
---|
89 | <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
|
---|
90 | <delete file="REVISION"/>
|
---|
91 | </target>
|
---|
92 |
|
---|
93 | <!--
|
---|
94 | **********************************************************
|
---|
95 | ** clean - clean up the build environment
|
---|
96 | **********************************************************
|
---|
97 | -->
|
---|
98 | <target name="clean">
|
---|
99 | <delete dir="${plugin.build.dir}"/>
|
---|
100 | <delete file="${plugin.jar}"/>
|
---|
101 | </target>
|
---|
102 |
|
---|
103 | <!--
|
---|
104 | **********************************************************
|
---|
105 | ** install - install the plugin in your local JOSM installation
|
---|
106 | **********************************************************
|
---|
107 | -->
|
---|
108 | <target name="install" depends="dist">
|
---|
109 | <property environment="env"/>
|
---|
110 | <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
|
---|
111 | <and>
|
---|
112 | <os family="windows"/>
|
---|
113 | </and>
|
---|
114 | </condition>
|
---|
115 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
116 | </target>
|
---|
117 | </project>
|
---|