blob: 9229f79d0bcfcf71dc1683b01fac7d534d30e47b [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<project default="no-build-macros-default">
<!-- $Id: cc-macros.xml,v 1.6 2007/09/12 19:32:13 mrussell Exp $ -->
<target name="no-build-macros-default">
<fail>This file does not contain a default target</fail>
</target>
<import file="build-macros.xml"/>
<!-- =================================================
Cruise Control Initialization
-->
<macrodef name="cc_init">
<sequential>
<echo>ccproject=${ccproject} cctimestamp=${cctimestamp} cclogdir=${cclogdir}</echo>
<property name="build.num" value="${cctimestamp}" />
<property name="log.dir" location="${cclogdir}/${build.num}" />
<property name="lines.to.tail" value="2000"/>
<mkdir dir="${log.dir}" />
<property name="log2.dir" location="/opt/download/logs/${ccproject}/${cctimestamp}"/>
<mkdir dir="${log2.dir}" />
<copy file="/opt/cruisecontrol/config.xml"
tofile="${log.dir}/copy-of-cc-config-xml.txt" />
<cc_clean_link_files/>
<set_java/>
<echo>log.dir = ${log.dir}</echo>
<echo>log2.dir = ${log2.dir}</echo>
<echo>java.prefix.path = ${java.prefix.path}</echo>
<echo>java.5.path = ${java.5.path}</echo>
<echo>java.4.path = ${java.4.path}</echo>
<echo>java.3.path = ${java.3.path}</echo>
<echo>The default value for java.home is ${java.4.path}/bin</echo>
</sequential>
</macrodef>
<!-- =================================================
Clean all link files from the required eclipses
-->
<macrodef name="cc_clean_link_files">
<sequential>
<delete failonerror="false">
<fileset dir="/opt/eclipses" >
<include name="eclipse_*/links/*.link"/>
</fileset>
</delete>
</sequential>
</macrodef>
<!-- =================================================
Cruise Control Setup for 1st call to Eclipse
-->
<macrodef name="cc_setup">
<sequential>
<copy file="build-settings/downloads.html"
todir="${log.dir}"
failonerror="false" />
<!-- needed for the dynamic creation of link files -->
<read_product_properties/>
<init_root_properties/>
<property name="product.build.location" location=".."/>
<basename file="${product.build.location}" property="Project-Name"/>
</sequential>
</macrodef>
<!-- =================================================
Launch Ant inside Eclipse to perform the actual build
=== Required Parameters:
buildfile - the build file to be executed
(e.g. "build-product.xml")
log - the log file capturing console output
(e.g. "build-tools.log")
-->
<macrodef name="cc_eclipse_ant">
<attribute name="buildfile" />
<attribute name="log" />
<attribute name="buildTarget" default="" />
<attribute name="eclipseDirName" default="eclipse_330" />
<attribute name="javaPath" default="${java.4.path}"/>
<attribute name="cleanBuildTagFile" default=".clean_build"/>
<attribute name="configuration" default="../../../../epp-configuration"/>
<attribute name="workspace" default="../../../../epp-workspace"/>
<attribute name="dir" default="."/>
<sequential>
<echo>***********************************************</echo>
<echo>cc_eclipse_ant</echo>
<echo>buildfile = @{buildfile}</echo>
<echo>log = @{log}</echo>
<echo>buildTarget = @{buildTarget}</echo>
<echo>eclipseDirName = @{eclipseDirName}</echo>
<echo>javaPath = @{javaPath}</echo>
<echo>cleanBuildTagFile = @{cleanBuildTagFile}</echo>
<echo>configuration = @{configuration}</echo>
<echo>workspace = @{workspace}</echo>
<echo>dir = @{dir}</echo>
<echo>***********************************************</echo>
<echo>deleting @{configuration}</echo>
<delete dir="@{configuration}" failonerror="false"/>
<fileset dir="/opt/eclipses/@{eclipseDirName}/plugins" id="equinox.jar.fs"
includes="org.eclipse.equinox.launcher_*.jar"/>
<pathconvert property="equinox.jar" refid="equinox.jar.fs" />
<available file="/opt/eclipses/@{eclipseDirName}/startup.jar" type="file"
property="eclipse.startup"
value="/bin/java -Xms64M -Xmx256M -cp /opt/eclipses/@{eclipseDirName}/startup.jar org.eclipse.core.launcher.Main"/>
<property name="eclipse.startup" value="/bin/java -Xms64M -Xmx256M -cp ${equinox.jar} org.eclipse.equinox.launcher.Main" />
<echo message="Running eclipse from java @{javaPath}/bin/java" />
<echo message=" using eclipse startup @{javaPath}${eclipse.startup}" />
<echo file="${log.dir}/eclipse-ant.sh">#!/bin/bash
cd @{dir}
@{javaPath}${eclipse.startup} -clean -noupdate -configuration @{configuration} -data @{workspace} -application org.eclipse.ant.core.antRunner -Dbuild.num=${build.num} -Dlog.dir=${log.dir} -verbose -file @{buildfile} @{buildTarget}
ret=$?
echo eclipse exited with $ret
exit $ret
</echo>
<echo>Eclipse Build Starting: ${log.dir}/eclipse-ant.sh</echo>
<cc_exec file="${log.dir}/eclipse-ant.sh"
log="@{log}"
resultproperty="result.@{log}" />
<copy file="../.metadata/.log"
tofile="${log.dir}/eclipse-@{log}"
failonerror="false" />
<basename file="@{log}" property="base.name.for.log.zip.file"/>
<zip destfile="${log.dir}/${base.name.for.log.zip.file}.zip">
<zipfileset dir="${log.dir}" prefix="/">
<include name="@{log}" />
<include name="eclipse-@{log}" />
</zipfileset>
</zip>
<exec executable="tail" failifexecutionfails="false" failonerror="false"
output="${log.dir}/${base.name.for.log.zip.file}.tail.txt">
<arg value="-${lines.to.tail}"/>
<arg value="${log.dir}/@{log}" />
</exec>
<copy todir="${log2.dir}" failonerror="false">
<fileset dir="${log.dir}">
<include name="@{log}" />
<include name="*.tail.txt" />
<include name="eclipse-@{log}" />
</fileset>
</copy>
<fail message="Eclipse build failed: result.@{log} = ${result.@{log}}">
<condition>
<not>
<equals arg1="${result.@{log}}" arg2="0" />
</not>
</condition>
</fail>
<touch file="${log2.dir}/@{cleanBuildTagFile}" />
<echo>Eclipse Build Ended</echo>
</sequential>
</macrodef>
<!-- =================================================
Execute the specified file and redirect the output
=== Required Parameters:
file - the build file to be executed
(e.g. "cc-info.sh")
log - the log file capturing console output
(e.g. "info.log")
=== Optional Parameters:
failonerror - whether the build should fail if the exec fails
(defaults to "false")
-->
<macrodef name="cc_exec">
<attribute name="file" />
<attribute name="log" />
<attribute name="errorProperty" default="error.@{log}" />
<attribute name="resultProperty" default="result.@{log}" />
<sequential>
<chmod file="@{file}" perm="740" />
<exec executable="@{file}"
output="${log.dir}/@{log}"
errorproperty="@{errorProperty}"
resultproperty="@{resultProperty}"/>
<echo>executable @{file} ended with errorProperty @{errorProperty} = ${@{errorProperty}}</echo>
<echo> resultProperty @{resultProperty} = ${@{resultProperty}}</echo>
</sequential>
</macrodef>
<!-- =================================================
Execute the specified file and redirect the output
=== Required Parameters:
file - the build file to be executed
(e.g. "cc-info.sh")
log - the log file capturing console output
(e.g. "info.log")
=== Optional Parameters:
failonerror - whether the build should fail if the exec fails
(defaults to "false")
-->
<macrodef name="cc_exec_with">
<attribute name="file" />
<attribute name="log" />
<attribute name="argumentLine" default="" />
<attribute name="errorProperty" default="error.@{log}" />
<attribute name="resultProperty" default="result.@{log}" />
<sequential>
<chmod file="@{file}" perm="740" />
<exec executable="@{file}"
output="${log.dir}/@{log}"
errorproperty="@{errorProperty}"
resultproperty="@{resultProperty}">
<arg line="@{argumentLine}"/>
</exec>
<echo>executable @{file} ended with errorProperty @{errorProperty} = ${@{errorProperty}}</echo>
<echo> resultProperty @{resultProperty} = ${@{resultProperty}}</echo>
</sequential>
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
macrodef: createLinkFile
= = = = = = = = = = = = = = = = = -->
<macrodef name="createLinkFile">
<attribute name="product" />
<attribute name="eclipseTarget" />
<attribute name="eclipseDir" />
<sequential>
<checkfile file="${@{product}.load-image}/E-@{eclipseTarget}"
message="Prerequisit ${@{product}.load-image}/E-@{eclipseTarget} does not exist aborting build"/>
<echo file="/opt/eclipses/@{eclipseDir}/links/@{product}.link">
path=${@{product}.load-image}/E-@{eclipseTarget}
</echo>
</sequential>
</macrodef>
<!-- = = = = = = = = = = = = = = = = =
macrodef: removeLinkFile
= = = = = = = = = = = = = = = = = -->
<macrodef name="removeLinkFile">
<attribute name="product" />
<attribute name="eclipseDir" />
<sequential>
<delete file="/opt/eclipses/@{eclipseDir}/links/@{product}.link"/>
</sequential>
</macrodef>
</project>