1 | <project name="openlayers" default="dist" basedir=".">
|
---|
2 |
|
---|
3 | <!-- josm "user home" directory depends on the platform used (windows has a different place than unix/linux) -->
|
---|
4 | <property environment="env"/>
|
---|
5 | <condition property="josm.home.dir" value="${env.APPDATA}/JOSM" else="${user.home}/.josm">
|
---|
6 | <and>
|
---|
7 | <os family="windows"/>
|
---|
8 | </and>
|
---|
9 | </condition>
|
---|
10 |
|
---|
11 | <!-- compilation properties -->
|
---|
12 | <property name="josm.build.dir" value="../../core"/>
|
---|
13 | <property name="josm.plugins.dir" value="${josm.home.dir}/plugins"/>
|
---|
14 | <property name="josm" location="../../core/dist/josm-custom.jar" />
|
---|
15 | <property name="plugin.build.dir" value="build"/>
|
---|
16 | <property name="plugin.dist.dir" value="../../dist"/>
|
---|
17 | <property name="plugin.name" value="${ant.project.name}"/>
|
---|
18 | <property name="plugin.jar" value="../../dist/${plugin.name}.jar"/>
|
---|
19 |
|
---|
20 | <property name="ant.build.javac.target" value="1.5"/>
|
---|
21 |
|
---|
22 | <!-- All jar files needed -->
|
---|
23 | <fileset id="required_libs" dir="lib">
|
---|
24 | <include name="cobra.jar"/>
|
---|
25 | <include name="js.jar"/>
|
---|
26 | <include name="ehcache-1.4.1.jar"/>
|
---|
27 | <include name="backport-util-concurrent-3.0.jar"/> <!-- needed by ehcache -->
|
---|
28 | <include name="commons-logging-1.0.4.jar"/> <!--needed by ehcache -->
|
---|
29 | </fileset>
|
---|
30 |
|
---|
31 | <target name="init">
|
---|
32 | <mkdir dir="build"></mkdir>
|
---|
33 | <mkdir dir="dist"></mkdir>
|
---|
34 | </target>
|
---|
35 |
|
---|
36 | <target name="compile" depends="init">
|
---|
37 | <echo message="creating ${plugin.jar}"/>
|
---|
38 | <javac srcdir="src" debug="true" destdir="build">
|
---|
39 | <classpath>
|
---|
40 | <path path="../../core/dist/josm-custom.jar"/>
|
---|
41 | <fileset refid="required_libs"/>
|
---|
42 | </classpath>
|
---|
43 | </javac>
|
---|
44 | </target>
|
---|
45 |
|
---|
46 | <target name="dist" depends="compile">
|
---|
47 | <!-- jars -->
|
---|
48 | <!-- TODO: instead of adding library code to the plugin jar, JOSM should
|
---|
49 | have some kind of library dir loaded in the classpath -->
|
---|
50 | <unjar dest="build">
|
---|
51 | <fileset refid="required_libs" />
|
---|
52 | </unjar>
|
---|
53 |
|
---|
54 | <!-- images -->
|
---|
55 | <copy todir="build/images">
|
---|
56 | <fileset dir="images" />
|
---|
57 | </copy>
|
---|
58 |
|
---|
59 | <!--resources -->
|
---|
60 | <copy todir="build/resources">
|
---|
61 | <fileset dir="resources" />
|
---|
62 | </copy>
|
---|
63 |
|
---|
64 | <!-- create josm-custom.jar -->
|
---|
65 | <jar destfile="${plugin.jar}" basedir="build">
|
---|
66 | <manifest>
|
---|
67 | <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.openLayers.OpenLayersPlugin" />
|
---|
68 | <attribute name="Plugin-Description" value="Displays an OpenLayers background image" />
|
---|
69 | <attribute name="Class-Path" value="cobra.jar js.jar ehcache-1.4.1.jar commons-logging-1.0.4.jar backport-util-concurrent-3.0.jar" />
|
---|
70 | </manifest>
|
---|
71 | </jar>
|
---|
72 | </target>
|
---|
73 |
|
---|
74 | <target name="clean">
|
---|
75 | <delete dir="${plugin.build.dir}" />
|
---|
76 | <delete file="${plugin.jar}" />
|
---|
77 | </target>
|
---|
78 |
|
---|
79 | <target name="install" depends="dist">
|
---|
80 | <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
|
---|
81 | </target>
|
---|
82 |
|
---|
83 | </project>
|
---|