source: subversion/applications/editors/josm/plugins/openvisible/build.xml @ 5418

Last change on this file since 5418 was 5418, checked in by ulf, 12 years ago

change the install target, so it uses the right home dir even on windows

File size: 5.2 KB
Line 
1<project name="openvisible" 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="plugin.build.dir" value="build"/>
15  <property name="plugin.dist.dir" value="../dist"/>
16  <property name="plugin.name" value="${ant.project.name}"/>
17  <property name="plugin.jar" value="../dist/${plugin.name}.jar"/>
18 
19  <!-- plugin meta data (enter new version number if anything changed!) -->
20  <property name="plugin.version" value="0.2.1"/>
21  <property name="plugin.description" value="Allows opening gpx/osm files that intersect the currently visible screen area (V${plugin.version})."/>
22  <property name="plugin.stage" value="50"/>
23  <property name="plugin.class" value="at.dallermassl.josm.plugin.openvisible.OpenVisiblePlugin"/>
24 
25  <!-- update site meta data -->
26  <property name="plugin.site.file" value="josm-site.xml"/>
27  <property name="plugin.site.description" value="Josm's OpenVisible Update Site"/>
28  <property name="plugin.site.url" value="http://www.tegmento.org/~cdaller/josm/${ant.project.name}/"/>
29  <property name="plugin.site.upload.target" value="cdaller@www.tegmento.org:public_html/josm/${ant.project.name}/"/>
30
31  <property name="ant.build.javac.target" value="1.5"/>
32 
33
34  <target name="dist" depends="compile,site">
35    <!-- images -->
36    <copy todir="${plugin.build.dir}/images">
37      <fileset dir="images" />
38    </copy>
39    <!-- copy configuration xml files
40         <copy todir="${plugin.build.dir}">
41           <fileset dir="src">
42             <include name="*.xml"/>
43           </fileset>
44         </copy>
45         -->
46   
47    <mkdir dir="dist"/>
48   
49    <!-- create jar file -->
50    <jar destfile="${plugin.dist.dir}/${plugin.jar}" basedir="${plugin.build.dir}">
51      <manifest>
52        <attribute name="Plugin-Class" value="${plugin.class}" />
53        <attribute name="Plugin-Description" value="${plugin.description}" />
54        <attribute name="Plugin-Version" value="${plugin.version}" />
55        <attribute name="Plugin-Dependencies" value="jgrapht-jdk1.5" />
56        <attribute name="Plugin-Stage" value="${plugin.stage}" />
57      </manifest>
58    </jar>
59  </target>
60
61  <target name="compile" depends="init">
62    <mkdir dir="${plugin.build.dir}"/>
63    <javac srcdir="src" destdir="${plugin.build.dir}" debug="true" source="1.5" target="1.5">
64      <classpath>
65        <pathelement path="${josm.build.dir}/build"/>
66        <fileset dir="${josm.build.dir}/lib">
67          <include name="**/*.jar"/>
68        </fileset>
69        <!--
70            <fileset dir="lib">
71              <include name="**/*.jar"/>
72            </fileset>
73            -->
74      </classpath>
75    </javac>
76  </target>
77
78  <target name="install" depends="dist">
79    <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
80    <!--
81        <copy todir="${josm.home.dir}/plugins">
82          <fileset dir="lib">
83            <include name="**/*.jar"/>
84          </fileset>
85        </copy>
86        -->
87  </target>
88
89  <target name="init">
90    <echo>java version: ${java.version}</echo>
91  </target>
92
93  <!-- write site description for the given plugin so josm will accept it -->
94  <target name="site">
95    <echo message="creating site description in ${plugin.site.file}"/>
96    <echo file="${plugin.site.file}">&lt;!-- plugins available on this site -->
97  &lt;plugins>
98  &lt;plugin id="${ant.project.name}" version="${plugin.version}">
99  &lt;name>${ant.project.name}&lt;/name>
100  &lt;description>${plugin.description}&lt;/description>
101  &lt;resource>${plugin.site.url}${plugin.jar}&lt;/resource>
102  &lt;/plugin>
103  &lt;/plugins>
104</echo>
105</target>
106
107<!-- write site description for the given plugin (not implemented in JOSM as full version yet!) -->
108<target name="site-full-donotuse">
109  <echo message="creating site description in ${plugin.site.file}"/>
110  <echo file="${plugin.site.file}">&lt;?xml version="1.0"?>
111    &lt;site version="1.0">
112    &lt;!-- meta data of site -->
113&lt;site-info>
114&lt;site-name>${plugin.site.description}&lt;/site-name>
115&lt;site-url>${plugin.site.url}&lt;/site-url>
116&lt;/site-info>
117
118&lt;!-- plugins available on this site -->
119&lt;plugins>
120&lt;plugin id="${ant.project.name}" version="${plugin.version}">
121&lt;name>${ant.project.name}&lt;/name>
122&lt;description>${plugin.description}&lt;/description>
123&lt;resources>
124&lt;resource src="${plugin.site.url}${plugin.jar}"
125target="${josm.home.dir}/plugins/${plugin.jar}"/>
126&lt;/resources>
127&lt;/plugin>
128&lt;/plugins>
129&lt;/site>
130</echo>
131</target>
132
133
134<!-- upload the site description and the jar file via ssh -->
135<target name="upload" depends="dist,site">
136  <echo message="uploading jar and site description to ${plugin.site.upload.target}"/>
137  <exec executable="scp">
138    <arg value="${plugin.dist.dir}/${plugin.jar}"/>
139    <arg value="${plugin.site.file}"/>
140    <arg value="${plugin.site.upload.target}"/>
141  </exec>
142</target>
143
144<target name="clean">
145  <delete dir="${plugin.build.dir}" />
146  <delete dir="${plugin.site.file}" />
147  <delete file="${plugin.jar}" />
148</target>
149
150</project>
Note: See TracBrowser for help on using the repository browser.