view build-src/build-components.xml @ 4:5a537ec76c6e

RT-18421: Build files in openjfx/2.1/master have the wrong copyright Reviewed by: jgiles
author kcr
date Fri, 13 Jan 2012 15:52:47 -0800
parents 8d968b638b49
children
line wrap: on
line source
<?xml version="1.0" encoding="UTF-8"?>
<project name="build-components" basedir=".">

<!--
/*
 * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.  Oracle designates this
 * particular file as subject to the "Classpath" exception as provided
 * by Oracle in the LICENSE file that accompanied this code.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 */
-->

    <description>
   
        Defines component (sub repository) properties and macrodefs
        for building the components and controlling which components get built.

        *** Sub-repositories should NOT import this file. ***

        This file is imported by the build.xml file only.

        The contract between the top repository and sub repositories:

           jfx-init         - Initialize anything for a build
           jfx-clean        - Clean yourself
           jfx-sdk          - Build and add your files to ${jfx.sdk.dir}
           jfx-sdk-clean    - Delete the files you added to ${jfx.sdk.dir}
           jfx-deploy       - Build and add your files to ${jfx.deployed.dir}
           jfx-deploy-clean - Delete the files you added to ${jfx.deployed.dir}
           jfx-test         - Run your smoke tests on ${jfx.sdk.dir}
           jfx-sdk-docs     - Generate and deliver sdk docs
           jfx-perf         - Build performance tests and related code to ${jfx.perf.dir}
    
         Refer to the comments in this file with the pattern
             "NOTE: (newcomponent)"
         for what changes are needed to add a new component.

    </description>

    <!-- Run an ant target for a component. -->
    <macrodef name="do-component">
        <attribute name="component"/>
        <attribute name="target"/>
        <sequential>
            <tstamp>
                <format property="jfx.@{component}.@{target}.start.clock"
                        pattern="HH:mm:ss"/>
            </tstamp>
            <tstamp>
                <format property="jfx.@{component}.@{target}.start.time"
                        pattern="MM/dd/yyyy HH:mm:ss"/>
            </tstamp>
            <echo level="info"
                  message="################################################"/>
            <echo level="info"
                  message="# cd @{component} ; ant @{target} -> Start  Time: ${jfx.@{component}.@{target}.start.time}"/>
            <!-- RUN separate ant file -->
            <ant antfile="${basedir}/@{component}/build.xml"
                 target="@{target}" inheritAll="false"/>
            <tstamp>
                <format property="jfx.@{component}.@{target}.finish.time"
                        pattern="MM/dd/yyyy HH:mm:ss"/>
            </tstamp>
            <tstamp>
                <format property="jfx.@{component}.@{target}.finish.clock"
                        pattern="HH:mm:ss"/>
            </tstamp>
            <echo level="info"
                  message="# cd @{component} ; ant @{target} -> Finish Time: ${jfx.@{component}.@{target}.finish.time}"/>
            <echo level="info"
                  message="# Timing: ${jfx.@{component}.@{target}.start.clock} -> ${jfx.@{component}.@{target}.finish.clock} (@{component} @{target})"/>
            <echo level="info"
                  message="################################################"/>
        </sequential>
    </macrodef>

    <!-- Clone a component repository. -->
    <macrodef name="do-clone">
        <attribute name="component"/>
        <sequential>
            <echo message="hg clone --pull ${hg.paths.default}/@{component} ./@{component}"/>
            <exec executable="hg">
                <arg value="clone"/>
                <arg value="--pull"/>
                <arg value="${hg.paths.default}/@{component}"/>
                <arg value="./@{component}"/>
            </exec>
        </sequential>
    </macrodef>

     <!-- Find tip for a component repository. -->
    <macrodef name="do-tip">
        <attribute name="component"/>
        <attribute name="property"/>
        <sequential>
            <exec executable="hg" outputproperty="@{property}" failifexecutionfails="false">
                <arg value="tip"/>
                <arg value="--repository"/>
                <arg value="@{component}"/>
                <arg value="--template"/>
                <arg value="{node|short}"/>
            </exec>
        </sequential>
    </macrodef>

    <!-- Sets up properties for a component, a component xml file to
         define the targets, AND imports that component xml file. -->
    <macrodef name="do-setup-and-import-component">
        <attribute name="component"/>
        <sequential>
            <condition property="jfx.@{component}.repo.exists">
                <available file="${jfx.root.dir}/@{component}/.hg" type="dir"/>
            </condition>
            <condition property="jfx.@{component}.exists">
                <available file="${jfx.root.dir}/@{component}/build.xml" type="file"/>
            </condition>
            <mkdir dir="${jfx.build.dir}/xml_generated"/>
            <copy file="${jfx.root.build.src.dir}/build-component-template.xml"
                  tofile="${jfx.build.dir}/xml_generated/build-@{component}.xml"/>
            <replace file="${jfx.build.dir}/xml_generated/build-@{component}.xml"
                     token="@COMPONENT@" value="@{component}"/>
            <import file="${jfx.build.dir}/xml_generated/build-@{component}.xml"/>
        </sequential>
    </macrodef>

    <!-- See what components we have and if it is a complete forest -->
    <condition property="jfx.root.repo.exists">
        <available file="${jfx.root.dir}/.hg" type="dir"/>
    </condition>
    
    <!-- This defines all targets and properties for a component -->
    <!--   NOTE: (newcomponent) Add line here for a new component. -->
    <!--         Please keep in alphabetical order. -->
    <do-setup-and-import-component component="apps"/>
    <do-setup-and-import-component component="deploy"/>
    <do-setup-and-import-component component="docs"/>
    <do-setup-and-import-component component="glass"/>
    <do-setup-and-import-component component="media"/>
    <do-setup-and-import-component component="perf"/>
    <do-setup-and-import-component component="rt"/>
    <do-setup-and-import-component component="rt-closed"/>
    <do-setup-and-import-component component="tests"/>
    <do-setup-and-import-component component="webnode"/>

    <!-- Do we have a full forest (determines if cached files used) -->
    <!--   NOTE: (newcomponent) Add line here for a new component. -->
    <!--         Please keep in alphabetical order. -->
    <condition property="jfx.full.forest">
        <and>
            <isset property="jfx.apps.exists"/>
            <isset property="jfx.deploy.exists"/>
            <isset property="jfx.docs.exists"/>
            <isset property="jfx.glass.exists"/>
            <isset property="jfx.media.exists"/>
            <!-- No build file in "rt" so just check repo -->
            <isset property="jfx.rt.repo.exists"/>
            <isset property="jfx.rt-closed.exists"/>
            <isset property="jfx.tests.exists"/>
            <isset property="jfx.webnode.exists"/>
        </and>
    </condition>

    <!-- Check the "required" subset of repos for a developer build -->
    <!--         Please keep in alphabetical order. -->
    <condition property="jfx.dev.forest">
        <and>
            <isset property="jfx.apps.exists"/>
            <isset property="jfx.deploy.exists"/>
            <isset property="jfx.glass.exists"/>
            <!-- No build file in "rt" so just check repo -->
            <isset property="jfx.rt.repo.exists"/>
            <isset property="jfx.rt-closed.exists"/>
            <isset property="jfx.tests.exists"/>
        </and>
    </condition>

    <!-- Since "rt" annd "rt-closed" are currently a matched pair, verify -->
    <!-- that either both of them or neither of them exist -->
    <condition property="jfx.rt.and.rt-closed.ok">
        <or>
            <and>
                <isset property="jfx.rt.repo.exists"/>
                <isset property="jfx.rt-closed.repo.exists"/>
            </and>
            <and>
                <not>
                    <isset property="jfx.rt.repo.exists"/>
                </not>
                <not>
                    <isset property="jfx.rt-closed.repo.exists"/>
                </not>
            </and>
        </or>
    </condition>

    <!-- Run an ant target for all components. -->
    <macrodef name="do-all-components">
        <attribute name="target"/>
        <sequential>
            <!-- NOTE: (newcomponent) Add line here for a new component. -->
            <!--       This list is NOT in alphabetical order. -->
            <!-- WARNING: Order of building is important here, be careful. -->
            <antcall target="glass-@{target}"/>
            <antcall target="media-@{target}"/>
            <antcall target="rt-closed-@{target}"/>
            <antcall target="webnode-@{target}"/>
            <antcall target="deploy-@{target}"/>
            <antcall target="docs-@{target}"/>
            <antcall target="apps-@{target}"/>
            <antcall target="tests-@{target}"/>
            <echo level="info"
                  message="Target @{target} completed for all components."/>
        </sequential>
    </macrodef>

    <!-- Run an ant target for components up through rt-closed . -->
    <macrodef name="do-subset-components">
        <attribute name="target"/>
        <sequential>
            <!-- NOTE: (newcomponent) Add line here for a new component. -->
            <!--       This list is NOT in alphabetical order. -->
            <!-- WARNING: Order of building is important here, be careful. -->
            <antcall target="glass-@{target}"/>
            <antcall target="media-@{target}"/>
            <antcall target="rt-closed-@{target}"/>
            <echo level="info"
               message="Target @{target} completed for subset of components."/>
        </sequential>
    </macrodef>

    <!-- Forest clone. Clone any missing component repositories. -->
    <!--   NOTE: (newcomponent) Add line here for a new component. -->
    <!--         Please keep in alphabetical order. -->
    <target name="clone-all-components"
            depends="-hg-paths-default,
                     apps-clone,
                     deploy-clone,
                     docs-clone,
                     glass-clone,
                     media-clone,
                     rt-clone,
                     rt-closed-clone,
                     tests-clone,
                     webnode-clone">
    </target>

    <!-- Target to verify all repos needed for a developer build -->

    <target name="check-dev-forest" depends="-fail-if-not-dev-forest">
    </target>

    <target name="check-rt-repositories" depends="-fail-if-rt-mismatch">
    </target>

    <target name="-fail-if-rt-mismatch" unless="jfx.rt.and.rt-closed.ok">
        <fail message="*** ERROR: both of rt and rt-closed must be present, or neither must be present"/>
    </target>

    <target name="-fail-if-not-dev-forest" unless="jfx.dev.forest">
        <fail message="*** ERROR: some repositories needed for dev build are missing"/>
    </target>

    <!-- Get tips of all component repositories. -->
    <!--   NOTE: (newcomponent) Add line here for a new component. -->
    <!--         Please keep in alphabetical order. -->
    <target name="tip-all-components"
            depends="root-tip,
                     apps-tip,
                     deploy-tip,
                     docs-tip,
                     glass-tip,
                     media-tip,
                     rt-tip,
                     rt-closed-tip,
                     tests-tip,
                     webnode-tip">
        <echoproperties destfile="${jfx.repository.data}">
            <propertyset>
                <propertyref prefix="jfx.repository.tip."/>
            </propertyset>
        </echoproperties>
    </target>

    <!-- Define the hg.paths.default property, or path to parent. -->
    <target name="-hg-paths-default">
        <exec executable="hg" failonerror="true">
            <arg value="paths"/>
            <arg value="default"/>
            <redirector outputproperty="hg.paths.default">
                <outputfilterchain>
                    <tokenfilter>
                        <stringtokenizer/>
                        <replaceregex pattern="(.+)/.*$" replace="\1"/>
                    </tokenfilter>
                </outputfilterchain>
            </redirector>
        </exec>
    </target>

    <!-- Targets for root. -->
    <target name="root-tip"
            unless="jfx.repository.tip.root" 
            if="jfx.root.repo.exists">
        <do-tip component="." property="jfx.repository.tip.root"/>
    </target>

    <!-- Targets to do the contract targets on all sub repositories or components. -->
    <target name="do-all-clean">
        <do-all-components target="jfx-clean"/>
    </target>
    <target name="do-all-clean-sdk">
        <do-all-components target="jfx-clean-sdk"/>
    </target>
    <target name="do-all-clean-deploy">
        <do-all-components target="jfx-clean-deploy"/>
    </target>
    <target name="do-all-sdk">
        <do-all-components target="jfx-sdk"/>
    </target>
    <target name="do-subset-sdk">
        <do-subset-components target="jfx-sdk"/>
    </target>
    <target name="do-all-test">
        <do-all-components target="jfx-test"/>
    </target>
    <target name="do-all-deploy">
        <do-all-components target="jfx-deploy"/>
    </target>
    <target name="do-all-sdk-docs">
        <do-all-components target="jfx-sdk-docs"/>
    </target>
    <target name="do-all-apps">
        <do-all-components target="jfx-apps"/>
    </target>
    <target name="do-all-perf">
        <do-all-components target="jfx-perf"/>
    </target>
    <target name="do-all-full-test">
        <do-all-components target="jfx-full-test"/>
    </target>

    <target name="deploy-imports" if="jfx.deploy.exists">
        <do-component target="import" component="deploy"/>
    </target>

</project>