blob: 8a12e99bdd4e13dec03d494f5e89485faf4e45f5 [file] [log] [blame]
<project
name="label"
default="label"
basedir=".">
<!-- = = = 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"/>
<!-- = = = end standard properties pattern = = = -->
<target
name="init">
<!-- Capture the computer name in a cross-platform manner -->
<property
name="env.COMPUTERNAME"
value="${env.HOSTNAME}"/>
<!-- buildDirectory should always be set by caller, but in case not, such as for local test, set to some recognizable, usable value
or, for production, fail if buildDirectory has not been set, as that would be indicate a scripting error
<property
name="buildDirectory"
value="localtest"/>
-->
<fail
unless="buildDirectory"/>
<mkdir
dir="${buildDirectory}"/>
<available
file="${buildDirectory}/label.properties"
property="label.properties.exists"/>
</target>
<target
name="label"
depends="init"
unless="label.properties.exists">
<!-- date and time are normally not used, normally cctimestamp is set, but in case not running in cc, we'll
fall back on date/time -->
<tstamp>
<format
property="date"
pattern="yyyyMMdd"
timezone="UTC"/>
</tstamp>
<tstamp>
<format
property="time"
pattern="HHmm"
timezone="UTC"/>
</tstamp>
<condition
property="timestamp"
value="${cctimestamp}"
else="${date}${time}">
<isset
property="cctimestamp"/>
</condition>
<echo
message="cctimestamp: ${cctimestamp}"/>
<echo
message="datetime: ${date}${time} "/>
<echo
message="timestamp: ${timestamp}"/>
<!-- build type should always be set by caller, but in case not, such as for local testing of script, we'll set to 'U' for "unknown" -->
<property
name="buildType"
value="U"/>
<property
name="buildId"
value="${buildType}${timestamp}"/>
<!--this naming convention used by php scripts on download server-->
<property
name="buildLabel"
value="${buildType}-${buildId}-${timestamp}"/>
<!--store the build label information in a file-->
<!--note the line.separator is required to be immune to the exact formatting -->
<echo
file="${buildDirectory}/label.properties"
append="true">buildComputer=${env.COMPUTERNAME}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">buildOS=${env.OS}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">buildType=${buildType}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">buildId=${buildId}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">timestamp=${timestamp}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">buildLabel=${buildLabel}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">date=${date}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">time=${time}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">buildBranch=${buildBranch}${line.separator}</echo>
<echo
file="${buildDirectory}/label.properties"
append="true">projectname=${projectname}${line.separator}</echo>
</target>
</project>