Changeset 19460 in osm for applications/editors/josm


Ignore:
Timestamp:
2010-01-13T14:58:52+01:00 (15 years ago)
Author:
guggis
Message:

'Changed the constructor signature of the plugin main class'

Location:
applications/editors/josm/plugins/openlayers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/openlayers/build.xml

    r19050 r19460  
     1<?xml version="1.0" encoding="UTF-8"?>
     2<!--
     3** This is the build file for the openlayers 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-->
    130<project name="openlayers" default="dist" basedir=".">
    2     <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
    3     <property name="plugin.dist.dir"        value="../../dist"/>
    4     <property name="plugin.build.dir"       value="build"/>
    5     <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
    6     <property name="ant.build.javac.target" value="1.5"/>
    7     <target name="init">
    8         <mkdir dir="${plugin.build.dir}"/>
    9     </target>
    10     <target name="compile" depends="init">
    11         <echo message="creating ${plugin.jar}"/>
    12         <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
    13             <compilerarg value="-Xlint:deprecation"/>
    14             <compilerarg value="-Xlint:unchecked"/>
    15             <classpath>
    16                 <pathelement location="${josm}"/>
    17                 <fileset dir="lib">
    18                     <include name="**/*.jar"/>
    19                 </fileset>
    20             </classpath>
    21         </javac>
    22     </target>
    23     <target name="dist" depends="compile,revision">
    24         <unjar dest="${plugin.build.dir}">
    25             <fileset dir="lib"/>
    26         </unjar>
    27         <copy todir="${plugin.build.dir}/resources">
    28             <fileset dir="resources"/>
    29         </copy>
    30         <copy todir="${plugin.build.dir}/images">
    31             <fileset dir="images"/>
    32         </copy>
    33         <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
    34             <manifest>
    35                 <attribute name="Author" value="Francisco R. Santos" />
    36                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.openLayers.OpenLayersPlugin" />
    37                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    38                 <attribute name="Plugin-Description" value="Displays an OpenLayers background image" />
    39                 <attribute name="Plugin-Mainversion" value="2620"/>
    40                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
    41             </manifest>
    42         </jar>
    43     </target>
    44     <target name="revision">
    45         <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    46             <env key="LANG" value="C"/>
    47             <arg value="info"/>
    48             <arg value="--xml"/>
    49             <arg value="."/>
    50         </exec>
    51         <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    52         <delete file="REVISION"/>
    53     </target>
    54     <target name="clean">
    55         <delete dir="${plugin.build.dir}"/>
    56         <delete file="${plugin.jar}"/>
    57     </target>
    58     <target name="install" depends="dist">
    59         <property environment="env"/>
    60         <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    61             <and>
    62                 <os family="windows"/>
    63             </and>
    64         </condition>
    65         <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
    66     </target>
     31
     32        <!-- enter the SVN commit message -->
     33        <property name="commit.message" value="Changed the constructor signature of the plugin main class" />
     34        <!-- enter the *lowest* JOSM version this plugin is currently compatible with -->
     35        <property name="plugin.main.version" value="2830" />
     36
     37        <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
     38        <property name="plugin.dist.dir"        value="../../dist"/>
     39        <property name="plugin.build.dir"       value="build"/>
     40        <property name="plugin.jar"             value="${plugin.dist.dir}/${ant.project.name}.jar"/>
     41        <property name="ant.build.javac.target" value="1.5"/>
     42        <target name="init">
     43                <mkdir dir="${plugin.build.dir}"/>
     44        </target>
     45        <target name="compile" depends="init">
     46                <echo message="creating ${plugin.jar}"/>
     47                <javac srcdir="src" debug="true" destdir="${plugin.build.dir}">
     48                        <compilerarg value="-Xlint:deprecation"/>
     49                        <compilerarg value="-Xlint:unchecked"/>
     50                        <classpath>
     51                                <pathelement location="${josm}"/>
     52                                <fileset dir="lib">
     53                                        <include name="**/*.jar"/>
     54                                </fileset>
     55                        </classpath>
     56                </javac>
     57        </target>
     58        <target name="dist" depends="compile,revision">
     59                <unjar dest="${plugin.build.dir}">
     60                        <fileset dir="lib"/>
     61                </unjar>
     62                <copy todir="${plugin.build.dir}/resources">
     63                        <fileset dir="resources"/>
     64                </copy>
     65                <copy todir="${plugin.build.dir}/images">
     66                        <fileset dir="images"/>
     67                </copy>
     68                <jar destfile="${plugin.jar}" basedir="${plugin.build.dir}">
     69                        <manifest>
     70                                <attribute name="Author" value="Francisco R. Santos" />
     71                                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.openLayers.OpenLayersPlugin" />
     72                                <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
     73                                <attribute name="Plugin-Description" value="Displays an OpenLayers background image" />
     74                                <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
     75                                <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
     76                        </manifest>
     77                </jar>
     78        </target>
     79        <target name="revision">
     80                <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
     81                        <env key="LANG" value="C"/>
     82                        <arg value="info"/>
     83                        <arg value="--xml"/>
     84                        <arg value="."/>
     85                </exec>
     86                <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
     87                <delete file="REVISION"/>
     88        </target>
     89        <target name="clean">
     90                <delete dir="${plugin.build.dir}"/>
     91                <delete file="${plugin.jar}"/>
     92        </target>
     93        <target name="install" depends="dist">
     94                <property environment="env"/>
     95                <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
     96                        <and>
     97                                <os family="windows"/>
     98                        </and>
     99                </condition>
     100                <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
     101        </target>
     102
     103        <!--
     104        ************************** Publishing the plugin ***********************************
     105        -->
     106        <!--
     107                ** extracts the JOSM release for the JOSM version in ../core and saves it in the
     108                ** property ${coreversion.info.entry.revision}
     109                **
     110                -->
     111        <target name="core-info">
     112                <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
     113                        <env key="LANG" value="C"/>
     114                        <arg value="info"/>
     115                        <arg value="--xml"/>
     116                        <arg value="../../core"/>
     117                </exec>
     118                <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
     119                <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
     120                <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
     121                <delete file="core.info.xml" />
     122        </target>
     123
     124        <!--
     125                ** commits the source tree for this plugin
     126                -->
     127        <target name="commit-current">
     128                <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
     129                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     130                        <env key="LANG" value="C"/>
     131                        <arg value="commit"/>
     132                        <arg value="-m '${commit.message}'"/>
     133                        <arg value="."/>
     134                </exec>
     135        </target>
     136
     137        <!--
     138                ** updates (svn up) the source tree for this plugin
     139                -->
     140        <target name="update-current">
     141                <echo>Updating plugin source ...</echo>
     142                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     143                        <env key="LANG" value="C"/>
     144                        <arg value="up"/>
     145                        <arg value="."/>
     146                </exec>
     147                <echo>Updating ${plugin.jar} ...</echo>
     148                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     149                        <env key="LANG" value="C"/>
     150                        <arg value="up"/>
     151                        <arg value="../dist/${plugin.jar}"/>
     152                </exec>
     153        </target>
     154
     155        <!--
     156                ** commits the plugin.jar
     157                -->
     158        <target name="commit-dist">
     159                <echo>
     160        ***** Properties of published ${plugin.jar} *****
     161        Commit message    : '${commit.message}'                                 
     162        Plugin-Mainversion: ${plugin.main.version}
     163        JOSM build version: ${coreversion.info.entry.revision}
     164        Plugin-Version    : ${version.entry.commit.revision}
     165        ***** / Properties of published ${plugin.jar} *****                                     
     166                                               
     167        Now commiting ${plugin.jar} ...
     168        </echo>
     169                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
     170                        <env key="LANG" value="C"/>
     171                        <arg value="-m '${commit.message}'"/>
     172                        <arg value="commit"/>
     173                        <arg value="${plugin.jar}"/>
     174                </exec>
     175        </target>
     176
     177        <!-- ** make sure svn is present as a command line tool ** -->
     178        <target name="ensure-svn-present">
     179                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false" failonerror="false" resultproperty="svn.exit.code">
     180                        <env key="LANG" value="C" />
     181                        <arg value="--version" />
     182                </exec>
     183                <fail message="Fatal: command 'svn --version' failed. Please make sure svn is installed on your system.">
     184                        <!-- return code not set at all? Most likely svn isn't installed -->
     185                        <condition>
     186                                <not>
     187                                        <isset property="svn.exit.code" />
     188                                </not>
     189                        </condition>
     190                </fail>
     191                <fail message="Fatal: command 'svn --version' failed. Please make sure a working copy of svn is installed on your system.">
     192                        <!-- error code from SVN? Most likely svn is not what we are looking on this system -->
     193                        <condition>
     194                                <isfailure code="${svn.exit.code}" />
     195                        </condition>
     196                </fail>
     197        </target>
     198
     199        <target name="publish" depends="ensure-svn-present,core-info,commit-current,update-current,clean,dist,commit-dist">
     200        </target>
    67201</project>
  • applications/editors/josm/plugins/openlayers/src/org/openstreetmap/josm/plugins/openLayers/OpenLayersPlugin.java

    r13582 r19460  
    1111import org.openstreetmap.josm.gui.preferences.PreferenceSetting;
    1212import org.openstreetmap.josm.plugins.Plugin;
     13import org.openstreetmap.josm.plugins.PluginInformation;
    1314
    1415/**
     
    2425    static String pluginDir;
    2526
    26     public OpenLayersPlugin() {
     27    public OpenLayersPlugin(PluginInformation info) {
     28        super(info);
    2729        pluginDir = getPluginDir();
    2830        try {
Note: See TracChangeset for help on using the changeset viewer.