blob: b633901624c7c702bf70f22c8deb3206ff5242de [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<project default="no-build-macros-default">
<!-- $id$ -->
<target name="no-build-macros-default">
<fail>This file does not contain a default target</fail>
</target>
<!-- =================================================
Read the product level build properties from
-->
<macrodef name="read_product_properties">
<attribute name="user.name" default="${user.name}" />
<attribute name="user.property.file"
default="build-settings/@{user.name}.properties" />
<sequential>
<!-- Read properties from user specific and product specific files -->
<fail>
<condition>
<not>
<available file="@{user.property.file}" />
</not>
</condition>*
***********************************************************************
Cannot find file: @{user.property.file}
Copy an existing user properties file such as
build-settings/example-user.properties
to
@{user.property.file}
and modify it to contain settings for your particular situation.
***********************************************************************
</fail>
<property file="build-settings/product.properties" />
<property file="@{user.property.file}" />
<!-- Verify required properties are defined -->
<fail unless="build.root" />
<fail unless="product.name" />
<fail unless="product.version" />
<init_root_properties />
<mkdir dir="${build.out}"/>
<echo>build.root = ${build.root}</echo>
<echo>build.temp = ${build.temp}</echo>
<echo>build.out = ${build.out}</echo>
<echo>log.dir = ${log.dir}</echo>
<echo>product.name = ${product.name}</echo>
<echo>product.version = ${product.version}</echo>
<echo>product.id = ${product.id}</echo>
</sequential>
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
macrodef: init_root_properties
= = = = = = = = = = = = = = = = = -->
<macrodef name="init_root_properties">
<attribute name="build.root" default="${build.root}" />
<sequential>
<!-- Properties derived from ${build.root} -->
<property name="build.out" location="@{build.root}/product" />
<property name="build.out.root" location="@{build.root}/.." />
<property name="build.temp.name" value="temp" />
<property name="build.temp"
location="${build.root}/${build.temp.name}" />
<property name="log.dir" location="@{build.root}/logs" />
<property name="build.num" value="local.build" />
<mkdir dir="${build.out}"/>
<mkdir dir="${build.out.root}"/>
<mkdir dir="${build.temp}"/>
<mkdir dir="${log.dir}"/>
</sequential>
</macrodef>
<!-- =================================================
Check that the build script is executing in an Eclpse environment
-->
<macrodef name="checkEclipseRunning">
<sequential>
<fail unless="eclipse.running">*
***********************************************************************
This build script must be executed inside an Eclipse environment.
If you are executing from the Eclipse UI,
be sure to switch to the "JRE" tab of the Ant Script Launch Configuration
and select the "Run in the same JRE as the workspace" radio button
If you are executing Ant headless,
then execute inside headless Eclipse using a command line something like this:
java -cp /opt/eclipses/eclipse_311/startup.jar org.eclipse.core.launcher.Main
-clean -noupdate -configuration ../configuration
-application org.eclipse.ant.core.antRunner -data ..
-verbose -file build-product.xml
***********************************************************************
</fail>
</sequential>
</macrodef>
<macrodef name="delete_temp_directories">
<sequential>
<!-- Delete the temporary directory -->
<delete dir="${build.temp}" verbose="false" />
<delete dir="${build.out}/install-image" verbose="false" />
</sequential>
</macrodef>
<macrodef name="copyToInstallImage">
<attribute name="product" />
<attribute name="baseDir" default="${build.out}/../../@{product}" />
<attribute name="productDir" default="@{baseDir}/product" />
<attribute name="installImageDir" default="${build.out}/install-image" />
<sequential>
<copy todir="@{installImageDir}">
<fileset dir="@{productDir}/install-image" />
</copy>
</sequential>
</macrodef>
<!-- =================================================
Setup the java variables
-->
<macrodef name="set_java">
<sequential>
<property name="java.prefix.path" location="/usr/java" />
<property name="java.6.path" value="${java.prefix.path}/jdk1.6.0_01"/>
<property name="java.5.path" value="${java.prefix.path}/jdk1.5.0_08"/>
<property name="java.4.path" value="${java.prefix.path}/j2sdk1.4.2_12"/>
<property name="java.3.path" value="${java.prefix.path}/jdk1.3.1_19"/>
<property name="java.6.path.javac" value="${java.6.path}/bin/javac"/>
<property name="java.5.path.javac" value="${java.5.path}/bin/javac"/>
<property name="java.4.path.javac" value="${java.4.path}/bin/javac"/>
<property name="java.3.path.javac" value="${java.3.path}/bin/javac"/>
<property name="java.6.path.rt" value="${java.6.path}/jre/lib/rt.jar"/>
<property name="java.5.path.rt" value="${java.5.path}/jre/lib/rt.jar"/>
<property name="java.4.path.rt" value="${java.4.path}/jre/lib/rt.jar"/>
<property name="java.3.path.rt" value="${java.3.path}/jre/lib/rt.jar"/>
<echo message="java.6.path.rt = ${java.6.path.rt}" />
<echo message="java.5.path.rt = ${java.5.path.rt}" />
<echo message="java.4.path.rt = ${java.4.path.rt}" />
<echo message="java.3.path.rt = ${java.3.path.rt}" />
<echo message="java.6.path.javac = ${java.6.path.javac}" />
<echo message="java.5.path.javac = ${java.5.path.javac}" />
<echo message="java.4.path.javac = ${java.4.path.javac}" />
<echo message="java.3.path.javac = ${java.3.path.javac}" />
<propertyset id="java.propertyset">
<propertyref prefix="java.3" />
<propertyref prefix="java.4" />
<propertyref prefix="java.5" />
<propertyref prefix="java.6" />
</propertyset>
</sequential>
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
macrodef: finalize_build_product
= = = = = = = = = = = = = = = = = -->
<macrodef name="finalize_build_product">
<attribute name="productVersion" default="${product.version}" />
<attribute name="productId" default="${product.id}" />
<attribute name="cleanBuildTagFileName" default=".clean_build"/>
<attribute name="cleanBuildTagFile" default="${build.out}/@{cleanBuildTagFileName}"/>
<attribute name="cleanBuildTagFileLog" default="${log.dir}/@{cleanBuildTagFileName}"/>
<sequential>
<echo message="finalize_build_product" />
<echo message="finalize_build_product productVersion = @{productVersion}" />
<echo message="finalize_build_product productId = @{productId}" />
<echo message="finalize_build_product cleanBuildTagFile = @{cleanBuildTagFile}" />
<generateBuildDate/>
<!-- Write the head file -->
<basename file="${build.out}" property="head.dir.name" />
<echo file="${build.out}/../head.properties">head=${head.dir.name}</echo>
<echo file="${build.out}/product.properties">version=@{productVersion}
id=@{productId}</echo>
<echo message="touching @{cleanBuildTagFile}" />
<touch file="@{cleanBuildTagFile}" />
<touch file="@{cleanBuildTagFileLog}" />
<buildLinks/>
</sequential>
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
macrodef: cc_build_latest
=== required Parameters:
none
=== optional Parameters:
buildout - the directory the docs are build to
(default ${build.out})
=== Properties defined:
cc.build.latest.link - the link file to be created
none
= = = = = = = = = = = = = = = = = -->
<macrodef name="buildLinks">
<attribute name="buildout" default="${build.out}" />
<sequential>
<antcall target="create_links" inheritall="false">
<param name="buildout" value="@{buildout}"/>
<param name="logdir" value="${log.dir}"/>
<param name="project.name" value="${product.name}"/>
</antcall>
</sequential>
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
macrodef: generateBuildDate
= = = = = = = = = = = = = = = = = -->
<macrodef name="generateBuildDate">
<attribute name="dateFormat" default="yyyy.MM.dd" />
<sequential>
<tstamp>
<format property="build.date" pattern="yyyy.MM.dd"/>
</tstamp>
<echo file="${build.out}/build-date.html">&lt;html>&lt;body>
&lt;p style="font-family: Helvetica, Arial,sans-serif; font-size:80%; color: #333333; background-color: #efefef;line-height: 1.15; margin: 0px; padding: 0px;">
${build.date}&lt;/p>&lt;/body>&lt;/html></echo>
</sequential>
</macrodef>
<!-- =================================================
Get the install-image and load-image directorys and version of the specified product
based upon include.properties and head.properties files
as set on the cruise control promote page.
=== Required Parameters:
product - the name of the product to be extracted
(e.g. "epp", etc)
=== Created Properties
@{product}.install-image - the installation image location
@{product}.version - the product version
-->
<macrodef name="get_product_info">
<attribute name="product" />
<sequential>
<echo message="Start get_product_info"/>
<echo message=" product=@{product}"/>
<echo message=" build.out.root=${build.out.root}" />
<checkfile file="${build.out.root}/@{product}/include.properties" />
<property prefix="@{product}"
file="${build.out.root}/@{product}/include.properties" />
<checkfile file="${build.out.root}/@{product}/${@{product}.include}/head.properties" />
<property prefix="@{product}"
file="${build.out.root}/@{product}/${@{product}.include}/head.properties" />
<checkfile file="${build.out.root}/@{product}/${@{product}.include}/${@{product}.head}/product.properties" />
<property prefix="@{product}"
file="${build.out.root}/@{product}/${@{product}.include}/${@{product}.head}/product.properties" />
<property name="@{product}.install-image"
location="${build.out.root}/@{product}/${@{product}.include}/${@{product}.head}/install-image" />
<property name="@{product}.load-image"
location="${build.out.root}/@{product}/${@{product}.include}/${@{product}.head}/load-image" />
<echo>including @{product} ${@{product}.version} files </echo>
<echo> ${@{product}.install-image}</echo>
<echo> ${@{product}.load-image}</echo>
<echo message="End get_product_info"/>
</sequential>
</macrodef>
<!-- =================================================
Macro for checking that a file or directory exists.
-->
<macrodef name="checkfile">
<attribute name="file" />
<attribute name="message" default="Cannot find file: @{file}" />
<sequential>
<!-- Assert that the file exists -->
<fail message="@{message}">
<condition>
<not>
<available file="@{file}"/>
</not>
</condition>
</fail>
</sequential>
</macrodef>
<!-- - - - - -
create the latest project link and the link to the project set if one exists
- - - - - - - -->
<target name="create_links" depends="create_latest"/>
<!-- - - - - - - - - - - - - - - - - -
target: create_latest
create the latest link
- - - - - - - - - - - - - - - - - -->
<target name="create_latest" depends="set_os" if="os.unix">
<dirname file="${buildout}" property="cc.build.latest.link"/>
<delete failonerror="false" >
<fileset dir="${cc.build.latest.link}" followsymlinks="false">
<include name="latest"/>
</fileset>
</delete>
<echo>building symbolic link for latest ${cc.build.latest.link}/latest->${buildout}</echo>
<symlink action="single"
link="${cc.build.latest.link}/latest"
resource="${buildout}"
overwrite="true" />
</target>
<!-- - - - - - - - - - - - - - - - - -
target: set_os
- - - - - - - - - - - - - - - - - -->
<target name="set_os">
<condition property="os.windows">
<os family="windows" />
</condition>
<condition property="os.unix">
<os family="unix" />
</condition>
<condition property="os.mac">
<os family="mac" />
</condition>
<echo>Windows: ${os.windows}</echo>
<echo>Unix: ${os.unix}</echo>
<echo>Mac: ${os.mac}</echo>
</target>
</project>