<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Copyright (c) 2011 Obeo. | |
All rights reserved. This program and the accompanying materials | |
are made available under the terms of the Eclipse Public License v1.0 | |
which accompanies this distribution, and is available at | |
http://www.eclipse.org/legal/epl-v10.html | |
Contributors: | |
Obeo - initial API and implementation | |
$Id: promoter.xml,v 1.35 2012/03/16 17:14:14 sbouchet Exp $ | |
--> | |
<project name="Promoter" default="main"> | |
<!-- | |
This promotion script helps to automatically promote the last sucessful build of tycho based build to correct location. | |
Be sure to use at least ant 1.8.2 to launch this script. | |
Ant 1.8.2 is located here : /shared/common/apache-ant-1.8.2/ | |
on build.eclipse.org, do a | |
$> export ANT_HOME=/shared/common/apache-ant-1.8.2/ | |
--> | |
<property name="downloads.project.root" value="intent" /> | |
<property name="build.root" value="/shared/jobs/mylyn-docs-intent-master-nightly/lastSuccessful/archive/features/org.eclipse.mylyn.docs.intent.update/target/" /> | |
<property name="project.name" value="Mylyn Intent"/> | |
<property name="thirdPartyJarsDir" value="/shared/mylyn/intent" /> | |
<property name="final.updatesite.name" value="mylyn-doc-intent-Update"/> | |
<property name="build.root.updatesite.name" value="org.eclipse.mylyn.docs.intent.update.zip"/> | |
<property name="group.owner" value="mylyn.docs.intent" /> | |
<!--# To permit automatic downloads of non-EPL compatible code, override this to property to "Y" --> | |
<property name="thirdPartyDownloadLicenseAcceptance" value="Y" /> | |
<property name="downloads.root" value="/home/data/httpd/download.eclipse.org/" /> | |
<property name="downloads.area" value="${downloads.root}/${downloads.project.root}" /> | |
<property name="property.file.location" location="${build.root}/promotion/promote.properties" /> | |
<!-- | |
most of the code comes from Athena CBI. | |
see http://wiki.eclipse.org/Common_Build_Infrastructure | |
--> | |
<target name="check.ant-contrib" if="antContribJarUnavailable"> | |
<condition property="thirdPartyDownloadLicenseAcceptanceOK"> | |
<and> | |
<isset property="thirdPartyDownloadLicenseAcceptance" /> | |
<or> | |
<equals arg1="${thirdPartyDownloadLicenseAcceptance}" arg2="Y" /> | |
<equals arg1="${thirdPartyDownloadLicenseAcceptance}" arg2="I accept" /> | |
<equals arg1="${thirdPartyDownloadLicenseAcceptance}" arg2=""I accept"" /> | |
</or> | |
</and> | |
</condition> | |
<antcall target="get.ant-contrib" /> | |
<available file="${thirdPartyJarsDir}/ant-contrib.jar" property="antContribJarAvailable" /> | |
<fail unless="antContribJarAvailable">Error! | |
Ant-Contrib is required. Download it from http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download, | |
then place it in the following location. You can also redefine the path in the promote.properties file: | |
$${thirdPartyJarsDir}/ant-contrib.jar = ${thirdPartyJarsDir}/ant-contrib.jar | |
Or, to download this automatically, see $${relengCommonBuilderDir}/build.properties#thirdPartyDownloadLicenseAcceptance. | |
</fail> | |
</target> | |
<target name="get.ant-contrib" if="thirdPartyDownloadLicenseAcceptanceOK"> | |
<get src="http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download" dest="${java.io.tmpdir}/ant-contrib-1.0b3-bin.zip" usetimestamp="true" /> | |
<mkdir dir="${java.io.tmpdir}/ant-contrib-1.0b3-bin.zip_" /> | |
<unzip src="${java.io.tmpdir}/ant-contrib-1.0b3-bin.zip" dest="${java.io.tmpdir}/ant-contrib-1.0b3-bin.zip_" overwrite="true" /> | |
<mkdir dir="${thirdPartyJarsDir}" /> | |
<copy file="${java.io.tmpdir}/ant-contrib-1.0b3-bin.zip_/ant-contrib/ant-contrib-1.0b3.jar" tofile="${thirdPartyJarsDir}/ant-contrib.jar" failonerror="true" /> | |
<delete dir="${java.io.tmpdir}/ant-contrib-1.0b3-bin.zip_" includeemptydirs="true" quiet="true" /> | |
<delete file="${java.io.tmpdir}/ant-contrib-1.0b3-bin.zip" quiet="true" /> | |
</target> | |
<target name="init"> | |
<condition property="antContribJarUnavailable"> | |
<not> | |
<available file="${thirdPartyJarsDir}/ant-contrib.jar" type="file" /> | |
</not> | |
</condition> | |
<antcall target="check.ant-contrib" /> | |
<!-- This will fail if ant-contrib.jar cannot be found. You can install Ant-Contrib via RPM, or download it here: | |
http://sourceforge.net/projects/ant-contrib/files/ant-contrib/1.0b3/ant-contrib-1.0b3-bin.zip/download | |
--> | |
<taskdef resource="net/sf/antcontrib/antlib.xml"> | |
<classpath> | |
<pathelement location="${thirdPartyJarsDir}/ant-contrib.jar" /> | |
</classpath> | |
</taskdef> | |
<available file="${property.file.location}" property="propertyFileAvailable" /> | |
<fail message="property.file.location property must be defined" unless="propertyFileAvailable" /> | |
</target> | |
<target name="load.properties"> | |
<property file="${property.file.location}" /> | |
</target> | |
<target name="init.properties"> | |
<fail message="build.qualifier property must be defined"> | |
<condition> | |
<not> | |
<and> | |
<isset property="build.qualifier" /> | |
<length string="${build.qualifier}" trim="true" when="greater" length="0" /> | |
</and> | |
</not> | |
</condition> | |
</fail> | |
<propertyregex override="true" property="build.qualifier" input="${build.qualifier}" regexp="v" replace="" casesensitive="false" /> | |
<fail message="version property must be defined"> | |
<condition> | |
<not> | |
<and> | |
<isset property="version" /> | |
<length string="${version}" trim="true" when="greater" length="0" /> | |
</and> | |
</not> | |
</condition> | |
</fail> | |
<if> | |
<and> | |
<isset property="build.alias" /> | |
<length string="${build.alias}" trim="true" when="greater" length="0" /> | |
</and> | |
<then> | |
<property name="final.version.qualifier" value="${build.alias}" /> | |
</then> | |
<else> | |
<property name="final.version.qualifier" value="${build.qualifier}" /> | |
</else> | |
</if> | |
<fail message="build.root property must be defined" unless="build.root" /> | |
<fail message="downloads.area property must be defined" unless="downloads.area" /> | |
</target> | |
<target name="main" depends="init,load.properties,init.properties"> | |
<!-- publish into drops ( Zips ) --> | |
<antcall target="-publish.build.drops" inheritall="true" /> | |
<!-- publish p2 repository --> | |
<antcall target="-publish.build.repository" inheritall="true" /> | |
</target> | |
<target name="-publish.build.drops"> | |
<property name="build.drop.directory" location="${downloads.area}/downloads/drops/${version}/${build.qualifier}" /> | |
<delete dir="${build.drop.directory}" /> | |
<mkdir dir="${build.drop.directory}" /> | |
<!-- copy zip packages --> | |
<copy todir="${build.drop.directory}"> | |
<fileset dir="${build.root}"> | |
<filename name="*.zip" /> | |
</fileset> | |
</copy> | |
<!-- rename UpdateSite zip package --> | |
<move tofile="${build.drop.directory}/${final.updatesite.name}-${final.version.qualifier}.zip" file="${build.drop.directory}/${build.root.updatesite.name}" /> | |
<!-- genereate md5 checksums --> | |
<checksum algorithm="MD5" fileext=".md5" format="MD5SUM"> | |
<fileset dir="${build.drop.directory}" /> | |
</checksum> | |
<fileset id="drop.resources" dir="${build.drop.directory}"> | |
<or> | |
<type type="dir" /> | |
<type type="file" /> | |
</or> | |
</fileset> | |
<!-- chgrp --> | |
<chgrp group="${group.owner}" type="both" verbose="true"> | |
<fileset refid="drop.resources" /> | |
</chgrp> | |
</target> | |
<target name="-publish.build.repository"> | |
<!-- determine the base version --> | |
<propertyregex property="base.version" input="${version}" regexp="^(\d+\.\d+)\.\d+.*$" select="\1" casesensitive="false" /> | |
<!-- setup composite.repository.base and composite.type according to the build type --> | |
<condition property="composite.repository.base" value="interim/${base.version}"> | |
<matches pattern="^I" string="${build.qualifier}" /> | |
</condition> | |
<condition property="composite.repository.base" value="milestones/${base.version}"> | |
<matches pattern="^[MS]" string="${build.qualifier}" /> | |
</condition> | |
<condition property="composite.repository.base" value="releases/${base.version}"> | |
<matches pattern="^R" string="${build.qualifier}" /> | |
</condition> | |
<condition property="composite.repository.base" value="nightly/${base.version}"> | |
<matches pattern="^N" string="${build.qualifier}" /> | |
</condition> | |
<condition property="composite.type" value="Interim"> | |
<matches pattern="^I" string="${build.qualifier}" /> | |
</condition> | |
<condition property="composite.type" value="Milestones"> | |
<matches pattern="^[MS]" string="${build.qualifier}" /> | |
</condition> | |
<condition property="composite.type" value="Releases"> | |
<matches pattern="^R" string="${build.qualifier}" /> | |
</condition> | |
<condition property="composite.type" value="Nightly"> | |
<matches pattern="^N" string="${build.qualifier}" /> | |
</condition> | |
<property name="composite.repository.directory" location="${downloads.area}/updates/${composite.repository.base}" /> | |
<property name="composite.repository.url" value="file:/${composite.repository.directory}" /> | |
<property name="build.repository.directory" location="${composite.repository.directory}/${build.qualifier}" /> | |
<property name="mirror.repository.path" value="${downloads.project.root}/updates/${composite.repository.base}/${build.qualifier}" /> | |
<delete dir="${build.repository.directory}" /> | |
<mkdir dir="${build.repository.directory}" /> | |
<!-- unzip update site to final location --> | |
<unzip dest="${build.repository.directory}"> | |
<fileset dir="${build.root}"> | |
<filename name="${build.root.updatesite.name}" /> | |
</fileset> | |
</unzip> | |
<!-- adding p2.index --> | |
<echo file="${build.repository.directory}/p2.index" message="version = 1${line.separator}metadata.repository.factory.order = content.xml,\!${line.separator}artifact.repository.factory.order = artifacts.xml,\!" /> | |
<!-- adding p2.mirrorsURL and p2.statsURI to the repository --> | |
<unzip dest="${build.repository.directory}"> | |
<fileset file="${build.repository.directory}/artifacts.jar" /> | |
</unzip> | |
<move file="${build.repository.directory}/artifacts.xml" tofile="${build.repository.directory}/artifacts.original.xml" /> | |
<xslt style="p2.xsl" in="${build.repository.directory}/artifacts.original.xml" out="${build.repository.directory}/artifacts.xml"> | |
<param name="mirrorsURL" expression="http://www.eclipse.org/downloads/download.php?file=${mirror.repository.path}&format=xml" /> | |
</xslt> | |
<zip destfile="${build.repository.directory}/artifacts.jar" basedir="${build.repository.directory}" includes="artifacts.xml" /> | |
<delete file="${build.repository.directory}/artifacts.xml" /> | |
<delete file="${build.repository.directory}/artifacts.original.xml" /> | |
<!-- add to composite repo --> | |
<ant antfile="/shared/modeling/tools/promotion/manage-composite.xml" target="add" dir="${composite.repository.directory}"> | |
<property name="user.dir" value="${composite.repository.directory}" /> | |
<property name="child.repository" value="${build.qualifier}" /> | |
<property name="composite.name" value="${project.name} ${base.version} ${composite.type} Update Site" /> | |
</ant> | |
<!-- add p2.index on top of composite repo is needed --> | |
<if> | |
<not> | |
<available file="${composite.repository.directory}/p2.index" type="file" /> | |
</not> | |
<then> | |
<echo file="${composite.repository.directory}/p2.index" message="version = 1${line.separator}metadata.repository.factory.order = compositeContent.xml,\!${line.separator}artifact.repository.factory.order = compositeArtifacts.xml,\!" /> | |
</then> | |
</if> | |
<fileset id="repository.resources" dir="${composite.repository.directory}"> | |
<or> | |
<filename name="compositeContent.*" /> | |
<filename name="compositeArtifacts.*" /> | |
<filename name="p2.index" /> | |
<filename name="${build.qualifier}/**" /> | |
</or> | |
</fileset> | |
<!-- chgrp --> | |
<chgrp group="${group.owner}" type="both" verbose="true"> | |
<fileset refid="repository.resources" /> | |
</chgrp> | |
</target> | |
</project> |