Changeset 9765 in josm for trunk/build.xml


Ignore:
Timestamp:
2016-02-09T13:25:35+01:00 (9 years ago)
Author:
bastiK
Message:

new setup of the netbeans project

  • removed classpath hack with two source directories (. and ./src) instead copy the resources to build dir in nbbuild.xml
  • import main JOSM ant file into nbbuild.xml instead of copy&paste
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/build.xml

    r9749 r9765  
    99**
    1010-->
    11 <project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" basedir="." xmlns:jacoco="antlib:org.jacoco.ant">
    12     <property name="test.dir" location="test"/>
    13     <property name="src.dir" location="src"/>
    14     <property name="build.dir" location="build"/>
    15     <property name="javacc.home" location="tools"/>
    16     <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
    17     <property name="epsg.output" location="data/projection/custom-epsg"/>
    18     <property name="groovy.jar" location="tools/groovy-all-2.4.6-SNAPSHOT.jar"/>
    19     <!-- build parameter: compression level (ant -Dclevel=N)
    20              N ranges from 0 (no compression) to 9 (maximum compression)
    21              default: 9 -->
    22     <condition property="clevel" value="${clevel}" else="9">
    23         <isset property="clevel"/>
    24     </condition>
    25     <!-- For Java9-specific stuff -->
    26     <condition property="isJava9">
    27         <equals arg1="${ant.java.version}" arg2="1.9" />
    28     </condition>
     11<project xmlns:as="antlib:org.codehaus.mojo.animal_sniffer" name="josm" default="dist" xmlns:jacoco="antlib:org.jacoco.ant">
     12    <target name="init-properties">
     13        <!-- Load properties in a target and not at top level, so this build file can be
     14        imported from an IDE ant file (Netbeans) without messing up IDE properties.
     15        When imported from another file, ${basedir} will point to the parent directory
     16        of the importing ant file. Use ${base.dir} instead, which is always the parent
     17        directory of this file. -->
     18        <dirname property="base.dir" file="${ant.file.josm}"/>
     19        <property name="test.dir" location="${base.dir}/test"/>
     20        <property name="src.dir" location="${base.dir}/src"/>
     21        <property name="build.dir" location="${base.dir}/build"/>
     22        <property name="dist.dir" location="${base.dir}/dist"/>
     23        <property name="javacc.home" location="${base.dir}/tools"/>
     24        <property name="mapcss.dir" location="${src.dir}/org/openstreetmap/josm/gui/mappaint/mapcss"/>
     25        <property name="proj-build.dir" location="${base.dir}/build2"/>
     26        <property name="epsg.output" location="${base.dir}/data/projection/custom-epsg"/>
     27        <property name="groovy.jar" location="${base.dir}/tools/groovy-all-2.4.6-SNAPSHOT.jar"/>
     28        <!-- build parameter: compression level (ant -Dclevel=N)
     29                 N ranges from 0 (no compression) to 9 (maximum compression)
     30                 default: 9 -->
     31        <condition property="clevel" value="${clevel}" else="9">
     32            <isset property="clevel"/>
     33        </condition>
     34        <!-- For Java9-specific stuff -->
     35        <condition property="isJava9">
     36            <equals arg1="${ant.java.version}" arg2="1.9" />
     37        </condition>
     38    </target>
    2939
    3040    <!--
     
    3949      ** Initializes the REVISION.XML file from SVN information
    4050    -->
    41     <target name="init-svn-revision-xml">
    42         <exec append="false" output="REVISION.XML" executable="svn" failifexecutionfails="false" resultproperty="svn.info.result">
     51    <target name="init-svn-revision-xml" depends="init-properties">
     52        <exec append="false" output="${base.dir}/REVISION.XML" executable="svn" dir="${base.dir}" failifexecutionfails="false" resultproperty="svn.info.result">
    4353            <env key="LANG" value="C"/>
    4454            <arg value="info"/>
     
    5363      ** Initializes the REVISION.XML file from git information
    5464    -->
    55     <target name="init-git-revision-xml" unless="svn.info.success">
    56         <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false">
     65    <target name="init-git-revision-xml" unless="svn.info.success" depends="init-properties">
     66        <exec append="false" output="${base.dir}/REVISION.XML" executable="git" dir="${base.dir}" failifexecutionfails="false">
    5767            <arg value="log"/>
    5868            <arg value="-1"/>
     
    6676            <arg value="HEAD"/>
    6777        </exec>
    68         <replaceregexp file="REVISION.XML" flags="s"
     78        <replaceregexp file="${base.dir}/REVISION.XML" flags="s"
    6979                       match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
    7080                       replace="&lt;info&gt;&lt;entry&gt;&lt;commit revision=&quot;\1&quot;&gt;&lt;date&gt;\2&lt;/date&gt;&lt;/commit&gt;&lt;/entry&gt;&lt;/info&gt;"/>
     
    7383      ** Creates the REVISION file to be included in the distribution
    7484    -->
    75     <target name="create-revision" depends="init-svn-revision-xml, init-git-revision-xml">
     85    <target name="create-revision" depends="init-properties,init-svn-revision-xml,init-git-revision-xml">
    7686        <property name="revision.dir" value="${build.dir}"/>
    77         <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
    78         <delete file="REVISION.XML"/>
     87        <xmlproperty file="${base.dir}/REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
     88        <delete file="${base.dir}/REVISION.XML"/>
    7989        <tstamp>
    8090            <format property="build.tstamp" pattern="yyyy-MM-dd HH:mm:ss"/>
     
    94104      ** Check internal XML files against their XSD
    95105    -->
    96     <target name="check-schemas" unless="check-schemas.notRequired">
     106    <target name="check-schemas" unless="check-schemas.notRequired" depends="init-properties">
    97107        <schemavalidate file="data/defaultpresets.xml" >
    98108            <schema namespace="http://josm.openstreetmap.de/tagging-preset-1.0" file="data/tagging-preset.xsd" />
     
    108118        <copy file="LICENSE" todir="build"/>
    109119        <!-- create josm-custom.jar -->
    110         <delete file="dist/josm-custom.jar"/>
    111         <jar destfile="dist/josm-custom.jar" basedir="build" level="${clevel}">
     120        <delete file="${dist.dir}/josm-custom.jar"/>
     121        <jar destfile="${dist.dir}/josm-custom.jar" basedir="${build.dir}" level="${clevel}">
    112122            <!-- add attribute excludes="**/*BZip2*,**/*Bzip2*" to create a non-bzip2 supporting jar -->
    113123            <manifest>
     
    126136    </target>
    127137    <!-- Mac OS X target -->
    128     <target name="mac">
     138    <target name="mac" depends="init-properties">
    129139        <!-- Using https://bitbucket.org/infinitekind/appbundler to create mac application bundle -->
    130140        <taskdef name="bundleapp" classname="com.oracle.appbundler.AppBundlerTask" classpath="tools/appbundler-1.0ea.jar"/>
     
    156166            <option value="-Dcom.apple.smallTabs=true"/>
    157167        </bundleapp>
    158        
     168
    159169        <!-- appbundler lacks the possibility of defining our own keys or using a template, so update the .plist manually -->
    160170        <taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" classpath="tools/xmltask.jar"/>
    161        
     171
    162172        <xmltask source="${bundle.outdir}/JOSM.app/Contents/Info.plist" dest="${bundle.outdir}/JOSM.app/Contents/Info.plist" indent="false">
    163173            <!-- remove empty CFBundleDocumentTypes definition -->
     
    166176            <insert position="before" path="/plist/dict/key[1]" file="macosx/JOSM.app/Contents/Info.plist_template.xml" />
    167177        </xmltask>
    168        
     178
    169179        <!-- create ZIP file with MacOS X application bundle -->
    170180        <zip destfile="${bundle.outdir}/josm-custom-macosx.zip" update="true">
     
    175185    <target name="distmac" depends="dist">
    176186        <antcall target="mac">
    177             <param name="bundle.outdir" value="dist"/>
    178             <param name="bundle.jar" value="dist/josm-custom.jar"/>
     187            <param name="bundle.outdir" value="${dist.dir}"/>
     188            <param name="bundle.jar" value="${dist.dir}/josm-custom.jar"/>
    179189        </antcall>
    180190    </target>
     
    226236        </javac>
    227237        <!-- JMapViewer -->
    228         <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/josm/**,JOSM.java,gnu/**" 
     238        <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java,org/openstreetmap/josm/**,JOSM.java,gnu/**"
    229239            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
    230240            <compilerarg value="-Xlint:cast"/>
     
    243253        </javac>
    244254        <!-- JOSM -->
    245         <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java" 
     255        <javac sourcepath="" srcdir="${src.dir}" excludes="com/**,oauth/**,org/apache/commons/**,org/glassfish/**,org/openstreetmap/gui/jmapviewer/Demo.java"
    246256            destdir="build" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8">
    247257            <compilerarg value="-Xlint:cast"/>
     
    264274        </copy>
    265275    </target>
    266     <target name="init">
     276    <target name="init" depends="init-properties">
    267277        <uptodate property="javacc.notRequired" targetfile="${mapcss.dir}/parsergen/MapCSSParser.java" >
    268278            <srcfiles dir="${mapcss.dir}" includes="MapCSSParser.jj"/>
    269279        </uptodate>
    270         <mkdir dir="build"/>
    271         <mkdir dir="dist"/>
    272     </target>
    273     <target name="javadoc">
    274         <javadoc destdir="javadoc" 
     280        <mkdir dir="${build.dir}"/>
     281        <mkdir dir="${dist.dir}"/>
     282    </target>
     283    <target name="javadoc" depends="init-properties">
     284        <javadoc destdir="javadoc"
    275285                sourcepath="${src.dir}"
    276                 encoding="UTF-8"   
     286                encoding="UTF-8"
    277287                packagenames="org.openstreetmap.josm.*,org.openstreetmap.gui.jmapviewer.*"
    278288                excludepackagenames="org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.*"
     
    287297        </javadoc>
    288298    </target>
    289     <target name="clean">
    290         <delete dir="build"/>
    291         <delete dir="build2"/>
    292         <delete dir="dist"/>
     299    <target name="clean" depends="init-properties">
     300        <delete dir="${build.dir}"/>
     301        <delete dir="${proj-build.dir}"/>
     302        <delete dir="${dist.dir}"/>
    293303        <delete dir="${mapcss.dir}/parsergen"/>
    294304        <delete file="${src.dir}/org/w3/_2001/xmlschema/Adapter1.java"/>
     
    300310            <include name="**/*.jar"/>
    301311        </fileset>
    302         <pathelement path="dist/josm-custom.jar"/>
     312        <pathelement path="${dist.dir}/josm-custom.jar"/>
    303313        <pathelement path="${groovy.jar}"/>
    304314        <pathelement path="tools/findbugs/annotations.jar"/>
     
    312322        </sequential>
    313323    </macrodef>
    314     <target name="test-init">
     324    <target name="test-init" depends="init-properties">
    315325        <mkdir dir="${test.dir}/build"/>
    316326        <mkdir dir="${test.dir}/build/unit"/>
     
    323333        <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml" classpath="tools/jacocoant.jar" />
    324334    </target>
    325     <target name="test-clean">
     335    <target name="test-clean" depends="init-properties">
    326336        <delete dir="${test.dir}/build"/>
    327337        <delete dir="${test.dir}/report"/>
     
    527537                <tokenfilter>
    528538                    <replaceregex pattern="\|$" replace="" flags="gi"/>
    529                 </tokenfilter>   
     539                </tokenfilter>
    530540            </filterchain>
    531541        </loadresource>
     
    547557        <as:build-signatures destfile="${dir}/api.sig">
    548558            <path>
    549                 <fileset file="dist/josm-custom-optimized.jar"/>
     559                <fileset file="${dist.dir}/josm-custom-optimized.jar"/>
    550560                <fileset file="${java.home}/lib/rt.jar"/>
    551561                <fileset file="${java.home}/lib/jce.jar"/>
     
    594604        <sequential>
    595605            <echo message="Generating Taginfo for type @{type} to @{output}"/>
    596             <groovy src="${taginfoextract}" classpath="dist/josm-custom.jar">
     606            <groovy src="${taginfoextract}" classpath="${dist.dir}/josm-custom.jar">
    597607                <arg value="-t"/>
    598608                <arg value="@{type}"/>
     
    616626    </target>
    617627
    618     <target name="imageryindex">
     628    <target name="imageryindex" depends="init-properties">
    619629        <taskdef name="groovy" classname="org.codehaus.groovy.ant.Groovy" classpath="${groovy.jar};tools/commons-cli-1.3.1.jar"/>
    620630        <echo message="Checking editor imagery difference"/>
    621         <groovy src="scripts/sync_editor_imagery_index.groovy" classpath="dist/josm-custom.jar">
     631        <groovy src="scripts/sync_editor_imagery_index.groovy" classpath="${dist.dir}/josm-custom.jar">
    622632            <arg value="-nomissingeii"/>
    623633        </groovy>
     
    640650    </target>
    641651
    642     <target name="checkstyle">
    643         <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties" 
     652    <target name="checkstyle" depends="init-properties">
     653        <taskdef resource="com/puppycrawl/tools/checkstyle/ant/checkstyle-ant-task.properties"
    644654             classpath="tools/checkstyle/checkstyle-6.15-all.jar"/>
    645655        <checkstyle config="tools/checkstyle/josm_checks.xml">
    646             <fileset dir="${basedir}/src/org/openstreetmap/josm" includes="**/*.java"
     656            <fileset dir="${base.dir}/src/org/openstreetmap/josm" includes="**/*.java"
    647657                excludes="gui/mappaint/mapcss/parsergen/*.java"/>
    648             <fileset dir="${basedir}/test" includes="**/*.java"/>
     658            <fileset dir="${base.dir}/test" includes="**/*.java"/>
    649659            <formatter type="xml" toFile="checkstyle-josm.xml"/>
    650660        </checkstyle>
     
    654664        <taskdef name="findbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask" classpath="tools/findbugs/findbugs-ant.jar"/>
    655665        <path id="findbugs-classpath">
    656             <fileset dir="tools/findbugs/">
     666            <fileset dir="${base.dir}/tools/findbugs/">
    657667                <include name="*.jar"/>
    658668            </fileset>
     
    666676                effort="max"
    667677                >
    668             <sourcePath path="${basedir}/src" />
    669             <class location="${basedir}/dist/josm-custom.jar" />
     678            <sourcePath path="${base.dir}/src" />
     679            <class location="${dist.dir}/josm-custom.jar" />
    670680        </findbugs>
    671681    </target>
    672682    <target name="run" depends="dist">
    673         <java jar="dist/josm-custom.jar" fork="true">
     683        <java jar="${dist.dir}/josm-custom.jar" fork="true">
    674684            <arg value="--set=expert=true"/>
    675685            <arg value="--set=remotecontrol.enabled=true"/>
     
    678688        </java>
    679689    </target>
    680     <!-- compile build script for generating projection list -->
    681     <target name="epsg-compile" depends="compile">
    682         <mkdir dir="build2"/>
    683         <javac sourcepath="" srcdir="scripts" failonerror="true"
    684             destdir="build2" target="1.7" source="1.7" debug="on" includeantruntime="false" createMissingPackageInfoClass="false" encoding="UTF-8" classpath="build">
     690    <!--
     691      ** Compile build script for generating projection list.
     692    -->
     693    <target name="epsg-compile">
     694        <property name="proj-classpath" location="${build.dir}"/>
     695        <mkdir dir="${proj-build.dir}"/>
     696        <javac sourcepath="" srcdir="${base.dir}/scripts" failonerror="true"
     697            destdir="${proj-build.dir}" target="1.7" source="1.7" debug="on"
     698            includeantruntime="false" createMissingPackageInfoClass="false"
     699            encoding="UTF-8" classpath="${proj-classpath}">
    685700        </javac>
    686701    </target>
    687     <!-- generate projection list -->
     702    <!--
     703      ** generate projection list.
     704    -->
    688705    <target name="epsg" depends="epsg-compile">
    689706        <touch file="${epsg.output}"/>
     
    691708            <sysproperty key="java.awt.headless" value="true"/>
    692709            <classpath>
    693                 <pathelement path="."/>
    694                 <pathelement path="build"/>
    695                 <pathelement path="build2"/>
     710                <pathelement path="${base.dir}"/>
     711                <pathelement path="${proj-classpath}"/>
     712                <pathelement path="${proj-build.dir}"/>
    696713            </classpath>
    697             <arg value="${basedir}"/>
     714            <arg value="${base.dir}"/>
    698715        </java>
    699716    </target>
Note: See TracChangeset for help on using the changeset viewer.