Ignore:
Timestamp:
2010-10-12T16:31:47+02:00 (14 years ago)
Author:
guggis
Message:

Fixing #4855 - turnrestrictions plugin: some issues
Reorganized test cases

File:
1 edited

Legend:

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

    r23559 r23571  
    3939      ** should not be necessary to change the following properties
    4040     -->
    41         <property name="josm"                   location="../../core/dist/josm-custom.jar"/>
    42         <property name="plugin.build.dir"       value="build"/>
    43         <property name="plugin.src.dir"         value="src"/>
     41        <property name="josm" location="../../core/dist/josm-custom.jar" />
     42        <property name="plugin.build.dir" value="build" />
     43        <property name="plugin.src.dir" value="src" />
    4444        <!-- this is the directory where the plugin jar is copied to -->
    45         <property name="plugin.dist.dir"        value="dist"/>
    46         <property name="ant.build.javac.target" value="1.6"/>
    47         <property name="plugin.jar"             value="../../dist/${ant.project.name}.jar"/>
    48     <property name="test.build.dir"        value="test/build" />
     45        <property name="plugin.dist.dir" value="dist" />
     46        <property name="ant.build.javac.target" value="1.6" />
     47        <property name="plugin.jar" value="../../dist/${ant.project.name}.jar" />
     48        <property name="test.build.dir" value="test/build" />
    4949        <!--
    5050    **********************************************************
     
    5353    -->
    5454        <target name="init">
    55                 <mkdir dir="${plugin.build.dir}"/>
    56                 <mkdir dir="${test.build.dir}"/>
     55                <mkdir dir="${plugin.build.dir}" />
     56                <mkdir dir="${test.build.dir}" />
    5757        </target>
    5858
     
    6363    -->
    6464        <target name="compile" depends="init">
    65                 <echo message="compiling sources for  ${plugin.jar} ... "/>
     65                <echo message="compiling sources for  ${plugin.jar} ... " />
    6666                <javac srcdir="src" classpath="${josm}" debug="true" destdir="${plugin.build.dir}">
    67                         <compilerarg value="-Xlint:deprecation"/>
    68                         <compilerarg value="-Xlint:unchecked"/>
     67                        <compilerarg value="-Xlint:deprecation" />
     68                        <compilerarg value="-Xlint:unchecked" />
    6969                </javac>
    7070        </target>
     
    7676    -->
    7777        <target name="dist" depends="compile,revision">
    78                 <echo message="creating ${ant.project.name}.jar ... "/>
     78                <echo message="creating ${ant.project.name}.jar ... " />
    7979                <copy todir="${plugin.build.dir}/resources">
    80                         <fileset dir="resources"/>
     80                        <fileset dir="resources" />
    8181                </copy>
    8282                <copy todir="${plugin.build.dir}/images">
    83                         <fileset dir="images"/>
     83                        <fileset dir="images" />
    8484                </copy>
    8585                <copy todir="${plugin.build.dir}">
     
    9999    -->
    100100                        <manifest>
    101                                 <attribute name="Author" value="Karl Guggisberg"/>
    102                                 <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionsPlugin"/>
    103                                 <attribute name="Plugin-Date" value="${version.entry.commit.date}"/>
    104                                 <attribute name="Plugin-Description" value="The turnrestrictions plugin allows to enter maintain information about turn restrictions in the OpenStreetMap database."/>
    105                                 <attribute name="Plugin-Icon" value="images/preferences/turnrestrictions.png"/>
    106                                 <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/turnrestrictions"/>
    107                                 <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
    108                                 <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
     101                                <attribute name="Author" value="Karl Guggisberg" />
     102                                <attribute name="Plugin-Class" value="org.openstreetmap.josm.plugins.turnrestrictions.TurnRestrictionsPlugin" />
     103                                <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
     104                                <attribute name="Plugin-Description" value="The turnrestrictions plugin allows to enter maintain information about turn restrictions in the OpenStreetMap database." />
     105                                <attribute name="Plugin-Icon" value="images/preferences/turnrestrictions.png" />
     106                                <attribute name="Plugin-Link" value="http://wiki.openstreetmap.org/wiki/JOSM/Plugins/turnrestrictions" />
     107                                <attribute name="Plugin-Mainversion" value="${plugin.main.version}" />
     108                                <attribute name="Plugin-Version" value="${version.entry.commit.revision}" />
    109109                        </manifest>
    110110                </jar>
     
    121121
    122122                <exec append="false" output="REVISION" executable="svn" failifexecutionfails="false">
    123                         <env key="LANG" value="C"/>
    124                         <arg value="info"/>
    125                         <arg value="--xml"/>
    126                         <arg value="."/>
    127                 </exec>
    128                 <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true"/>
    129                 <delete file="REVISION"/>
     123                        <env key="LANG" value="C" />
     124                        <arg value="info" />
     125                        <arg value="--xml" />
     126                        <arg value="." />
     127                </exec>
     128                <xmlproperty file="REVISION" prefix="version" keepRoot="false" collapseAttributes="true" />
     129                <delete file="REVISION" />
    130130        </target>
    131131
     
    136136    -->
    137137        <target name="clean">
    138                 <delete dir="${plugin.build.dir}"/>
    139                 <delete file="${plugin.jar}"/>
     138                <delete dir="${plugin.build.dir}" />
     139                <delete file="${plugin.jar}" />
    140140        </target>
    141141
     
    146146    -->
    147147        <target name="install" depends="dist">
    148                 <property environment="env"/>
     148                <property environment="env" />
    149149                <condition property="josm.plugins.dir" value="${env.APPDATA}/JOSM/plugins" else="${user.home}/.josm/plugins">
    150150                        <and>
    151                                 <os family="windows"/>
     151                                <os family="windows" />
    152152                        </and>
    153153                </condition>
    154                 <copy file="${plugin.jar}" todir="${josm.plugins.dir}"/>
     154                <copy file="${plugin.jar}" todir="${josm.plugins.dir}" />
    155155        </target>
    156156
     
    165165        <target name="core-info">
    166166                <exec append="false" output="core.info.xml" executable="svn" failifexecutionfails="false">
    167                         <env key="LANG" value="C"/>
    168                         <arg value="info"/>
    169                         <arg value="--xml"/>
    170                         <arg value="../../core"/>
    171                 </exec>
    172                 <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true"/>
     167                        <env key="LANG" value="C" />
     168                        <arg value="info" />
     169                        <arg value="--xml" />
     170                        <arg value="../../core" />
     171                </exec>
     172                <xmlproperty file="core.info.xml" prefix="coreversion" keepRoot="true" collapseAttributes="true" />
    173173                <echo>Building against core revision ${coreversion.info.entry.revision}.</echo>
    174174                <echo>Plugin-Mainversion is set to ${plugin.main.version}.</echo>
     
    182182                <echo>Commiting the plugin source with message '${commit.message}' ...</echo>
    183183                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    184                         <env key="LANG" value="C"/>
    185                         <arg value="commit"/>
    186                         <arg value="-m '${commit.message}'"/>
    187                         <arg value="."/>
     184                        <env key="LANG" value="C" />
     185                        <arg value="commit" />
     186                        <arg value="-m '${commit.message}'" />
     187                        <arg value="." />
    188188                </exec>
    189189        </target>
     
    195195                <echo>Updating plugin source ...</echo>
    196196                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    197                         <env key="LANG" value="C"/>
    198                         <arg value="up"/>
    199                         <arg value="."/>
     197                        <env key="LANG" value="C" />
     198                        <arg value="up" />
     199                        <arg value="." />
    200200                </exec>
    201201                <echo>Updating ${plugin.jar} ...</echo>
    202202                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    203                         <env key="LANG" value="C"/>
    204                         <arg value="up"/>
    205                         <arg value="../dist/${plugin.jar}"/>
     203                        <env key="LANG" value="C" />
     204                        <arg value="up" />
     205                        <arg value="../dist/${plugin.jar}" />
    206206                </exec>
    207207        </target>
     
    222222        </echo>
    223223                <exec append="true" output="svn.log" executable="svn" failifexecutionfails="false">
    224                         <env key="LANG" value="C"/>
    225                         <arg value="-m '${commit.message}'"/>
    226                         <arg value="commit"/>
    227                         <arg value="${plugin.jar}"/>
     224                        <env key="LANG" value="C" />
     225                        <arg value="-m '${commit.message}'" />
     226                        <arg value="commit" />
     227                        <arg value="${plugin.jar}" />
    228228                </exec>
    229229        </target>
     
    261261
    262262        <path id="groovy.path">
    263                 <pathelement location="${eclipse.plugin.dir}/org.codehaus.groovy_1.7.5.xx-20100926-2000-e36-RC1\lib\groovy-all-1.7.5.jar"/>
     263                <pathelement location="${eclipse.plugin.dir}/org.codehaus.groovy_1.7.5.xx-20100926-2000-e36-RC1\lib\groovy-all-1.7.5.jar" />
    264264        </path>
    265265
     
    269269
    270270        <path id="test.class.path">
    271                 <pathelement location="${josm}"/>
     271                <pathelement location="${josm}" />
    272272                <pathelement location="${plugin.build.dir}" />
    273                 <path refid="groovy.path"/>
    274                 <path refid="junit.path"/>
     273                <path refid="groovy.path" />
     274                <path refid="junit.path" />
    275275        </path>
    276276
     
    287287
    288288        <target name="test-clean">
    289                 <delete dir="${test.build.dir}"/>
    290                 <mkdir dir="${test.build.dir}"/>
    291     </target>
     289                <delete dir="${test.build.dir}" />
     290                <mkdir dir="${test.build.dir}" />
     291        </target>
    292292
    293293        <target name="test-compile" depends="compile,test-clean" description="Compiles the test files">
    294294
    295                 <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="groovy.path"/>
    296 
    297                 <echo message="compiling java test cases for ${plugin.jar} ... "/>
    298                         <javac srcdir="test/src" classpathref="test.class.path" debug="true" destdir="${test.build.dir}">
    299                                 <compilerarg value="-Xlint:deprecation"/>
    300                                 <compilerarg value="-Xlint:unchecked"/>
    301                         </javac>
    302 
    303                 <echo message="compiling groovy test cases for ${plugin.jar} ... "/>
     295                <taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc" classpathref="groovy.path" />
     296
     297                <echo message="compiling test infrastructor for ${plugin.jar} ... " />
     298                <javac srcdir="test/src" classpathref="test.class.path" debug="true" destdir="${test.build.dir}" includes="org/openstreetmap/josm/plugins/turnrestrictions/fixtures/**/*">
     299                        <compilerarg value="-Xlint:deprecation" />
     300                        <compilerarg value="-Xlint:unchecked" />
     301                </javac>
     302
     303                <echo message="compiling groovy test cases for ${plugin.jar} ... " />
    304304                <groovyc srcdir="test/src" destdir="${test.build.dir}" classpathref="groovyc.path">
    305305                </groovyc>
     306
     307                <echo message="compiling java test cases for ${plugin.jar} ... " />
     308                <javac srcdir="test/src" classpathref="test.class.path" debug="true" destdir="${test.build.dir}">
     309                        <compilerarg value="-Xlint:deprecation" />
     310                        <compilerarg value="-Xlint:unchecked" />
     311                </javac>
    306312        </target>
    307313
    308314        <target name="test-run" depends="test-compile" description="Runs the junit tests">
    309                 <delete dir="test/output"/>
    310                 <mkdir dir="test/output"/>
     315                <delete dir="test/output" />
     316                <mkdir dir="test/output" />
    311317
    312318                <junit printsummary="true" failureproperty="junit.failure">
    313                       <classpath>
    314                         <path refid="groovyc.path" />
    315                         <pathelement location="test/config"/> <!-- required for test config file -->
    316                         <pathelement location="."/> <!-- required to load images from subdir 'images/' -->
    317                       </classpath>
    318 
    319                           <test todir="test/output" name='org.openstreetmap.josm.plugins.turnrestrictions.AllUnitTests'>
    320                         <formatter type="xml"/>
    321                           </test>
     319                        <classpath>
     320                                <path refid="groovyc.path" />
     321                                <pathelement location="test/config" />
     322                                <!-- required for test config file -->
     323                                <pathelement location="." />
     324                                <!-- required to load images from subdir 'images/' -->
     325                        </classpath>
     326
     327                        <test todir="test/output" name='org.openstreetmap.josm.plugins.turnrestrictions.AllUnitTests'>
     328                                <formatter type="xml" />
     329                        </test>
    322330                </junit>
    323331        </target>
Note: See TracChangeset for help on using the changeset viewer.