blob: 151f81ede7f260f1a7b8da84df5ee57fc9eaaa88 [file] [log] [blame]
<!--
Copyright (c) 2005, 2019 IBM Corporation and others.
This program and the accompanying materials
are made available under the terms of the Eclipse Public License 2.0
which accompanies this distribution, and is available at
https://www.eclipse.org/legal/epl-2.0/
SPDX-License-Identifier: EPL-2.0
Contributors:
IBM Corporation - initial API and implementation
-->
<project
name="build"
default="build"
basedir=".">
<!-- main -->
<target
name="build"
depends="init, preBuild"
if="build_distro_target_exists">
<!-- remove eclipse builder at start of every major build, so it will be reinstalled -->
<delete
failonerror="true"
quiet="true"
dir="${eclipse.builder.base.install.dir}"/>
<property
name="buildfile"
value="${wtp.builder.home}/distribution/${build.distribution}.build/build.xml"/>
<echo
level="info"
message="buildfile: ${buildfile}"/>
<!-- build -->
<ant antfile="${buildfile}"/>
</target>
<target
name="site"
depends="init"
if="site_distro_target_exists">
<ant antfile="${wtp.builder.home}/distribution/${build.distribution}.site/build.xml"></ant>
</target>
<target
name="test"
depends="init,markIfNoTests"
if="tests_distro_target_exists">
<ant antfile="${wtp.builder.home}/distribution/${build.distribution}.tests/build.xml">
<property
name="testRoot"
value="${env.PROJECT_TESTS}/${projectname}"/>
<property
name="dependencyTargets"
value="${wtp.builder.home}/scripts/dependency/build.xml"/>
<property
name="local.cache.dir"
value="${env.LOCAL_PREREQS_CACHE}"/>
</ant>
</target>
<target
name="package"
depends="init"
if="package_distro_target_exists">
<ant antfile="${wtp.builder.home}/distribution/${build.distribution}.package/build.xml">
</ant>
</target>
<target
name="markIfNoTests"
unless="tests_distro_target_exists">
<echo
message="This build for ${build.distribution} (${projectname}) provided no unit tests"
file="${buildDirectory}/${buildLabel}/noTestsProvided.txt"/>
</target>
<!-- we dont' use 'upload' any longer ... TODO: remove? -->
<target
name="upload"
depends="init"
if="upload_distro_target_exists">
<ant antfile="${wtp.builder.home}/distribution/${build.distribution}.upload/build.xml"/>
</target>
<!--
init: 1) set buildBranch property 2) call label.xml to create
label.properties file in <BUILD HOME>/projects/<project>/workdir
3) check for existence of build.xml file for each of the build,
test, upload, site distribution locations and set properties
-->
<target
name="init"
unless="buildInitialized">
<!-- = = = standard properties pattern = = = -->
<!--
Note to be cross-platform, "environment variables" are only
appropriate for some variables, e.g. ones we set, since
properties are case sensitive, even if the environment variables
on your operating system are not, e.g. it will be ${env.Path}
not ${env.PATH} on Windows
-->
<property environment="env"/>
<!--
Let users override standard properties, if desired. If
directory, file, or some properties do not exist, then standard
properties will be used.
-->
<property file="${env.LOCAL_BUILD_PROPERTIES_DIR}/${ant.project.name}.properties"/>
<property
name="keyCfgFile"
value="${env.PROJECT_BUILDERS}/${projectname}/${env.RELENG}/maps/build.cfg"/>
<echo
level="debug"
message="keyCfgFile: ${keyCfgFile}"/>
<property file="${keyCfgFile}"/>
<!-- TODO: I don't think this is loaded here. Wrong basedir? -->
<property file="${ant.project.name}.properties"/>
<!-- = = = end standard properties pattern = = = -->
<fail
unless="build.distribution"
message="build.distribution must be specified"/>
<echo message="build.distribution: ${build.distribution}"/>
<dirname
file="${ant.file}"
property="wtp.builder.home"/>
<!-- if not set above, assume R3.2.0 -->
<!-- this happens, for example, when using a "tempTest" branch -->
<property
name="buildBranch"
value="R3.2.0"/>
<touch file="${user.home}/.cvspass"/>
<!--
strip trailing blanks. Seems either Eclipse, or CVS make it
hard to not have trailing spaces
-->
<replaceregexp
flags="gm"
file="${wtp.builder.home}/build.properties"
match=" *$"
replace=""/>
<property file="${wtp.builder.home}/build.properties"/>
<!-- create label.properties file (if doesn't exist)-->
<ant antfile="${wtp.builder.home}/scripts/build/label.xml"/>
<property file="${buildDirectory}/label.properties"/>
<echo
level="info"
message="label file: ${buildDirectory}/label.properties"/>
<property
name="build.distribution"
value="${wtp.builder.home}/distribution/${wtp.builder.home}/distribution/${build.distribution}"/>
<available
file="${wtp.builder.home}/distribution/${build.distribution}.build/build.xml"
type="file"
property="build_distro_target_exists"/>
<available
file="${wtp.builder.home}/distribution/${build.distribution}.site/build.xml"
type="file"
property="site_distro_target_exists"/>
<available
file="${wtp.builder.home}/distribution/${build.distribution}.tests/build.xml"
type="file"
property="tests_distro_target_exists"/>
<available
file="${wtp.builder.home}/distribution/${build.distribution}.upload/build.xml"
type="file"
property="upload_distro_target_exists"/>
<available
file="${wtp.builder.home}/distribution/${build.distribution}.package/build.xml"
type="file"
property="package_distro_target_exists"/>
<!--
fetch the HEAD stream of all projects if build type
specified as N
-->
<condition
property="fetchTag"
value="CVS=HEAD,GIT=origin/master">
<equals
arg1="${buildType}"
arg2="N"/>
</condition>
<property
name="buildInitialized"
value="true"/>
</target>
<!--
Steps to do before running a build.
-->
<target name="preBuild">
<!-- Verify that cvs is installed before starting a build. -->
<ant antfile="${wtp.builder.home}/scripts/build/checkSystemPrereq.xml">
<property
name="commandName"
value="cvs"/>
<property
name="arguments"
value="--version"/>
</ant>
<!-- Verify that grep is installed. -->
<ant antfile="${wtp.builder.home}/scripts/build/checkSystemPrereq.xml">
<property
name="commandName"
value="grep"/>
<property
name="arguments"
value="--version"/>
</ant>
<echo message="All build system prereqs passed"/>
</target>
</project>