common/templates/tag-hg-code.ant.xml.ftl
author Simon Howkins <simonh@symbian.org>
Tue, 19 Oct 2010 11:11:40 +0100
changeset 1309 2ea5b5b66973
parent 1152 08f7282dae54
permissions -rw-r--r--
Adjusted release tagging, so that it clones from the package source, not dst, and hence it's much less likely that the tagging operation will create multiple heads on the TAGS branch.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41
f137ddbb714d Added tagging of source code used in the build
dariosestito@L063522.prod.ad.symbian.intra
parents:
diff changeset
     1
<?xml version="1.0"?>
f137ddbb714d Added tagging of source code used in the build
dariosestito@L063522.prod.ad.symbian.intra
parents:
diff changeset
     2
<project name="SF-TAG-HG-CODE" default="all" xmlns:hlm="http://www.nokia.com/helium">
f137ddbb714d Added tagging of source code used in the build
dariosestito@L063522.prod.ad.symbian.intra
parents:
diff changeset
     3
1046
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
     4
	<#assign dollar = "$"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
     5
	
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
     6
	<#assign target_depends = "" />
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
     7
	<#assign count = 0 />
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
     8
	
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
     9
	<#list data as pkg_detail>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    10
		<target name="sf-tag-hg-code-${count}">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    11
			<echo message="Cloning TAGS branch from ${pkg_detail.dst}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    12
			<mkdir dir="${ant['build.drive']}/tagging${pkg_detail.dst}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    13
			<exec executable="hg" dir="${ant['build.drive']}/" failonerror="false" resultproperty="clone.from.dst.${count}.exitcode" errorproperty="clone.from.dst.${count}.stderr">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    14
				<arg value="--quiet"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    15
				<arg value="clone"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    16
				<arg value="--rev"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    17
				<arg value="TAGS"/>
1309
2ea5b5b66973 Adjusted release tagging, so that it clones from the package source, not dst, and hence it's
Simon Howkins <simonh@symbian.org>
parents: 1152
diff changeset
    18
				<arg value="${pkg_detail.source}"/>
1046
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    19
				<arg value="tagging${pkg_detail.dst}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    20
			</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    21
			<if>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    22
				<not>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    23
					<equals arg1="${dollar}{clone.from.dst.${count}.exitcode}" arg2="0"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    24
				</not>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    25
				<then>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    26
					<!-- TAGS branch not in local source - probably caused by package being new and not having a TAGS branch yet -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    27
					<echo message="Clone failed because '${dollar}{clone.from.dst.${count}.stderr}'"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    28
					<!-- Clone the null revision instead -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    29
					<exec executable="hg" dir="${ant['build.drive']}" failonerror="true">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    30
						<arg value="--quiet"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    31
						<arg value="clone"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    32
						<arg value="--rev"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    33
						<arg value="null"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    34
						<arg value="${pkg_detail.dst}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    35
						<arg value="tagging${pkg_detail.dst}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    36
					</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    37
					<!-- Create the branch -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    38
					<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    39
						<arg value="branch"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    40
						<arg value="TAGS"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    41
					</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    42
					<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}" logError="true">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    43
						<arg value="--quiet"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    44
						<arg value="commit"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    45
						<arg value="--message"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    46
						<arg value="Created TAGS branch"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    47
					</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    48
					<!-- Push it back to the source repo -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    49
					<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}" logError="true">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    50
						<arg value="--quiet"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    51
						<arg value="push"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    52
						<arg value="--force"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    53
						<arg value="--rev"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    54
						<arg value="."/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    55
					</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    56
				</then>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    57
			</if>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    58
			<!-- Find out what we're synced to in the main source repo -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    59
			<exec executable="hg" dir="${ant['build.drive']}" outputproperty="hash12.${count}" logError="true">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    60
				<arg value="id"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    61
				<arg value="-i"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    62
				<arg value="${pkg_detail.dst}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    63
			</exec>
1152
08f7282dae54 Improved hg tagging automation to deal with the unfortunate situation of a package overwriting it's own source files during the build.
Simon Howkins <simonh@symbian.org>
parents: 1083
diff changeset
    64
			<!-- Remove any '+' on the end of the hash (indicating that the package overwrote some of its own source files during the build) -->
08f7282dae54 Improved hg tagging automation to deal with the unfortunate situation of a package overwriting it's own source files during the build.
Simon Howkins <simonh@symbian.org>
parents: 1083
diff changeset
    65
			<propertyregex property="hash12.${count}" override="true" input="${dollar}{hash12.${count}}" regexp="\+$" replace=""/>
1046
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    66
			<!-- Get the full hash id -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    67
			<exec executable="hg" dir="${ant['build.drive']}${pkg_detail.dst}" outputproperty="hash40.${count}" logError="true">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    68
				<arg value="log"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    69
				<arg value="--rev"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    70
				<arg value="${dollar}{hash12.${count}}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    71
				<arg value="--template"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    72
				<arg value="{node}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    73
			</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    74
			<!-- Manually add the tag to the tags file -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    75
			<echo message="${dollar}{hash40.${count}} ${ant['sf.tagafterbuild.tag']}${dollar}{line.separator}" file="${ant['build.drive']}/tagging${pkg_detail.dst}/.hgtags" append="true"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    76
			<!-- Make sure the file is added (in case this is the first tagging for this package) -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    77
			<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}" output="nul:">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    78
				<arg value="add"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    79
				<arg value=".hgtags"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    80
			</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    81
			<!-- Manually commit it -->
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    82
			<exec executable="hg" dir="${ant['build.drive']}/tagging${pkg_detail.dst}" logError="true">
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    83
				<arg value="--quiet"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    84
				<arg value="commit"/>
1083
a91d8608229c Added specification of changeset author when committing.
Simon Howkins <simonh@symbian.org>
parents: 1046
diff changeset
    85
				<arg value="--user"/>
a91d8608229c Added specification of changeset author when committing.
Simon Howkins <simonh@symbian.org>
parents: 1046
diff changeset
    86
				<arg value="${dollar}{sf.hg.ui.username}"/>
1046
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    87
				<arg value="--message"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    88
				<arg value="Added tag ${ant['sf.tagafterbuild.tag']} for changeset ${dollar}{hash12.${count}}"/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    89
			</exec>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    90
		</target>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    91
		
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    92
		<#if (count > 0) >
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    93
			<#assign target_depends ="${target_depends}" + ", "/>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    94
		</#if>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    95
		<#assign target_depends = "${target_depends}" + "sf-tag-hg-code-${count}" />
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    96
		
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    97
		<#assign count = count + 1 />
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    98
	</#list>
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
    99
	
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
   100
	<target name="all" depends="${target_depends}"/>
41
f137ddbb714d Added tagging of source code used in the build
dariosestito@L063522.prod.ad.symbian.intra
parents:
diff changeset
   101
1046
871bdf0d7610 Updated template for tagging source code so it uses the TAGS branch.
Simon Howkins <simonh@symbian.org>
parents: 55
diff changeset
   102
</project>