blob: 2d918edf3e4b665d62e9a53b68c1b6a94867601c [file] [log] [blame]
<?xml version="1.0"?>
<!--************************************************************************
* Copyright (c) 2007-2008, Eclipse Foundation
* The code, documentation and other materials contained herein have been
* licensed under the Eclipse Public License - v 1.0 by the copyright holder
* listed above, as the Initial Contributor under such license. The text of
* such license is available at www.eclipse.org.
************************************************************************-->
<project
name="project"
default="default"
basedir=".">
<taskdef
name="AddEntry"
classname="org.eclipse.releng.generators.rss.RSSFeedAddEntryTask"
classpath="org.eclipse.build.tools/feedTools.jar" />
<target
name="get.properties">
<!-- Note: the "highest level of override is for someone to specify their
own location and name for the ganymatic properties. But, if not specified
already, we'll try ${user.home}/ganymedeConfig/ganymatic.properties.
After that, we will still use our production machine defaults since it
won't hurt if users override all the values (and is the only values used on
production build machine).
-->
<property
environment="env" />
<property
name="ganymatic.properties.file"
location="${user.home}/ganymedeConfig/ganymatic.properties" />
<property name="EOL" value="${line.separator}"/>
<!-- avoid writes to 'tools' directory ... occasionally can have permission problems
if 'tools' is not checked out with orbitBuild id
<echo message="G_CVS_WRITE_INFO: ${env.G_CVS_WRITE_INFO}${EOL}" file="debugScripts.txt"/>
<echo message="cctimestamp: ${cctimestamp}${EOL}" file="debugScripts.txt" append="true"/>
<echo message="TAG_PROJECTS: ${env.TAG_PROJECTS}${EOL}" file="debugScripts.txt" append="true"/>
<echo message="currentDirectory: ${basedir}" file="debugScripts.txt" append="true"/>
-->
<!-- <echo message=" Properties being read from ${ganymatic.properties.file}" /> -->
<property
file="${ganymatic.properties.file}" />
<!-- <echo message=" Properties being read from ganymatic.properties" /> -->
<property
file="ganymatic.properties" />
<!-- <echo message="staging.dir: ${staging.dir}" /> -->
<!-- now verify -->
<antcall
target="verify.properties.ganymatic.website.dir" />
<antcall
target="verify.properties.ganymatic.website.url" />
</target>
<target
name="generate.ganymatic.website"
description="Generate the base Ganymatic website">
<mkdir
dir="${ganymatic.website.dir}" />
<mkdir
dir="${ganymatic.website.dir}/latest/" />
<mkdir
dir="${ganymatic.website.dir}/latest-good/" />
<mkdir
dir="${ganymatic.website.dir}/recent/" />
<copy
overwrite="true"
verbose="true"
todir="${ganymatic.website.dir}">
<fileset
dir="website/" />
</copy>
<antcall
target="set.permissions" />
</target>
<target
name="compile.webgen"
description="Compile the Java code for the webgen tool">
<mkdir
dir="bin/" />
<javac
srcdir="src/"
destdir="bin/">
<include
name="**/*.java" />
</javac>
</target>
<target
name="start.latest.log"
description="Reset the latest log for a new run"
depends="compile.webgen">
<delete
verbose="true">
<fileset
dir="${ganymatic.website.dir}/latest/"
includes="**/*" />
</delete>
<java
classpath="bin/"
classname="org.eclipse.ganymede.webgen.GenerateStatusFile">
<arg
value="${ganymatic.website.dir}/latest/" />
</java>
</target>
<target
name="run.siteassembler"
description="Run the site assembler">
<antcall
target="start.latest.log" />
<echo
message="starting inner" />
<subant
antfile="build-inner.xml"
buildpath="."
failonerror="false"
output="${ganymatic.website.dir}/latest/log.txt">
</subant>
<!-- <copy
verbose="true"
tofile="${ganymatic.website.dir}/latest/log.txt">
<fileset file="samplelog.txt"/>
</copy> -->
<echo
message="end of inner" />
<antcall
target="parse.log.file" />
</target>
<target
name="copy.to.staging"
description="Copy the generated site to the staging directory"
depends="get.properties,get.build.status.properties"
if="ganymatic.build.successful">
<antcall
target="copy.to.staging.inner" />
</target>
<target
name="copy.to.staging.inner"
if="staging.dir">
<property
name="site.dir.loc"
location="${site.dir}" />
<delete failonerror="false" verbose="true">
<fileset
dir="${staging.dir}"
includes="site.xml" />
<fileset
dir="${staging.dir}/features" />
<fileset
dir="${staging.dir}/plugins" />
<fileset
dir="${staging.dir}"
includes="digest.zip" />
<fileset
dir="${staging.dir}"
includes="content.jar" />
<fileset
dir="${staging.dir}"
includes="artifacts.jar" />
<fileset
dir="${staging.dir}/bin" />
</delete>
<copy
todir="${staging.dir}"
verbose="true">
<dirset
dir="${site.dir.loc}"
includes="features" />
<dirset
dir="${site.dir.loc}"
includes="plugins" />
<fileset
dir="${site.dir.loc}"
includes="*" />
<fileset
dir="${site.dir.loc}"
includes="**/*" />
</copy>
<chmod
perm="a+rx"
verbose="true">
<dirset
dir="${staging.dir}"
includes="**/*" />
</chmod>
<chmod
perm="a+r"
verbose="true"
parallel="false">
<fileset
dir="${staging.dir}"
includes="**/*" />
</chmod>
<!-- And also, create fresh digest for staging. -->
<!-- TODO: this would need work to be platform independent,
but shouldn't be too hard, since the shell script uses java and jar processor
would mostly just have to get "ant variables" from the several environment variables -->
<exec
dir="${env.GANYMEDE_BUILD_HOME}/workingdir/org.eclipse.ganymede.tools"
executable="sh"
os="Linux"
failonerror="false">
<arg
line="createDigest.sh" />
</exec>
<exec
dir="${env.GANYMEDE_BUILD_HOME}/workingdir/org.eclipse.ganymede.tools"
executable="sh"
os="Linux"
failonerror="false">
<arg
line="createP2repo.sh" />
</exec>
</target>
<target
name="parse.log.file"
description="Parse the log file and generate the web pages">
<java
classpath="bin/"
classname="org.eclipse.ganymede.webgen.ParseLogFile">
<arg
value="${ganymatic.website.dir}/latest/" />
</java>
<chmod
perm="a+r"
verbose="true">
<fileset
dir="${ganymatic.website.dir}/latest">
<include
name="**/*" />
</fileset>
</chmod>
</target>
<target
name="get.build.status.properties"
description="Get the latest build status as properties so that we can make decisions based on them">
<java
classpath="bin/"
classname="org.eclipse.ganymede.webgen.GetStatusAsPropertyFile">
<arg
value="${ganymatic.website.dir}/latest/" />
<arg
value="end-time-property-file.properties" />
</java>
<property
file="end-time-property-file.properties" />
<!-- <copy file="end-time-property-file.properties" tofile="debug_end-time-property-file.properties"/> -->
<delete
file="end-time-property-file.properties" />
</target>
<target
name="update.recent"
description="Copy latest to recent and trim number of recent if needed"
depends="get.build.status.properties">
<!-- could use symbolic links on unix systems instead of copying the directories; if I knew how to do operating system variants of ant files, I would -->
<mkdir
dir="${ganymatic.website.dir}/recent/${ganymatic.build.endtime}/" />
<copy
verbose="true"
todir="${ganymatic.website.dir}/recent/${ganymatic.build.endtime}/">
<fileset
dir="${ganymatic.website.dir}/latest/" />
</copy>
<!-- delete files from previous run, if they exist. They are left
after the run, to easy debugging -->
<delete
file="trim-these-recent-dirs.txt"
failonerror="false" />
<delete
file="trim-these-recent-dirs2.txt"
failonerror="false" />
<java
classpath="bin/"
classname="org.eclipse.ganymede.webgen.GetRecentTrimAsFile">
<arg
value="${ganymatic.website.dir}/recent/" />
<arg
value="trim-these-recent-dirs.txt" />
<arg
value="trim-these-recent-dirs2.txt" />
</java>
<delete
verbose="true">
<fileset
dir="${ganymatic.website.dir}/recent/"
includesfile="trim-these-recent-dirs.txt"
defaultexcludes="no">
</fileset>
</delete>
<delete
verbose="true"
includeemptydirs="true">
<dirset
dir="${ganymatic.website.dir}/recent/"
includesfile="trim-these-recent-dirs2.txt">
</dirset>
</delete>
</target>
<target
name="update.latest-good"
description="Copy latest to latest-good if it was successful"
depends="get.build.status.properties"
if="ganymatic.build.successful">
<copy
overwrite="true"
verbose="true"
todir="${ganymatic.website.dir}/latest-good/">
<fileset
dir="${ganymatic.website.dir}/latest/" />
</copy>
<antcall target="tagProjects" />
</target>
<target
name="default"
description="The main target"
depends="setup,run.siteassembler,copy.to.staging,report">
</target>
<target
name="setup"
description="Set up the environment"
depends="get.properties,generate.ganymatic.website">
</target>
<target
name="report"
description="Process the logs and generate reports"
depends="update.recent,update.latest-good,publish.all.rss,publish.failed.rss,publish.successful.rss,email.on.failure,set.permissions">
</target>
<target
name="set.permissions"
description="Ensure that all files in the output directory are world readable">
<!-- be specific, since our "website" contains other big directories that are not part of website -->
<chmod
perm="a+r"
verbose="true">
<fileset
dir="${ganymatic.website.dir}">
<include
name="*" />
<include
name="latest/**/*" />
<include
name="latest-good/**/*" />
<include
name="recent/**/*" />
</fileset>
</chmod>
<chmod
perm="a+rx"
verbose="true">
<dirset
dir="${ganymatic.website.dir}">
<include
name="latest/**/*" />
<include
name="latest-good/**/*" />
<include
name="recent/**/*" />
</dirset>
</chmod>
</target>
<target
name="email.on.failure"
description="Email failure notices to responsible parties"
depends="checkEmailEnabled"
if="emailEnabled">
<echo
message="Email failure notices to ${ganymatic.build.error.emails}" />
<antcall
target="inner.email.on.failure" />
</target>
<target
name="inner.email.on.failure"
description="Really do the emailing"
if="ganymatic.email.from.address">
<mail
tolist="${ganymatic.build.error.emails}"
subject="Ganymede build failed"
encoding="plain"
failonerror="false">
<from
name="${ganymatic.email.from.name}"
address="${ganymatic.email.from.address}" />
<message>This auto-generated email is to inform you that
the Ganymede build has failed and your project has been
"blamed" by the auto-blame-parsing system. Please check
the log (${ganymatic.website.url}) and fix any errors
associated with your project.</message>
</mail>
</target>
<target
name="create.build.alias.success"
if="ganymatic.build.successful">
<property
name="build.alias"
value="${buildAlias}" />
</target>
<target
name="create.build.alias.fail"
unless="ganymatic.build.successful">
<property
name="build.alias"
value="${buildAlias} !!FAILED!!" />
</target>
<target
name="publish.all.rss"
description="Publish the RSS feed"
depends="create.build.alias.success,create.build.alias.fail">
<echo
message="Publishing the main RSS feed" />
<property
file="org.eclipse.build.tools/blank.properties" />
<!-- Add an entry (and create the feed if it doesn't already exist) -->
<AddEntry
debug="0"
file="${ganymatic.website.dir}/builds.rss"
project="${project}"
version="${version}"
branch="${branch}"
buildID="${ganymatic.build.endtime}"
buildtype="I"
feedURL="${ganymatic.website.url}/builds.rss"
buildURL="${ganymatic.website.url}/recent/${ganymatic.build.endtime}"
buildAlias="${build.alias}"
buildDetailURL="${buildDetailURL}"
buildConfigURL="${buildConfigURL}"
buildLogURL="${buildLogURL}"
buildMapURL="${buildMapURL}"
dependencyURLs="${dependencyURLs}"
releases="${Releases}"
releaseNotesURL="${releaseNotesURL}"
updateManagerURL="${updateManagerURL}"
downloadsURL="${downloadsURL}"
jarSigningStatus="${jarSigningStatus}"
coordinatedStatus="${coordinatedStatus}"
coordinatedDetails="${coordinatedDetails}"
JUnitTestURL="${JUnitTestURL}"
performanceTestURL="${performanceTestURL}"
APITestURL="${APITestURL}"
JUnitTestResults="${JUnitTestResults}"
performanceTestResults="${performanceTestResults}"
APITestResults="${APITestResults}" />
</target>
<target
name="publish.failed.rss"
description="Publish the RSS feed"
depends="publish.all.rss"
unless="ganymatic.build.successful">
<echo
message="Publishing the failed RSS feed" />
<property
file="org.eclipse.build.tools/blank.properties" />
<!-- Add an entry (and create the feed if it doesn't already exist) -->
<AddEntry
debug="0"
file="${ganymatic.website.dir}/fail.rss"
project="${project}"
version="${version}"
branch="${branch}"
buildID="${ganymatic.build.endtime}"
buildtype="I"
feedURL="${ganymatic.website.url}/fail.rss"
buildURL="${ganymatic.website.url}/recent/${ganymatic.build.endtime}"
buildAlias="${build.alias}"
buildDetailURL="${buildDetailURL}"
buildConfigURL="${buildConfigURL}"
buildLogURL="${buildLogURL}"
buildMapURL="${buildMapURL}"
dependencyURLs="${dependencyURLs}"
releases="${Releases}"
releaseNotesURL="${releaseNotesURL}"
updateManagerURL="${updateManagerURL}"
downloadsURL="${downloadsURL}"
jarSigningStatus="${jarSigningStatus}"
coordinatedStatus="${coordinatedStatus}"
coordinatedDetails="${coordinatedDetails}"
JUnitTestURL="${JUnitTestURL}"
performanceTestURL="${performanceTestURL}"
APITestURL="${APITestURL}"
JUnitTestResults="${JUnitTestResults}"
performanceTestResults="${performanceTestResults}"
APITestResults="${APITestResults}" />
</target>
<target
name="publish.successful.rss"
description="Publish the RSS feed"
depends="publish.all.rss"
if="ganymatic.build.successful">
<echo
message="Publishing the successful RSS feed" />
<property
file="org.eclipse.build.tools/blank.properties" />
<!-- Add an entry (and create the feed if it doesn't already exist) -->
<AddEntry
debug="0"
file="${ganymatic.website.dir}/success.rss"
project="${project}"
version="${version}"
branch="${branch}"
buildID="${ganymatic.build.endtime}"
buildtype="I"
feedURL="${ganymatic.website.url}/success.rss"
buildURL="${ganymatic.website.url}/recent/${ganymatic.build.endtime}"
buildAlias="${build.alias}"
buildDetailURL="${buildDetailURL}"
buildConfigURL="${buildConfigURL}"
buildLogURL="${buildLogURL}"
buildMapURL="${buildMapURL}"
dependencyURLs="${dependencyURLs}"
releases="${Releases}"
releaseNotesURL="${releaseNotesURL}"
updateManagerURL="${updateManagerURL}"
downloadsURL="${downloadsURL}"
jarSigningStatus="${jarSigningStatus}"
coordinatedStatus="${coordinatedStatus}"
coordinatedDetails="${coordinatedDetails}"
JUnitTestURL="${JUnitTestURL}"
performanceTestURL="${performanceTestURL}"
APITestURL="${APITestURL}"
JUnitTestResults="${JUnitTestResults}"
performanceTestResults="${performanceTestResults}"
APITestResults="${APITestResults}" />
</target>
<target
name="verify.properties.ganymatic.website.dir"
unless="ganymatic.website.dir">
<echo
message="Missing: ganymatic.website.dir" />
<antcall
target="verify.properties.error" />
</target>
<target
name="verify.properties.ganymatic.website.url"
unless="ganymatic.website.url">
<echo
message="Missing: ganymatic.website.url" />
<antcall
target="verify.properties.error" />
</target>
<target
name="verify.properties.error">
<echo
message="Required properties were not defined in a ganymatic.properties, for example '${user.home}/ganymedeConfig/ganymatic.properties' file." />
<echo
message="Please create a ganymatic.properties file in your home directory, in a directory named ganymedeConfig." />
<echo
message="Use the examples/ganymatic.properties* files as templates for your file." />
<echo
message="The ganymatic.properties file defines the directories, etc for the builds on your machine." />
<fail
message="No properties defined; failed to build" />
</target>
<target
name="checkEmailEnabled">
<!-- send email only if explicitly enabled, as it would be on production build machine,
but not on local or test machines -->
<condition
property="emailEnabled">
<and>
<equals
arg1="true"
arg2="${env.ENABLE_EMAIL}" />
<isset property="ganymatic.build.error.emails" />
</and>
</condition>
<echo message="ENABLE_EMAIL: ${env.ENABLE_EMAIL}" />
<echo message="ganymatic.build.error.emails: ${ganymatic.build.error.emails}" />
<echo message="emailEnabled: ${emailEnabled}" />
</target>
<target
name="tagProjects"
depends="checkTagProjects"
if="tagCVSProjects">
<cvs
cvsRoot="${env.G_CVS_WRITE_INFO}/cvsroot/callisto"
dest="${env.GANYMEDE_BUILD_HOME}/workingdir/org.eclipse.ganymede.tools"
command="tag v${cctimestamp}" />
<cvs
cvsRoot="${env.G_CVS_WRITE_INFO}/cvsroot/callisto"
dest="${env.GANYMEDE_BUILD_HOME}/workingdir/org.eclipse.ganymede.sitecontributions"
command="tag v${cctimestamp}" />
<echo message=" tagged site contributions for this build with v${cctimestamp}" />
</target>
<!-- only tag projects if both a "write id" has been provided, and tag_projects variable set -->
<target
name="checkTagProjects">
<condition
property="tagCVSProjects">
<and>
<equals
arg1="${env.TAG_PROJECTS}"
arg2="true" />
<isset property="cctimestamp" />
<isset property="env.G_CVS_WRITE_INFO" />
</and>
</condition>
<echo message="TAG_PROJECTS: ${env.TAG_PROJECTS}"/>
<echo message="cctimestamp: ${cctimestamp}"/>
<echo message="G_CVS_WRITE_INFO: ${env.G_CVS_WRITE_INFO}"/>
<echo message="tagCVSProjects: ${tagCVSProjects}"/>
</target>
</project>