blob: 9e0dc72e7d04cc3ab779426142c170b9214ddc13 [file] [log] [blame]
<project
name="AggregationTasks"
basedir="."
default="default">
<!--
Purpose and primary targets
This build.xml is to download and install the CBI aggregator (and other tools)
and run one of three types of aggregations. Note: it assumes all has been checked out of Git
and "ready to aggregate". It does recored the "commit" of some repositories, just as a way to
improve documenting what was built.
This script has 3 main "entry targets", each corresponding to one of the 3 types of aggregations:
1. runAggregatorValidateOnly (default)
This simply confirms the "constraints" as specified by the the *.aggr* contributions
all make sense and "fit together" as well as that the repositories are available at the
specified URLs. It is the "quickest" job, typically taking from 1 to 4 minutes.
2. runAggregatorBuildOnly
This aggregation does a complete aggregation. That is, in addition to "validating"
the constraints, it downloads the artifacts, unpacks or verifies any pack.gz files,
and creates a final repository. The distinguishing feature of this target is that
if it is ran a second time it does not "clean" anything and downloads only anything new
that is needed. Hence, the first time it is ran can take several hours,
but subsequent runs can be much quicker (from just a few minutes to a few dozen minutes,
depending on how much is new).
3. runAggregatorCleanBuild
This is the aggregation is similar to above, but always does a "clean build".
It remove all artifacts and metadata that previously had been downloaded and starts "fresh".
Hence, it always takes several hours to complete. But this is is important since there are few things
that can go wrong that would only show up in a clean build.
Important properties
Listed below are some of the most important properties that can be "passed in" (either as -D parameters on command line,
or in a property file that is then specified on command line with -Daggr.properties=<yourPropertyFile>).
- BUILD_HOME
Technically should be an environment variable rather than an ant property. Such as invoking ant on command line
with "BUILD_HOME=${PWD} ant ... ". The default is the environment variable "WORKSPACE" so if running on Hudson,
nothing needs to be specified. Technically is not required, but if not running on Hudson, it is best to
specify some directory outside of the working tree.
- release
'release' This is the release train name (e.g. 'neon', all lower case. It is used to form some email messages (from the CBI aggregator)
as well as, in the final stages, some URL segments, such as when promoted to ".../staging/<release>". For production
Useful properties
Listed below are some useful properties that can be "passed in" (either as -D parameters on command line,
or in a property file that is then specified on command line with -Daggr.properties=<yourPropertyFile>).
But, most users or use-cases will not need to be concerned with these.
- git_protocol
'git_protocol' specifies an alternative way to "get" the git repositories of the 'simrel.build' and 'simrel.tools'.
If running with local versions of the repository, it can be slightly more efficient and reliable
to use direct file access ("git_protocol=file://") instead of the default of "git://git.eclipse.org".
- rewriteRepositoryURLValue
'rewriteRepositoryURLValue' is simlar to the git_protocol property but applies to URLs in the *aggr* files.
If running on Eclipse.org (or, if you otherwise have direct access to the file system, say with a mirrored repository)
it is more efficient to use direct file access ("rewriteRepositoryURLValue=file:///home/data/httpd/download.eclipse.org")
rather than the default specified in the *aggr* files ("https://download.eclipse.org"). If this property exists (i.e. has
a value) then the script does a simple search-and-replace to rewrite matching URLs.
- installEclipseAndTools
The script always installs Eclipse and required tools *unless* is sees that eclipse is already installed.
To force it to reinstall Eclipse and required tools use this installEclipseAndTools property. In practice,
this value is seldom needed since often just as easy to delete the entire "BUILD_HOME" and start completely fresh.
- platformFilename
'platformFilename' is the name of the binary platform to install
as the "base" into which the aggregator and other tools are installed into.
The default is eclipse-platform-4.8-linux-gtk-x86_64.tar.gz.
- platformLocation
'platformLocation' is the location from where to the binary platform.
By default, it is
https://download.eclipse.org/eclipse/downloads/drops4/R-4.8-201806110500
If you have access to the binary platform archive on your file system, you can specify
its location instead, for some savings in "download time". For example:
file:///files/eclipsefiles/
- JAVA_HOME
Should rarely be needed "these days". But is provided here in case it is desired
to run the aggregator with a different VM than the VM that is running Ant.
-->
<!-- globally make "environment variables" available -->
<property environment="env" />
<target
name="installAggregatorAndTools"
depends="init, savePrevious,installAggregator,installRelengTools,installTestsFromP2Repo"
if="installEclipseAndTools"
unless="eclipseAndToolsInstalled">
<echo message="Installed fresh Eclipse, Aggregator, and Tools" />
<property
name="eclipseAndToolsInstalled"
value="true" />
</target>
<target
name="installAggregator"
depends="init, savePrevious"
if="installEclipseAndTools"
unless="aggregatorInstalled">
<property
name="APP_NAME_P2DIRECTOR_AGG"
value="org.eclipse.equinox.p2.director" />
<property
name="otherArgsAggr"
value="-metadataRepository https://download.eclipse.org/cbi/updates/aggregator/ide/4.8/I20180518-0759/ -artifactRepository https://download.eclipse.org/cbi/updates/aggregator/ide/4.8/I20180518-0759/ -installIU org.eclipse.cbi.p2repo.aggregator.engine.feature.feature.group" />
<!--
Remote builds should use eclipse.p2.mirrors=true
(the default). But, in some cases may want to add
-Declipse.p2.mirrors=false
-->
<property
name="vm_args_aggr"
value="-Djava.io.tmpdir=${BUILD_HOME}/tmp" />
<condition
property="vm_args_aggr_settings"
value="-vmargs ${vm_args_aggr}">
<isset property="vm_args_aggr" />
</condition>
<mkdir dir="${ECLIPSE_HOME}" />
<get
src="${platformResource}"
dest="${localPrereqCache}"
usetimestamp="true" />
<untar
compression="gzip"
overwrite="true"
src="${localPrereqCache}/${platformFilename}"
dest="${ECLIPSE_HOME}" />
<!--
This .options file mentioned elsewhere is most useful on non-eclipse.org
sites, since
on eclipse.org, by design, should not go through mirrors, but that's
the purpose of the .options ... to list which mirrors that artifacts
come
from.
-->
<!-- Weird this chmod is required? Maybe an ant bug? Maybe no longer
needed? (That is, maybe an early bug in packages?) -->
<chmod
file="${ECLIPSE_HOME}/eclipse/eclipse"
perm="ugo+x"
verbose="true" />
<!-- and now get latest version of aggregator -->
<exec
executable="${eclipseExecutable}"
dir="${basedir}"
failonerror="true">
<arg
line="-data ${eclipseWorkspaceBase}/install_aggr -debug -consolelog -nosplash --launcher.suppressErrors -application ${APP_NAME_P2DIRECTOR_AGG} ${otherArgsAggr} ${vm_args_aggr_settings}" />
</exec>
<property
name="aggregatorInstalled"
value="true" />
</target>
<target
name="installTestsFromP2Repo"
depends="init"
if="installEclipseAndTools"
unless="testsInstalled">
<property
name="APP_NAME_P2DIRECTOR_TESTS"
value="org.eclipse.equinox.p2.director" />
<property
name="repoReportURL"
value="https://download.eclipse.org/cbi/updates/analyzers/4.7/" />
<property
name="OTHER_ARGS_TESTS"
value="-metadataRepository ${repoReportURL} -artifactRepository ${repoReportURL} -installIU org.eclipse.cbi.p2repo.analyzers.feature.feature.group" />
<property
name="vm_args_tests"
value="-Djava.io.tmpdir=${BUILD_HOME}/tmp" />
<condition
property="vm_args_tests_settings"
value="-vmargs ${vm_args_tests}">
<isset property="vm_args_tests" />
</condition>
<!-- install latest feature from repo -->
<exec
executable="${eclipseExecutable}"
dir="${basedir}"
failonerror="true">
<arg
line="-data ${eclipseWorkspaceBase}/installTests -debug -consolelog -nosplash --launcher.suppressErrors -application ${APP_NAME_P2DIRECTOR_TESTS} ${OTHER_ARGS_TESTS} ${vm_args_tests_settings}" />
</exec>
<property
name="testsInstalled"
value="true" />
</target>
<target
name="installRelengTools"
depends="init"
if="installEclipseAndTools"
unless="relengToolsInstalled">
<property
name="APP_NAME_P2DIRECTOR_RELENG"
value="org.eclipse.equinox.p2.director" />
<property
name="OTHER_ARGS_RELENG"
value="-metadataRepository https://download.eclipse.org/webtools/releng/repository/ -artifactRepository https://download.eclipse.org/webtools/releng/repository/ -installIU org.eclipse.wtp.releng.tools.feature.feature.group" />
<property
name="vm_args_releng"
value="-Djava.io.tmpdir=${BUILD_HOME}/tmp" />
<condition
property="vm_args_releng_settings"
value="-vmargs ${vm_args_releng}">
<isset property="vm_args_releng" />
</condition>
<!-- install latest feature from repo -->
<exec
executable="${eclipseExecutable}"
dir="${basedir}"
failonerror="true">
<arg
line="-data ${eclipseWorkspaceBase}/installRelengTools -debug -consolelog -nosplash --launcher.suppressErrors -application ${APP_NAME_P2DIRECTOR_RELENG} ${OTHER_ARGS_RELENG} ${vm_args_releng_settings}" />
</exec>
<property
name="relengToolsInstalled"
value="true" />
</target>
<macrodef name="git-config">
<attribute name="repodir" />
<attribute name="configKey" />
<attribute name="configValue" />
<sequential>
<echo message="execute git in @{repodir}" />
<echo message="git config @{configKey} @{configValue}" />
<!-- We list "before and after" just to learn more about the system.
We
will not always need to do that. -->
<exec
executable="git"
failonerror="true"
dir="@{repodir}">
<arg value="config" />
<arg value="--list" />
</exec>
<exec
executable="git"
failonerror="true"
dir="@{repodir}">
<arg value="config" />
<arg value="@{configKey}" />
<arg value="@{configValue}" />
</exec>
<exec
executable="git"
failonerror="true"
dir="@{repodir}">
<arg value="config" />
<arg value="--list" />
</exec>
</sequential>
</macrodef>
<macrodef name="git-rev-parse">
<attribute name="repodir" />
<attribute
name="reference"
default="HEAD" />
<attribute name="returnProperty" />
<sequential>
<echo message="execute git in @{repodir}" />
<echo message="git rev-parse @{reference} returned in @{returnProperty}" />
<local name="rc" />
<local name="result" />
<exec
executable="git"
failonerror="true"
outputproperty="result"
resultproperty="rc"
dir="@{repodir}">
<arg line="rev-parse @{reference}" />
</exec>
<property
name="@{returnProperty}"
value="${result}" />
<echo message="In macro rc is ${rc}" />
<echo message="In macro result is ${result}" />
<echo message="In macro @{returnProperty} is ${@{returnProperty}}" />
</sequential>
</macrodef>
<!-- We set repo config repeatedly (every build) since we do not know "who"
cloned the repository first, "us", or "Hudson". And if Hudson (or Gerrit)
does it then we do not know how they set or determine the correct config
values. -->
<target
name="configRepo"
depends="init"
if="localRepoExists">
<echo message="git config task to execute in ${buildModelDir}" />
<!-- in macro "config" we list, then set then list again the configuration. -->
<git-config
repodir="${buildModelDir}"
configKey="core.autocrlf"
configValue="input" />
</target>
<!-- This is "the key" task. If it succeeds, we run tests (reports), and
if they "pass", we promote to "staging". -->
<target
name="runAggregatorCleanBuild"
description="Runs a clean aggregation"
depends="init,rewriteRepositoryURL,installAggregatorAndTools">
<!-- If not otherwise set in properties file, use these values. Note
the
build.eclipse.org production machine must override these values for
property
values appropriate for it (namely production.properties). -->
<!-- We no longer "trust" Eclipse and Equinox repos. -trustedContributions
Eclipse,Equinox -->
<property
name="AGG_APP_ARGS"
value="${AGGREGATOR_APP_BASE_ARGS} --action CLEAN_BUILD" />
<echo message="AGG_APP_ARGS: ${AGG_APP_ARGS}" />
<!-- Important: on any non-production machines it is important to _not_
use eclipse.p2.mirrors=false, so this value should be supplied by calling
script's properties. Note, we include '-vmargs' here, in case there
are not
any. Not sure if the use of -vmargs _requires_ arguments or not, but
probably
would. note: -Declipse.p2.MD5Check=false may be needed as a workaround
for
bug [253713] (should not actually be required ... but have left note
for
historical reference) note: rememeber that JAVA_6 should not be used
for
jar processor, see for example, bug 244603 and bug 279596. -->
<exec
executable="${eclipseExecutable}"
dir="${basedir}"
failonerror="false"
resultproperty="buildStatus">
<!-- Adding -consolelog makes for too much, unneeded output, since
the
aggregator produces its verbose own output, slightly cleaner. <arg
value="-consolelog"
/> -->
<arg value="-nosplash" />
<arg value="-data" />
<arg value="${eclipseWorkspaceBase}/runAggregatorCleanBuild" />
<arg value="--launcher.suppressErrors" />
<arg value="-application" />
<arg value="org.eclipse.cbi.p2repo.cli.headless" />
<arg value="aggregate" />
<arg value="--buildId" />
<arg value="${buildTimestamp}" />
<arg line="${AGG_APP_ARGS}" />
<arg line="${vm_setting}" />
<arg line="${builder_vm_args_settings}" />
</exec>
<antcall target="checkStatus">
<param
name="status"
value="${buildStatus}" />
<param
name="message"
value="Aggregation Failed" />
</antcall>
<echo message="Waiting 2 seconds..." />
<sleep seconds="2" />
<echo message="Waiting 2 seconds..." />
<sleep seconds="2" />
<echo message="Waiting 2 seconds..." />
<sleep seconds="2" />
<antcall target="createBuildinfo" />
<antcall target="createXZformats" />
<!-- The tests depend on the symbolic link of "latests" being created,
so we pause a few seconds for NSF to catch up. -->
<echo message="Waiting 2 seconds..." />
<sleep seconds="2" />
<echo message="Waiting 2 seconds..." />
<sleep seconds="2" />
<echo message="Waiting 2 seconds..." />
<sleep seconds="2" />
<antcall target="runTests">
<param
name="tests"
value="cleanBuildTests" />
</antcall>
</target>
<target name="checkStatus">
<echo message="status: ${status}" />
<condition
property="statusOK"
value="true">
<equals
forceString="true"
arg1="${status}"
arg2="0" />
</condition>
<echo message="statusOK: ${statusOK}" />
<antcall target="writeStatus" />
<fail
message="${message}"
unless="statusOK" />
</target>
<target
name="writeStatus"
unless="statusOK">
<echo
message="build failed"
file="${BUILD_HOME}/buildStatusFailed" />
</target>
<!-- Note: many tests would not be valid on "cached" version of repo, but,
some might? Currently no tests are called, but, we might alter, so we
make
sure installed now, in anticipation. -->
<target
name="runAggregatorBuildOnly"
description="Runs an aggregation, but uses prevoiusly cached artifacts, unless new ones are required by contribution"
depends="init,rewriteRepositoryURL,installAggregatorAndTools,initRunTestsXML">
<property
name="AGG_APP_ARGS"
value="${AGGREGATOR_APP_BASE_ARGS} --action BUILD" />
<echo message="AGG_APP_ARGS: ${AGG_APP_ARGS}" />
<!--
Important: on any non-production machines it is important to _not_
use eclipse.p2.mirrors=false, so this value should be supplied by calling
script's properties. Note, we include '-vmargs' here, in case there
are not any. Not sure if the use of -vmargs _requires_ arguments or
not, but
probably would. note: -Declipse.p2.MD5Check=false may be needed as
a workaround
for bug [253713] (should not be required any longer ... but have left
note
for historical reference) Another historical note, we used to "force"
JAVA_5 to be be used for jar processor, see for example, bug 244603
and bug 279596.
But we have not "forced" everyone to use Java 8.
-->
<exec
executable="${eclipseExecutable}"
dir="${basedir}"
failonerror="false"
resultproperty="buildStatus">
<arg value="-debug" />
<arg value="file://${BUILD_HOME_DIR}/p2options/.options" />
<!--
Adding -consolelog makes for too much, unneeded output, since
the aggregator produces its verbose own output, slightly cleaner.
-->
<arg value="-nosplash" />
<arg value="-data" />
<arg value="${eclipseWorkspaceBase}/runAggregatorBuildOnly" />
<arg value="--launcher.suppressErrors" />
<arg value="-application" />
<arg value="org.eclipse.cbi.p2repo.cli.headless" />
<arg value="aggregate" />
<arg value="--buildId" />
<arg value="${buildTimestamp}" />
<arg line="${AGG_APP_ARGS}" />
<arg line="${vm_setting}" />
<arg line="${builder_vm_args_settings}" />
</exec>
<antcall target="checkStatus">
<param
name="status"
value="${buildStatus}" />
<param
name="message"
value="Aggregation Failed" />
</antcall>
<antcall target="createBuildinfo" />
<antcall target="runTests">
<param
name="tests"
value="cachedBuildTests" />
</antcall>
</target>
<!--
Note, we currently have no "tests" for the "validate only" case, but
we could, might someday, so we go ahead an install, in anticipation.
For example, we might simply test that all aggrcon files specify
unique URL (to simple repository) or that "versions" are
specified in *.aggrcon file.
-->
<target
name="runAggregatorValidateOnly"
description="Runs an aggregation, but validates constraints only. Does not fetch artifacts."
depends="init,rewriteRepositoryURL,installAggregatorAndTools,initRunTestsXML">
<property
name="AGG_APP_ARGS"
value="${AGGREGATOR_APP_BASE_ARGS} --action VALIDATE" />
<echo message="AGG_APP_ARGS: ${AGG_APP_ARGS}" />
<exec
executable="${eclipseExecutable}"
dir="${basedir}"
failonerror="false"
resultproperty="buildStatus">
<arg value="-debug" />
<!--
In case extra tracing is desired:
<arg value="file://${BUILD_HOME}/org.eclipse.simrel.tools/p2options/.options"
/>
-->
<!--
Adding -consolelog makes for too much, unneeded output, since
the aggregator produces its verbose own output, slightly cleaner.
-->
<arg value="-nosplash" />
<arg value="-data" />
<arg value="${eclipseWorkspaceBase}/runAggregatorValidateOnly" />
<arg value="--launcher.suppressErrors" />
<arg value="-application" />
<arg value="org.eclipse.cbi.p2repo.cli.headless" />
<arg value="aggregate" />
<arg value="--buildId" />
<arg value="${buildTimestamp}" />
<arg line="${AGG_APP_ARGS}" />
<arg line="${vm_setting}" />
<arg line="${builder_vm_args_settings}" />
</exec>
<antcall target="checkStatus">
<param
name="status"
value="${buildStatus}" />
<param
name="message"
value="Aggregation Failed" />
</antcall>
<!-- setting dir to our workspace, so tests done on what "we" have -->
<antcall target="createBuildinfo" />
<antcall target="runTests">
<param
name="tests"
value="validateOnlyTests" />
</antcall>
</target>
<target
name="runTests"
depends="initRunTestsXML,checkrunTests"
if="runTestsXML">
<ant
antfile="${runTestsXML}"
target="${tests}"
dir="${buildToolsDir}" />
</target>
<target
name="checkrunTests"
depends="initRunTestsXML"
unless="runTestsXML">
<echo message="runTestsXML was not defined as expected. Hence, no tests ran." />
</target>
<target
name="initRunTestsXML"
depends="getBuildToolsDir"
if="toolsAvailable"
unless="runTestsXML">
<path id="runTests.paths">
<fileset
dir="${buildToolsDir}"
includes="runTests.xml" />
</path>
<property
name="runTestsXML"
refid="runTests.paths" />
<echo message="runTestsXML file: ${runTestsXML}" />
</target>
<target name="getBuildToolsDir">
<property
name="buildToolsDir"
value="${BUILD_HOME}/org.eclipse.simrel.tools" />
<available
file="${buildToolsDir}"
property="toolsAvailable" />
</target>
<target
name="init"
depends="getJVMLocation, getBUILD_HOME, setDefaultBUILD_HOME, setDefaultRelease, getBuildTimestamp, getJobName, getJobNumber, getBuildToolsDir, gitRevParseTools, getBuildModelDir, gitRevParseModel"
unless="isInitialized">
<!-- We assign a reasonable value for local builds, but for production
builds should be .../production.properties This property file name
is itself a property, so it can be overridden on one machine versus another.
We do it this way, instead of just specifying -propertyFile on command line,
so that the property values can be "nested" in other property values and
evaluated lazily. -->
<property
name="aggrPropertyFile"
value="${buildToolsDir}/aggr.properties" />
<property file="${aggrPropertyFile}" />
<!--
The "binary platform" is enough, for now, and since smaller than the SDK,
it is recommended as the "base" to install tools into. But a typical "SDK" has been
left in this comment in case users are doing more than a normal "aggregation build".
value="/home/data/httpd/archive.eclipse.org/eclipse/downloads/drops4/R-4.8-201806110500/eclipse-SDK-4.8-linux-gtk-x86_64.tar.gz"
-->
<!--
Note: if there is local file system version of the prereq platform,
if it faster to specify file://<location of platform>.
<property name="platformLocation" value="file:///home/data/httpd/archive.eclipse.org/eclipse/downloads/drops4/R-4.8-201806110500" />
We use "http://" by default to make it easy to "run from anywhere", but
on the production machine, in production.properties, we specify the "file://" form.
-->
<property
name="platformLocation"
value="https://download.eclipse.org/eclipse/downloads/drops4/R-4.8-201806110500/" />
<property
name="platformFilename"
value="eclipse-platform-4.8-linux-gtk-x86_64.tar.gz" />
<property
name="localPrereqCache"
value="${BUILD_HOME}/localPrereqs" />
<property
name="platformResource"
value="${platformLocation}/${platformFilename}" />
<!-- directory must exist before "get" uses it or else the file is given name of "localPrereqs" -->
<mkdir dir="${localPrereqCache}" />
<property
name="ECLIPSE_HOME"
value="${BUILD_HOME}/eclipseInstall" />
<property
name="ECLIPSE_EXE"
value="${ECLIPSE_HOME}/eclipse/eclipse" />
<property
name="AGGREGATOR_RESULTS"
value="${BUILD_HOME}/aggregation" />
<!-- git_protocol should be changed to somethign like "file://" for production
builds, for efficiency and to avoid problems when the "internal" network
is down. (Note no trailing slash). It can be added to a local copy
of 'aggrPropertyFile' -->
<property
name="git_protocol"
value="git://git.eclipse.org" />
<!--
rewriteRepositoryURLValue is an important variable, passed in through
production.properties. It is the trigger to change http:// values,
to file:// values. At one point, we needed, unrewriteMapsLine, to know
how to
"change back" and now use commonRepositoryDownloadURLValue to know
"what to
look for" to change to rewriteRepositoryURLValue, but this should not
be
needed to be changed, since we make the strong assumption that, in
*.aggrcon
files, this string occurs only in repository location attributes. If
not true,
more complex parsing/replacement would be required.
-->
<property
name="commonRepositoryDownloadURLValue"
value="https://download.eclipse.org" />
<condition property="localRepoExists">
<available file="${buildModelDir}/.git" />
</condition>
<property
name="eclipseWorkspaceBase"
value="${BUILD_HOME}/eclipseworkspaces" />
<!--
If the eclipse workspace exists, remove it, to make sure we are
starting "fresh". Eclipse will create it. Be sure some "archive
artifacts" job saves it away, if desired, just for it's ".log",
if nothing else.
-->
<delete
dir="${eclipseWorkspaceBase}"
quiet="true" />
<!-- Note: we put -vmargs directly in builder_vm_args_settings so that if desired
to not have ANY vmargs, then we will not be left with a dangling (empty)
-vmargs at the end of eclipse command line. -->
<property
name="builder_vm_args"
value="-Xmx1024M -Djava.io.tmpdir=${BUILD_HOME}/tmp" />
<condition
property="builder_vm_args_settings"
value="-vmargs ${builder_vm_args}">
<isset property="builder_vm_args" />
</condition>
<!-- tmp directory must exist, for Java to use it -->
<mkdir dir="${BUILD_HOME}/tmp" />
<echo message="Made directory ${BUILD_HOME}/tmp" />
<property
name="eclipseExecutable"
value="${ECLIPSE_EXE}" />
<available
file="${ECLIPSE_HOME}/eclipse"
type="dir"
property="eclipseExists" />
<!-- set installEclipseAndTools on command line to force a reinstall,
Otherwise, only installed if not installed yet. -->
<condition property="installEclipseAndTools">
<not>
<isset property="eclipseExists" />
</not>
</condition>
<!-- saveAndInstallEclipseAndTools should only be true if "installEclipseAndTools"
are set on command line properties (and a version already exists). -->
<condition property="saveAndInstallEclipseAndTools">
<and>
<isset property="eclipseExists" />
<isset property="installEclipseAndTools" />
</and>
</condition>
<!-- note the "https" may have to be "http" on localhost, non-production
hudson machines -->
<property
name="hostForURL"
value="https://hudson.eclipse.org" />
<!-- TODO: this will not be correct for local builds, probably. Could
do
more to detect "local builds" and either not set, or set to correct
values
for a "local hudson". -->
<property
name="LOG_URL"
value="${hostForURL}/simrel/job/${jobName}/${jobNumber}/console" />
<!-- These are the arguments to the aggregator that are constant, whether
doing "production build" or "local build". If doing production build,
then
is also needs the &dash;$dash;production argument (it is the one that
cuases
"blame mail" to be sent). If PRODUCTION is not set externally (such
as on
command line, or in a property file, we set it to blank here to avoid
the
literal '${PRODUCTION} from being passed as an argument. Be sure to
udpate
emailFrom as "build master" changes. -->
<property
name="PRODUCTION"
value="" />
<property
name="p2AgentLocation"
value="${BUILD_HOME}/.p2AgentLocation" />
<!-- In the distant past, we have also used these arguments. The maven
result one was always experimental. We have also learned it it better
not
to "trust" any repository. Can only use one or the other, not both
&dash;&dash;mavenResult
&dash;&dash;trustedContributions Eclipse,Equinox -->
<property
name="AGGREGATOR_APP_BASE_ARGS"
value="${PRODUCTION} --buildModel ${buildModelDir}/simrel.aggr --buildRoot ${AGGREGATOR_RESULTS} --agentLocation ${p2AgentLocation} --eclipseLogLevel DEBUG --logLevel DEBUG --emailFrom frederic.gurr@eclipse-foundation.org --emailFromName ${release}Aggregator --logURL ${LOG_URL} --subjectPrefix ${release}Aggregation" />
<echo message="= = = Properties at end of init = = = " />
<echo message="git_protocol: ${git_protocol}" />
<echo message="PRODUCTION: ${PRODUCTION}" />
<echo message="rewriteRepositoryURLValue: ${rewriteRepositoryURLValue}" />
<echo message="buildModelCommit: ${buildModelCommit}" />
<echo message="toolsRepoCommit: ${toolsRepoCommit}" />
<echo message="aggrPropertyFile: ${aggrPropertyFile}" />
<echo message="buildId: ${buildTimestamp}" />
<echo message="user.dir: ${user.dir}" />
<echo message="user.home: ${user.home}" />
<echo message="BUILD_HOME (normally HUDSON workspace): ${BUILD_HOME}" />
<echo message="Eclipse workspace base: ${eclipseWorkspaceBase}" />
<echo message="PATH: ${env.PATH}" />
<echo message="JAVA_HOME: ${JAVA_HOME}" />
<echo message="hostForURL: ${hostForURL}" />
<echo message="jobName: ${jobName}" />
<echo message="jobNumber: ${jobNumber}" />
<echo message="ECLIPSE_EXE: ${ECLIPSE_EXE}" />
<echo message="eclipseExists: ${eclipseExists}" />
<echo message="builder_vm_args: ${builder_vm_args}" />
<echo message="builder_vm_args_settings: ${builder_vm_args_settings}" />
<echo message=" = = = = = = = = = = = = " />
<echoproperties />
<!-- remove "build failed" status file, if there is one from previous
run. -->
<delete
failonerror="true"
quiet="true">
<fileset dir="${BUILD_HOME}">
<include name="buildStatusFailed" />
</fileset>
</delete>
<!-- no need to initialize twice -->
<property
name="isInitialized"
value="true" />
</target>
<target
name="getBuildTimestamp"
depends="getHudsonTimestamp"
unless="buildTimestamp">
<tstamp>
<format
property="buildTimestamp"
pattern="yyyy-MM-dd_HH-mm-ss"
timezone="UTC_TIME" />
</tstamp>
<echo message="Using Ant computed timestamp (since not running on Hudson): ${buildTimestamp}." />
</target>
<target
name="getHudsonTimestamp"
unless="buildTimestamp"
if="env.BUILD_ID">
<property
name="buildTimestamp"
value="${env.BUILD_ID}" />
<echo message="Using timestamp from Hudson Build ID: ${buildTimestamp}" />
</target>
<target
name="getJobName"
depends="getHudsonJobName"
unless="jobName">
<property
name="jobName"
value="none" />
<echo message="Using default jobName: none." />
</target>
<target
name="getHudsonJobName"
unless="jobName"
if="env.JOB_NAME">
<property
name="jobName"
value="${env.JOB_NAME}" />
<echo message="Using jobName from Hudson Builder: ${jobName}" />
</target>
<target
name="getJobNumber"
depends="getHudsonJobNumber"
unless="jobNumber">
<property
name="jobNumber"
value="none" />
<echo message="Using default jobNumber: ${jobNumber}." />
</target>
<target
name="getHudsonJobNumber"
unless="jobNumber"
if="env.BUILD_NUMBER">
<property
name="jobNumber"
value="${env.BUILD_NUMBER}" />
<echo message="Using jobNumber from Hudson Builder: ${jobNumber}" />
</target>
<target
name="getBUILD_HOME"
depends="getHudsonBUILD_HOME"
unless="BUILD_HOME">
<condition
property="BUILD_HOME"
value="${env.BUILD_HOME}">
<isset property="env.BUILD_HOME" />
</condition>
</target>
<target
name="getHudsonBUILD_HOME"
unless="BUILD_HOME">
<condition
property="BUILD_HOME"
value="${env.WORKSPACE}">
<isset property="env.WORKSPACE" />
</condition>
</target>
<target
name="setDefaultBUILD_HOME"
unless="BUILD_HOME">
<!--
We assume BUILD_HOME is "one up" from directory where build.xml file is.
We always assume the 'simrel.build' and 'simrel.tools' projects are directly under "BUILD_HOME".
-->
<dirname
property="BUILD_HOME"
file="${basedir}" />
<echo
message="WARNING: BUILD_HOME set to a default value, ${BUILD_HOME}. If this is not correct, you must configure is explicitly as an environment variable." />
<echo message=" Note: we always assume the 'simrel.build' and 'simrel.tools' projects are directly under 'BUILD_HOME'" />
</target>
<target
name="setDefaultRelease"
unless="release">
<property
name="release"
value="noReleaseSpecified" />
<echo
message="WARNING: release set to a default value, ${release}. Typically this is not desired and may mean there is a configuration issue." />
</target>
<!-- Only rewrite, if a value has been provided -->
<!-- TODO: should make the "exclude" part automatic based on presence/abscense
of "useTrusted" property -->
<target
name="rewriteRepositoryURL"
if="rewriteRepositoryURLValue"
unless="rewroteURLs">
<replace
dir="${buildModelDir}"
token="${commonRepositoryDownloadURLValue}"
value="${rewriteRepositoryURLValue}">
<include name="*.aggrcon" />
<!-- <exclude name="ep.aggrcon"/> <exclude name="equinox.aggrcon"/> -->
</replace>
<echo message="Rewrote repository location URLs ..." />
<echo message=" From: ${commonRepositoryDownloadURLValue}" />
<echo message=" To: ${rewriteRepositoryURLValue}" />
<echo message=" Excluding no files since no composite artifacts, just agregate" />
<!-- <echo message=" Excluding: ep.aggrcon"/> <echo message=" Excluding:
ep.aggrcon, equinox.aggrcon"/> -->
<property
name="rewroteURLs"
value="true" />
</target>
<target
name="getBuildModelDir"
unless="buildModelDir">
<property
name="buildModelDir"
value="${BUILD_HOME}/org.eclipse.simrel.build" />
</target>
<target name="createXZformats">
<exec
executable="/bin/bash"
dir="${basedir}"
failonerror="true">
<arg line="convertxz.sh ${AGGREGATOR_RESULTS}/final" />
</exec>
</target>
<target
name="createBuildinfo"
depends="init, gitRevParseModel, gitRevParseTools">
<property
name="BUILD_INFO_DIR"
value="${AGGREGATOR_RESULTS}/final/buildInfo" />
<!--
Note: The propertyfile task literally edits the properties,
if the file already exists, does not create a new one. Therefore
we delete it first.
-->
<delete dir="${BUILD_INFO_DIR}" />
<mkdir dir="${BUILD_INFO_DIR}" />
<propertyfile file="${BUILD_INFO_DIR}/buildInfo.properties">
<entry
key="buildModelCommit"
value="${buildModelCommit}" />
<entry
key="toolsRepoCommit"
value="${toolsRepoCommit}" />
<entry
key="triggerJobName"
value="${jobName}" />
<entry
key="triggerJobNumber"
value="${jobNumber}" />
<entry
key="triggerBuildTimestamp"
value="${buildTimestamp}" />
<entry
key="triggerBuildId"
value="${buildTimestamp}" />
</propertyfile>
<!-- echo the key ones to end of log, just to have redundant record. -->
<echo message="buildModelCommit: ${buildModelCommit}" />
<echo message="toolsRepoCommit: ${toolsRepoCommit}" />
<echo message="triggerJobName: ${jobName}" />
<echo message="triggerJobNumber: ${jobNumber}" />
<echo message="triggerBuildTimestamp: ${buildTimestamp}" />
<echo message="triggerBuildId: ${buildTimestamp}" />
<!-- just as well write out everything ... just in case something else
needed in future. -->
<echoproperties destfile="${BUILD_INFO_DIR}/allInfo.properties" />
</target>
<target
name="gitRevParseModel"
depends="getBuildModelDir">
<git-rev-parse
repodir="${buildModelDir}"
returnproperty="buildModelCommit" />
<echo message="In target gitRevParseModel, buildModelCommit: ${buildModelCommit}" />
</target>
<target
name="gitRevParseTools"
depends="getBuildToolsDir"
if="toolsAvailable">
<git-rev-parse
repodir="${buildToolsDir}"
returnproperty="toolsRepoCommit" />
<echo message="In target gitRevParseTools, toolsRepoCommit: ${toolsRepoCommit}" />
</target>
<target
name="default"
description="By default run the runAggregatorValidateOnly target">
<echo message="Using default target:" />
<echo message=" runAggregatorValidateOnly" />
<echo message=" Other meaningful targets to specify explicitly:" />
<echo message=" runAggregatorBuildOnly" />
<echo message=" runAggregatorCleanBuild" />
<antcall target="runAggregatorValidateOnly" />
</target>
<target
name="savePrevious"
depends="init"
if="saveAndInstallEclipseAndTools"
unless="previousSaved">
<!-- Remember, old, saved versions may have to be maually cleaned up,
from
time to time. But probably handled well enough by an occasional, manual
"clean
workspace" from Hudson's web interface. -->
<move
verbose="true"
todir="${ECLIPSE_HOME}/eclipse${buildTimestamp}">
<fileset dir="${ECLIPSE_HOME}/eclipse" />
</move>
<property
name="previousSaved"
value="true" />
</target>
<!-- It is not required for user to specify "vm", only
needed if they want to override the system (or Hudson)
default. We do the "work" in getJVMLocationInternal
so we can set a "null default" in this task.
-->
<target
name="getJVMLocation"
depends="getJVMLocationInternal"
unless="vm_setting">
<!-- if vm_setting not set in 'getJVMLocationInternal'
then we set it to "null" here so that is has a safe value
when later used as <arg line="${vm_setting} />
-->
<property
name="vm_setting"
value="" />
<echo message="vm_setting has no value: ${vm_setting}" />
</target>
<target
name="getJVMLocationInternal"
depends="getJAVA_HOME"
if="JAVA_HOME"
unless="vm_setting">
<property
name="vm_setting"
value="-vm ${JAVA_HOME}/jre/bin" />
<echo message="at end of 'getJVMLocationInternal' vm_setting: ${vm_setting}" />
</target>
<!-- we have all these "checks" and "print out" since
it is not known how ant "knows about" JAVA_HOME.
That is, ant could be running in a Java different from
the one that is desired to be used to run aggregator.
Put another way, users can define JAVA_HOME as an environment
variable, or pass in a -DJAVA_HOME value. The later takes
priority, if both exists.
Example: -DJAVA_HOME=/shared/common/jdk1.8.0_x64-latest
-->
<target
name="getJAVA_HOME"
depends="printPredefinedJAVA_HOME"
unless="JAVA_HOME">
<condition
property="JAVA_HOME"
value="${env.JAVA_HOME}">
<isset property="env.JAVA_HOME" />
</condition>
<echo message="at end of 'getJAVA_HOME', JAVA_HOME: ${JAVA_HOME}" />
</target>
<target
name="printPredefinedJAVA_HOME"
if="JAVA_HOME">
<echo message="Found JAVA_HOME already defined to be ${JAVA_HOME}" />
</target>
<!-- Note: this target may be useful to anyone that has ran "build.xml" from
their IDE workspace, since the build will leave some directories in
their IDE workspace that do not show up in their IDE.
-->
<target
name="cleanAllArtifacts"
depends="getBUILD_HOME, setDefaultBUILD_HOME"
description="This target is primarily for documentation. We do NOT want to call this automatically, since that would interfere with desired caching, etc. But may be desired to create custom versions in future, in some cases, so documented here.">
<!-- Note the strong assumption that "BUILD_HOME" is the same
value when running this 'clean' target, as when
the directories were created.
-->
<delete
dir="${BUILD_HOME}/localPrereqs"
includeemptydirs="true" />
<delete
dir="${BUILD_HOME}/eclipseInstall"
includeemptydirs="true" />
<delete
dir="${BUILD_HOME}/tmp"
includeemptydirs="true" />
<delete
dir="${BUILD_HOME}/aggregation"
includeemptydirs="true" />
</target>
</project>