| <?xml version="1.0"?> |
| <!-- |
| Copyright (c) 2017, 2018 Eike Stepper (Loehne, Germany) and others. |
| 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: |
| Eike Stepper - initial API and implementation |
| --> |
| <project name="build-info" default="build-info"> |
| |
| <property file="ant.properties" /> |
| <property environment="env" /> |
| |
| <delete> |
| <fileset dir="${env.WORKSPACE}"> |
| <include name="build-info.properties"/> |
| <include name="build-info.xml"/> |
| </fileset> |
| </delete> |
| |
| <taskdef resource="net/sf/antcontrib/antlib.xml"> |
| <classpath> |
| <pathelement location="lib/ant-contrib-1.0b3.jar" /> |
| </classpath> |
| </taskdef> |
| |
| <target name="build-info"> |
| <!-- build.trigger --> |
| <if> |
| <not> |
| <isset property="build.trigger" /> |
| </not> |
| <then> |
| <xmlproperty keeproot="false"> |
| <url url="${env.BUILD_URL}/api/xml?tree=actions[causes[shortDescription]]" /> |
| </xmlproperty> |
| <loadresource property="build.trigger"> |
| <propertyresource name="action.cause.shortDescription" /> |
| <filterchain> |
| <replaceregex pattern="^Triggered by an " replace="" /> |
| <replaceregex pattern="^Triggered by " replace="" /> |
| <replaceregex pattern="^Started by an " replace="" /> |
| <replaceregex pattern="^Started by " replace="" /> |
| <replaceregex pattern="^Gerrit: .*" replace="gerrit" /> |
| </filterchain> |
| </loadresource> |
| </then> |
| </if> |
| |
| <!-- build.type --> |
| <if> |
| <equals arg1="${env.BUILD_TYPE}" arg2="<default>" /> |
| <then> |
| <condition property="build.type" value="${weekly}" else="N"> |
| <equals arg1="${build.trigger}" arg2="timer" /> |
| </condition> |
| </then> |
| <else> |
| <property name="build.type" value="${env.BUILD_TYPE}" /> |
| </else> |
| </if> |
| |
| <!-- build.sign --> |
| <if> |
| <equals arg1="${build.type}" arg2="N" /> |
| <then> |
| <property name="build.sign" value="false" /> |
| <delete file="${env.WORKSPACE}/signing.marker" failonerror="false" /> |
| </then> |
| <else> |
| <property name="build.sign" value="true" /> |
| <touch file="${env.WORKSPACE}/signing.marker" /> |
| </else> |
| </if> |
| |
| <!-- build.qualifier --> |
| <property name="build.qualifier.date" value="${env.BUILD_TIMESTAMP}" /> |
| <property name="build.qualifier" value="${build.type}${build.qualifier.date}" /> |
| <property name="build.version" value="v${build.qualifier.date}" /> |
| |
| <!-- build-info.xml --> |
| <echoxml file="${env.WORKSPACE}/build-info.xml"> |
| <build stream="${stream}" |
| branch="${branch}" |
| train="${train}" |
| eclipse="${eclipse}" |
| emf="${emf}" |
| type="${build.type}" |
| timestamp="${build.qualifier.date}" |
| qualifier="${build.qualifier}" |
| trigger="${build.trigger}" |
| hudson="${env.HUDSON_URL}" |
| revision="${env.GIT_COMMIT}" |
| job="${env.JOB_NAME}" |
| number="${env.BUILD_NUMBER}" /> |
| </echoxml> |
| |
| <!-- build-info.properties --> |
| <echoproperties prefix="build." destfile="${env.WORKSPACE}/build-info.properties" /> |
| |
| <!-- Echo --> |
| <echo message="stream = ${stream}" /> |
| <echo message="branch = ${branch}" /> |
| <echo message="train = ${train}" /> |
| <echo message="build.type = ${build.type}" /> |
| <echo message="build.sign = ${build.sign}" /> |
| <echo message="build.trigger = ${build.trigger}" /> |
| <echo message="build.qualifier = ${build.qualifier}" /> |
| </target> |
| |
| </project> |