view build-defs.xml @ 3762:c200cd542665

Replaced lambdas in FilteredList and TransformationList with anonymous classes.
author Martin Sladecek <martin.sladecek@oracle.com>
date Thu, 30 May 2013 08:19:27 +0200
parents 146629644751
children
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>

<project name="runtime-build-defs" basedir=".">
    <description>
      Defines common properties and macros for JavaFX runtime repo.
      Sub-projects should import this file into their build.xml file.
      This file will import all other necessary top repository build-*.xml files.
    </description>

    <import file="../build-defs.xml"/>
    
    <!-- 
        Bring in environment properties (if not already done).
    -->
    <property environment="env"/>
    
    <!-- Set JFXRT_HOME -->
    <condition property="JFXRT_HOME"
               value="${env.JFXRT_HOME}"
               else="../../artifacts/sdk/rt">
        <isset property="env.JFXRT_HOME"/>
    </condition>
    
    <!--
        Note that .properties files are loaded relative to the basedir of
        the caller script, i.e., the <subproject>/build.xml file.  The order
        is important here:
         1. First set a couple properties that are referenced by the
            subproject's project.properties file when building javac.classpath
            and other properties.
         2. Load the subproject's project.properties file to set up
            classpath properties and any other properties that will override
            the default values defined in common.properties.
         3. Load the common.properties file, which includes default values
            of properties common to most/all subprojects.
    -->
    <property file="../base.properties"/>
    <property file="project.properties"/>
    <property file="../common.properties"/>

    <path id="id.processor.path" path="${javac.processorpath}"/>

    <!-- create a class path for cobertura for code test coverage analysis -->
    <path id="cobertura.class.path">
        <fileset dir="${import.cobertura.dir}" includes="**/*.jar" />
    </path>

    <!--
	Allow override of javac.debuglevel on a per-project basis. For example, to override javac.debuglevel on
        javafx-ui-common: 
	ant -Djavafx-ui-common.javac.debuglevel=source,lines,vars
    -->	
    <!--
    <propertycopy name="javac.debuglevel" from="${ant.project.name}.javac.debuglevel" silent="true" override="true"/>
    -->

    <!--
        Default targets for all subprojects are defined below.  These can
        be overridden in each subproject's build.xml file if necessary;
        if left unspecified, the default behavior will be used as defined here.
    -->

    <target name="-pre-init">
        <!-- Empty placeholder for easier customization. -->
        <!-- You can override this target in the subproject build.xml file. -->
    </target>

    <target name="init" depends="-pre-init">
        <!-- Empty placeholder for easier customization. -->
        <!-- You can override this target in the subproject build.xml file. -->
    </target>

    <target name="jar" depends="init">
        <build-project/>
    </target>

    <target name="jar_and_copy_to_sdk" depends="jar">
        <echo message="${dist.dir}/${ant.project.name}.jar to ${jfx.sdk.desktop.dir}"/>
        <copy file="${dist.dir}/${ant.project.name}.jar" todir="${jfx.sdk.desktop.dir}"/>
    </target>  

    <target name="clean">
        <clean-project/>
    </target>

    <target name="-check-smoke-test-excludes" unless="is-full-test">
        <property name="test.excludes" value="${smoke.test.excludes}"/>
    </target>

    <target name="-init-test" depends="-check-smoke-test-excludes">
    </target>

    <target name="full-test">
        <property name="is-full-test" value="true"/>
        <antcall target="test"/>
    </target>

    <target name="test" depends="-init-test,jar">
        <test-project excludes="${test.excludes}"/>
    </target>

    <target name="test-single" depends="jar">
        <test-single/>
    </target>

    <!--

        Main project level macros for doing all of the common tasks. These
        exist so that subproject build.xml files can rewrite the main targets
        (clean, test, etc) and by simply calling these macros perform the
        appropriate tasks.

    -->

    <macrodef name="clean-project">
        <sequential>
            <delete dir="${build.dir}"/>
            <delete dir="${dist.dir}"/>
        </sequential>
    </macrodef>

    <macrodef name="build-project">
        <attribute name="name" default="${ant.project.name}"/>
        <element name="excludefromcopy" optional="true"/>
        <element name="addedsrcdirs" optional="true"/>
        <element name="addedsrcfiles" optional="true"/>
        <element name="addedprops" optional="true"/>
        <element name="addedjarfilesets" optional="true"/>
        <sequential>
            <mkdir dir="${build.classes.dir}"/>

            <condition property="processor.flag" value="" else="-processorpath ${toString:id.processor.path}">
                <isset property="disable.builders"/>
            </condition>

            <!-- compile .java source files -->
            <javac compiler="modern"
             fork="true"
             destdir="${build.classes.dir}"
             debug="${javac.debug}"
             debuglevel="${javac.debuglevel}"
             deprecation="${javac.deprecation}"
             source="${javac.source}"
             target="${javac.target}"
             includeantruntime="false"
             encoding="${source.encoding}"
             excludes="${runtime.excludes}"
             sourcepath="">
                <src>
                    <pathelement location="${src.dir}"/>
                    <addedsrcdirs />
                </src>
                <classpath>
                    <path path="${javac.classpath}"/>
                </classpath>
                <compilerarg line="${processor.flag} ${javac.compilerargs}"/>
                <addedprops/>
            </javac>

            <!-- copy resource files (images, etc) -->
            <copy todir="${build.classes.dir}">
                <fileset dir="${src.dir}" excludes="${build.classes.excludes}"/>
                <addedsrcfiles />
            </copy>

            <mkdir dir="${build.dir}/builders" />
            <copy todir="${build.dir}/builders">
                <fileset dir="${build.classes.dir}" includes="**/*.java" />
            </copy>

            <!-- create the jar file -->
            <mkdir dir="${dist.dir}"/>
            <jar destfile="${dist.dir}/@{name}.jar">
                <fileset dir="${build.classes.dir}"
                    excludes="${jar.file.excludes},${jar.file.excludes.extra}" />
                <addedjarfilesets/>
            </jar>

            <!-- copy the jar file to the shared lib directory -->
            <copy file="${dist.dir}/@{name}.jar" todir="../build"/> <!--${runtime.deps.dir}-->
        </sequential>
    </macrodef>

    <macrodef name="test-project">
        <attribute name="testsrc" default="${test.dir}"/>
        <attribute name="excludes" default=""/>
        <sequential>
            <!-- compile all test sources -->
            <build-tests testsrc="@{testsrc}"/>
            <!-- run the tests -->
            <run-junit>
                <customtests>
                    <batchtest todir="${build.test.results.dir}">
                        <fileset dir="${build.test.classes.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
                            <filename name="**/*Test.class"/>
                        </fileset>
                    </batchtest>
                </customtests>
            </run-junit>
        </sequential>
    </macrodef>

    <macrodef name="build-tests">
        <attribute name="testsrc" default="${test.dir}"/>
        <attribute name="includes" default="${includes}"/>
        <attribute name="excludes" default="${excludes}"/>
        <element name="addedprops" optional="true"/>
        <sequential>
            <mkdir dir="${build.test.classes.dir}"/>

            <condition property="processor.flag" value="" else="-processorpath ${toString:id.processor.path}">
                <isset property="disable.builders"/>
            </condition>

            <!-- compile .java test sources -->
            <javac compiler="modern"
             fork="true"
             destdir="${build.test.classes.dir}"
             debug="${javac.debug}"
             debuglevel="${javac.debuglevel}"
             deprecation="${javac.deprecation}"
             source="${javac.source}"
             target="${javac.target}"
             includeantruntime="false"
             encoding="${source.encoding}"
             sourcepath="">
                <src>
                    <pathelement location="@{testsrc}"/>
                </src>
                <classpath>
                    <path path="${javac.test.classpath}"/>
                </classpath>
                <compilerarg line="${processor.flag} ${javac.compilerargs}"/>
                <include name="@{includes}"/>
                <exclude name="@{excludes}"/>
                <addedprops/>
            </javac>

            <!-- copy resource files (images, etc) -->
            <copy todir="${build.test.classes.dir}">
                <fileset dir="@{testsrc}" excludes="${build.classes.excludes}"/>
            </copy>
        </sequential>
    </macrodef>

    <macrodef name="run-junit">
        <attribute name="includes" default="${includes}"/>
        <attribute name="excludes" default="${excludes}"/>
        <element name="customtests" optional="false"/>
        <element name="addedjvmargs" optional="true"/>
        <!--<attribute default="**" name="testincludes"/>-->
        <sequential>
            <property name="work.dir" value="${basedir}"/>
            <mkdir dir="${build.test.results.dir}"/>
            <junit dir="${work.dir}" errorproperty="tests.failed"
             failureproperty="tests.failed" fork="true" showoutput="true">
                <customtests/>
                <classpath>
                    <path path="${run.test.classpath}"/>
                </classpath>
                <syspropertyset>
                    <propertyref prefix="test-sys-prop."/>
                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
                </syspropertyset>
                <formatter type="brief" usefile="false"/>
                <formatter type="xml"/>
                <assertions>
                    <enable/>
                </assertions>
                <jvmarg line="${run.jvmargs}"/>
                <addedjvmargs/>
            <!--
                <jvmarg line="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1090"/>
            -->
            </junit>
            <fail if="tests.failed"/>
        </sequential>
    </macrodef>

    <macrodef name="test-single">
        <attribute name="testsrc" default="${test.dir}"/>
        <sequential>
            <fail unless="run.file">Must set property 'run.file'</fail>
            <!-- compile all test sources -->
            <build-tests testsrc="@{testsrc}" includes="${run.file}"/>
            <!-- run the single test -->
            <run-junit>
                <customtests>
                    <batchtest todir="${build.test.results.dir}">
                        <fileset dir="${test.dir}" includes="${run.file}"/>
                    </batchtest>
                </customtests>
            </run-junit>
        </sequential>
    </macrodef>

    <macrodef name="debug-selected-file-in-test">
        <attribute name="name" default="${ant.project.name}"/>
        <sequential>
            <fail unless="debug.class">Must set property 'debug.class'</fail>
            <path id="cp">
                <pathelement path="${run.test.classpath}"/>
            </path>
            <nbjpdastart addressproperty="jpda.address" name="@{name}" transport="dt_socket">
                <classpath refid="cp"/>
            </nbjpdastart>
            <run-junit>
                <customtests>
                    <test name="${debug.class}" />
                </customtests>
                <addedjvmargs>
                    <jvmarg value="-Xdebug"/>
                    <jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
                </addedjvmargs>
            </run-junit>
        </sequential>
    </macrodef>

    <!-- Stuff dealing with adding coverage to JUnit execution -->

    <target name="cobertura-taskdefs">
        <taskdef classpathref="cobertura.class.path" resource="tasks.properties"/>
    </target>

    <macrodef name="instrument">
        <sequential>
            <mkdir dir="${coverage.classes.dir}"/>
            <cobertura-instrument todir="${coverage.classes.dir}" datafile="${coverage.datafile}">
                <fileset dir="${build.classes.dir}" includes="**/*.class" excludes="**/*Builder.class"/>
                <classpath refid="cobertura.class.path"/>
            </cobertura-instrument>
        </sequential>
    </macrodef>

    <macrodef name="clean-instrument">
        <sequential>
            <!--delete dir="${coverage.dir}"/-->
        </sequential>
    </macrodef>

    <macrodef name="coverage-report">
        <sequential>
            <mkdir dir="${coverage.dist.dir}"/>
            <cobertura-report destdir="${coverage.dist.dir}" datafile="${coverage.datafile}">
                <fileset dir="${src.dir}"/>
                <!--<fileset dir="${build.dir}/builders"/>-->
                <classpath>
                    <path location="${build.classes.dir}"/>
                </classpath>
            </cobertura-report>
            <cobertura-report format="xml" destdir="${coverage.dist.dir}" datafile="${coverage.datafile}">
                <fileset dir="${src.dir}"/>
                <!--<fileset dir="${build.dir}/builders"/>-->
            </cobertura-report>
        </sequential>
    </macrodef>

    <macrodef name="run-junit-coverage">
        <attribute name="includes" default="${includes}"/>
        <attribute name="excludes" default="${excludes}"/>
        <element name="customtests" optional="false"/>
        <!--<attribute default="**" name="testincludes"/>-->
        <sequential>
            <property name="work.dir" value="${basedir}"/>
            <mkdir dir="${build.test.results.dir}"/>
            <junit dir="${work.dir}" errorproperty="tests.failed"
             failureproperty="tests.failed" fork="true" showoutput="true">
                <customtests/>
                <sysproperty key="net.sourceforge.cobertura.datafile"
		     file="${coverage.datafile}" />
                <classpath location="${coverage.classes.dir}" />
                <classpath>
                    <path path="${run.test.classpath}"/>
                </classpath>
                <classpath refid="cobertura.class.path" />
                <syspropertyset>
                    <propertyref prefix="test-sys-prop."/>
                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
                </syspropertyset>
                <formatter type="brief" usefile="false"/>
                <formatter type="xml"/>
                <assertions>
                    <enable/>
                </assertions>
                <jvmarg line="${run.jvmargs} -XX:-UseSplitVerifier"/>
            </junit>
            <fail if="tests.failed"/>
        </sequential>
    </macrodef>

    <target name="-pre-coverage" depends="init">
    </target>

    <target name="coverage" depends="init,jar,cobertura-taskdefs,-pre-coverage">
        <instrument />
        <build-tests testsrc="${test.dir}"/>
        <run-junit-coverage>
            <customtests>
                <batchtest todir="${build.test.results.dir}">
                    <fileset dir="${build.test.classes.dir}" excludes="${excludes},${excludes}" includes="${includes}">
                        <filename name="**/*Test.class"/>
                    </fileset>
                </batchtest>
            </customtests>
        </run-junit-coverage>
        <coverage-report />
        <clean-instrument />
    </target>


    <target name="func-test" depends="init,jar">
        <test-project testsrc="${ftest.dir}"/>
    </target>


    <!-- End stuff dealing with adding coverage to JUnit execution -->

</project>