common/tools/generate_diamonds_tags_xml.pl
changeset 601 3489a650c6fa
child 693 9f583ada8e4e
equal deleted inserted replaced
597:f321927b74bf 601:3489a650c6fa
       
     1 #! perl -w
       
     2 # Copyright (c) 2009 Symbian Foundation Ltd
       
     3 # This component and the accompanying materials are made available
       
     4 # under the terms of the License "Eclipse Public License v1.0"
       
     5 # which accompanies this distribution, and is available
       
     6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 #
       
     8 # Initial Contributors:
       
     9 # Symbian Foundation Ltd - initial contribution.
       
    10 # 
       
    11 # Contributors:
       
    12 #
       
    13 # Description:
       
    14 # Generate an XML file in the Diamonds format to upload build tags to Diamonds
       
    15 
       
    16 use strict;
       
    17 
       
    18 use Getopt::Long;
       
    19 
       
    20 my $taglist = 0;
       
    21 my $outputfile = 0;
       
    22 my $help = 0;
       
    23 GetOptions((
       
    24 	'tags:s' => \$taglist,
       
    25 	'output:s' => \$outputfile,
       
    26 	'help!' => \$help,
       
    27 ));
       
    28 
       
    29 if ($help or !$outputfile)
       
    30 {
       
    31 	print "Usage: perl generate_diamonds_tags_xml.pl --tags COMMA_SEPARATED_TAG_LIST --output OUTPUT_FILE\n";
       
    32 }
       
    33 
       
    34 open(FILE, ">$outputfile");
       
    35 
       
    36 print FILE <<_END_HEADER;
       
    37 <?xml version=\"1.0\" encoding=\"utf-8\"?>
       
    38 <diamonds-build>
       
    39   <schema>13</schema>
       
    40   <tags>
       
    41 _END_HEADER
       
    42 
       
    43 my @tags = split(/,/, $taglist);
       
    44 for (@tags)
       
    45 {
       
    46 	print FILE "    <tag>$_</tag>\n";
       
    47 }
       
    48 
       
    49 print FILE <<_END_TRAILER;  
       
    50   </tags>
       
    51 </diamonds-build>
       
    52 _END_TRAILER
       
    53 
       
    54 close(FILE);