Upload codeline and sf.spec.diamonds.tag as Diamonds tags
authorDario Sestito <darios@symbian.org>
Tue, 06 Oct 2009 13:50:26 +0100
changeset 601 3489a650c6fa
parent 597 f321927b74bf
child 602 022273556ac9
Upload codeline and sf.spec.diamonds.tag as Diamonds tags
common/build.xml
common/diamonds/sf-tag-build.xml.ftl
common/tools/generate_diamonds_tags_xml.pl
--- a/common/build.xml	Mon Oct 05 18:28:44 2009 +0100
+++ b/common/build.xml	Tue Oct 06 13:50:26 2009 +0100
@@ -191,25 +191,35 @@
     </target>
 
     <target name="sf-prebuild" depends="sf-prep,sf-prebuild-noprep"/>
-    <target name="sf-prebuild-noprep" depends="sf-prebuild-announce,sf-diamonds-tag-build,sf-record-proj-conf-bom,sf-getenvs,sf-syncsource,sf-diamondize-bom"/>
+    <target name="sf-prebuild-noprep" depends="sf-prebuild-announce,sf-diamonds-connect,sf-diamonds-tag-build,sf-record-proj-conf-bom,sf-getenvs,sf-syncsource,sf-diamondize-bom"/>
     
     <target name="sf-prebuild-announce">
         <echo>[SF-PREBUILD]</echo>
     </target>
+    
+    <target name="sf-diamonds-connect">
+      <if>
+        <istrue value="${sf.spec.publish.enable}"/>
+        <then>
+          <echo>[SF-DIAMONDS-CONNECT]</echo>
+          <runtarget target="diamonds"/>
+          <echo message="Save Diamonds build id value in a file"/>
+          <echo message="diamonds.build.id=${diamonds.build.id}" file="${build.log.dir}/diamonds_build_id.txt"/>
+        </then>
+      </if>
+    </target>
 
     <target name="sf-diamonds-tag-build">
       <if>
         <istrue value="${sf.spec.publish.enable}"/>
         <then>
           <echo>[SF-DIAMONDS-TAG-BUILD]</echo>
-          <runtarget target="diamonds"/>
-          <echo message="Save Diamonds build id value in a file"/>
-          <echo message="diamonds.build.id=${diamonds.build.id}" file="${build.log.dir}/diamonds_build_id.txt"/>
-          <fmpp sourceFile="${sf.common.config.dir}/diamonds/sf-tag-build.xml.ftl" outputFile="${build.drive}/output/logs/sf-tag-build.xml">
-            <data expandProperties="yes">
-              ant: antProperties()
-            </data>
-          </fmpp>
+          <echo message="Generate ${build.drive}/output/logs/sf-diamonds-tag-build.xml with Diamonds tags for this build"/>
+          <exec executable="perl" dir="${sf.common.config.dir}/tools" failonerror="true">
+            <arg value="${sf.common.config.dir}/tools/generate_diamonds_tags_xml.pl"/>
+            <arg value="--tags=${sf.diamonds.tags}"/>
+            <arg value="--output=${build.drive}/output/logs/sf-diamonds-tag-build.xml"/>
+          </exec>
         </then>
       </if>
     </target>
--- a/common/diamonds/sf-tag-build.xml.ftl	Mon Oct 05 18:28:44 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<diamonds-build>
-  <schema>10</schema>
-  <tags>
-    <tag>${ant['sf.spec.publish.diamonds.tag']}</tag>
-  </tags>
-</diamonds-build>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/generate_diamonds_tags_xml.pl	Tue Oct 06 13:50:26 2009 +0100
@@ -0,0 +1,54 @@
+#! perl -w
+# Copyright (c) 2009 Symbian Foundation Ltd
+# This component and the accompanying materials are made available
+# under the terms of the License "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Symbian Foundation Ltd - initial contribution.
+# 
+# Contributors:
+#
+# Description:
+# Generate an XML file in the Diamonds format to upload build tags to Diamonds
+
+use strict;
+
+use Getopt::Long;
+
+my $taglist = 0;
+my $outputfile = 0;
+my $help = 0;
+GetOptions((
+	'tags:s' => \$taglist,
+	'output:s' => \$outputfile,
+	'help!' => \$help,
+));
+
+if ($help or !$outputfile)
+{
+	print "Usage: perl generate_diamonds_tags_xml.pl --tags COMMA_SEPARATED_TAG_LIST --output OUTPUT_FILE\n";
+}
+
+open(FILE, ">$outputfile");
+
+print FILE <<_END_HEADER;
+<?xml version=\"1.0\" encoding=\"utf-8\"?>
+<diamonds-build>
+  <schema>13</schema>
+  <tags>
+_END_HEADER
+
+my @tags = split(/,/, $taglist);
+for (@tags)
+{
+	print FILE "    <tag>$_</tag>\n";
+}
+
+print FILE <<_END_TRAILER;  
+  </tags>
+</diamonds-build>
+_END_TRAILER
+
+close(FILE);