sbsv1/abld/test/cw_ide_test.pl
author Ross Qin <ross.qin@nokia.com>
Thu, 18 Nov 2010 16:02:32 +0800
changeset 697 818fe0ed324b
parent 599 fa7a3cc6effd
permissions -rw-r--r--
Moving feature configuration out of the buildrom scope.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
599
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     1
#!perl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     2
# Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     3
# All rights reserved.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     4
# This component and the accompanying materials are made available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     6
# which accompanies this distribution, and is available
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     8
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
     9
# Initial Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    11
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    12
# Contributors:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    13
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    14
# Description:
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    15
# Script to build specified MMP files with both command line and IDE, then
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    16
# use EVALID to compare the results.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    17
# Inspired by "buildall.pl", written by Cuong Phan
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    18
# 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    19
#
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    20
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    21
use strict;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    22
use File::Basename;		# for fileparse()
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    23
use File::Path;			# for mkpath
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    24
use Cwd;				# for cwd
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    25
use OLE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    26
use Getopt::Long;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    27
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    28
sub Usage ($) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    29
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    30
	my ($message) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    31
	print <<ENDHERESTRING;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    32
$message
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    33
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    34
Usage : perl cw_ide_test.pl [-v] -f mmplist platform1 [platform2 ...]
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    35
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    36
Builds specified MMP files with both the command line and the CodeWarrior IDE,
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    37
storing the build products in zip files and comparing them with EVALID.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    38
The output can be summarised using scanlog.pl.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    39
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    40
All of the specified MMP files are build for all of the specified platforms.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    41
If -v is specified, the detailed build commands are included in the output.
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    42
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    43
ENDHERESTRING
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    44
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    45
	exit 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    46
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    47
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    48
my %Options=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    49
GetOptions(\%Options, "v", "f=s");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    50
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    51
&Usage("No platforms specified") if (@ARGV < 1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    52
&Usage("Must specify list of mmp files using -f") if (!defined($Options{"f"}));
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    53
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    54
my @mmplist=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    55
my $specifiedCWD;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    56
open FILELIST, "<$Options{f}" or &Usage("Cannot open $Options{f}");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    57
while (<FILELIST>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    58
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    59
	$specifiedCWD = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    60
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    61
	if (/#.*cwd:/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    62
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    63
		$specifiedCWD = $_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    64
		$specifiedCWD =~ s/^.*cwd:/cwd:/i;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    65
		$specifiedCWD =~ s/\).*$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    66
		$specifiedCWD =~ s/\s*//g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    67
		$specifiedCWD =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    68
		$specifiedCWD .="?";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    69
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    70
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    71
	s/#.*$//;		# remove comments
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    72
	s/\s*$//;		# remove trailing ws
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    73
	s/^\s*//;		# remove leading ws
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    74
	s/\//\\/g;		# convert / to \
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    75
	next if ($_ eq "");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    76
	push @mmplist, $specifiedCWD.$_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    77
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    78
close FILELIST;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    79
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    80
&Usage("No MMP files?") if (@mmplist == 0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    81
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    82
# create an instance of CodeWarrior
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    83
my $CW = CreateObject OLE  "CodeWarrior.CodeWarriorApp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    84
if (!defined($CW))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    85
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    86
	print "Failed to start CodeWarrior\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    87
	exit(1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    88
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    89
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    90
# turn on autoflush, to get stdout in the right place...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    91
# These runes come from perlfaq5
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    92
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    93
my $old_fh = select(STDOUT);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    94
$| = 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    95
select($old_fh);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    96
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    97
foreach my $mmpfile (@mmplist)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    98
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
    99
	$specifiedCWD = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   100
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   101
	if ($mmpfile =~ /^cwd:/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   102
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   103
		$specifiedCWD = $mmpfile;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   104
		$specifiedCWD =~ s/^cwd://;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   105
		$specifiedCWD =~ s/\?.*$//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   106
		$mmpfile =~ s/^cwd:.*\?//;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   107
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   108
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   109
	if (!-f $mmpfile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   110
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   111
		print "MISSING: $mmpfile\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   112
		next;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   113
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   114
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   115
	foreach my $platform (@ARGV)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   116
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   117
		$platform = uc $platform;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   118
		my ($mmpname, $mmpdir, $mmpext) = fileparse($mmpfile,'\..*');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   119
		my $phasename = $mmpname."_".$platform;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   120
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   121
		my $origdir = cwd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   122
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   123
		if ($specifiedCWD)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   124
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   125
			print ("chdir $specifiedCWD\n");			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   126
			chdir ($specifiedCWD);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   127
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   128
			# Workaround for Base components, where GENEXEC.MKE needs to be executed to export the required headers for a build
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   129
			do_system ("bldmake bldfiles");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   130
			do_system ("abld makefile $platform");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   131
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   132
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   133
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   134
			print ("chdir $mmpdir\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   135
			chdir ($mmpdir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   136
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   137
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   138
		my $time = localtime;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   139
		print "===-------------------------------------------------\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   140
		print "=== $phasename\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   141
		print "===-------------------------------------------------\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   142
		print "=== $phasename started $time\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   143
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   144
		if ($specifiedCWD)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   145
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   146
			$mmpdir = "\\".$mmpdir;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   147
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   148
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   149
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   150
			$mmpdir = "";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   151
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   152
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   153
		&do_one_mmp_file($phasename, $mmpname, $platform, $mmpdir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   154
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   155
		$time = localtime;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   156
		print "=== $phasename finished $time\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   157
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   158
		chdir($origdir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   159
		print ("chdir $origdir\n");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   160
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   161
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   162
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   163
$CW->Quit(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   164
exit(0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   165
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   166
sub do_system($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   167
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   168
	my ($cmd) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   169
	print "    $cmd\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   170
	return system($cmd);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   171
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   172
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   173
sub zip_and_check($$$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   174
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   175
	my ($zipname, $releaseref, $complain) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   176
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   177
	unlink($zipname) if (-f $zipname);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   178
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   179
	my @ziplist;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   180
	foreach (sort keys %$releaseref)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   181
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   182
		if (-f $_)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   183
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   184
			push @ziplist,$_;	# add to zip archive
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   185
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   186
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   187
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   188
			print "MISSING: $_\n" if ($complain);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   189
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   190
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   191
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   192
	if (scalar @ziplist ==0 && $complain)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   193
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   194
		print "Can't create empty archive $zipname\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   195
		return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   196
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   197
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   198
	# Make the non-empty archive
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   199
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   200
	open ZIP, "| zip -q $zipname -@";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   201
	print ZIP
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   202
	 join("\n",@ziplist,"");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   203
	close ZIP;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   204
	print "Created $zipname\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   205
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   206
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   207
sub do_one_mmp_file($$$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   208
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   209
	my ($phasename, $mmpname, $platform, $mmpdir) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   210
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   211
	print "=== $phasename == $mmpname.mmp\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   212
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   213
	# use MAKMAKE to generate the makefile
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   214
	# make CLEAN to remove any existing build results
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   215
	# make ALL to build everything
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   216
	# make WHAT to get the releaseables, as per abld.pl
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   217
	# check the releaseables and zip up the ones which do exist
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   218
	# make CLEAN again to get ready for the IDE build...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   219
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   220
	my $makefile = "$mmpname.$platform";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   221
	my %allreleaseables=();		# complete list, for putting back afterwards
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   222
	my %releaseables=();		# just things we expect the IDE to build
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   223
	my %uncheckedreleaseables=();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   224
	my $makecmd = "make -s";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   225
	$makecmd = "make" if ($Options{"v"});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   226
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   227
	unlink $makefile if (-f $makefile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   228
	&do_system("perl -S makmake.pl $mmpdir$mmpname $platform");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   229
	return if (!-f $makefile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   230
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   231
	open PIPE,"make -s -r -f $makefile WHAT |";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   232
	while (<PIPE>) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   233
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   234
		next if (/Nothing to be done for \S+\.$/o);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   235
#		releasables split on whitespace - quotes possible -stripped out
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   236
		while (/("([^"\t\n\r\f]+)"|([^ "\t\n\r\f]+))/go) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   237
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   238
			my $file = ($2 ? $2 : $3);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   239
			$allreleaseables{$file}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   240
			next if ($file =~ /epoc32\\localisation\\/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   241
			next if ($file =~ /epoc32\\data/i && $platform =~ /winscw/i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   242
			$releaseables{$file}=1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   243
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   244
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   245
	close PIPE;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   246
	&zip_and_check("$mmpname.orig.$platform.zip", \%allreleaseables, 0);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   247
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   248
	&do_system("$makecmd -r -f $makefile CLEAN");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   249
	&do_system("$makecmd -r -f $makefile ALL");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   250
	&zip_and_check("$mmpname.cmd.$platform.zip", \%releaseables, 1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   251
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   252
	&do_system("$makecmd -r -f $makefile CLEAN");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   253
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   254
	print "=== $phasename == $mmpname.mcp\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   255
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   256
	# Remove the remnants of previous projects
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   257
	# use MAKMAKE to generate the importable .xml
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   258
	# import the xml to create the .mcp
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   259
	# build the relevant targets
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   260
	# extract the contents of the "Errors & Warnings" window
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   261
	# check against the commandline list of releasables, zip up the ones which exist
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   262
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   263
	my $currentdir = cwd;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   264
	$currentdir =~ s/\//\\/g;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   265
	my $xmlfile = "$currentdir\\$mmpname.xml";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   266
	my $mcpfile = "$currentdir\\$mmpname.mcp";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   267
	my $mcpdata = "$currentdir\\${mmpname}_Data";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   268
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   269
	&do_system("rmdir /s/q $mcpdata") if (-d $mcpdata);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   270
	unlink $mcpfile if (-f $mcpfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   271
	unlink $xmlfile if (-f $xmlfile);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   272
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   273
	&do_system("perl -S makmake.pl $mmpdir$mmpname CW_IDE:$platform");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   274
	if (-f $xmlfile)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   275
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   276
		&fixup_XML($xmlfile) if ($Options{"v"});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   277
		my $project = $CW->ImportProject($xmlfile, $mcpfile, 'true');
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   278
		if (defined($project))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   279
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   280
			my $success = &BuildTargets($project->Targets,$platform);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   281
			$project->Close();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   282
			return if (!$success);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   283
			&zip_and_check("$mmpname.ide.$platform.zip", \%releaseables, 1);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   284
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   285
		else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   286
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   287
			print "ERROR: failed to import $xmlfile\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   288
			return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   289
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   290
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   291
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   292
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   293
		print "ERROR: failed to create $xmlfile\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   294
		return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   295
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   296
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   297
	print "=== $phasename == $mmpname.evalid\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   298
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   299
	# remove & recreate a clean temporary directory for unzipping
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   300
	# unzip the saved results of the cmd and ide builds
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   301
	# use EVALID to compare the releaseables
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   302
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   303
	my $evaliddir = "c:\\temp\\evalid";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   304
	&do_system("rmdir /s/q $evaliddir") if (-d $evaliddir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   305
	mkpath([$evaliddir]);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   306
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   307
	if (   &do_system("unzip -q $mmpname.cmd.$platform.zip -d $evaliddir\\cmd")==0
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   308
		&& &do_system("unzip -q $mmpname.ide.$platform.zip -d $evaliddir\\ide")==0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   309
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   310
		open EVALID,"perl -S evalid.pl $evaliddir\\ide $evaliddir\\cmd -c |";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   311
		while (<EVALID>)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   312
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   313
			print $_ if (/^(PROBLEM|Failed)/);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   314
			print $_ if (/^OK/ && $Options{"v"});
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   315
			if (/^FAILED/)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   316
				{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   317
				if (/\.map\t/i)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   318
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   319
					print "WARNING(S): $_";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   320
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   321
				else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   322
					{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   323
					print "FATAL ERROR(S): $_";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   324
					}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   325
				}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   326
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   327
		close EVALID;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   328
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   329
	else
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   330
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   331
		print "FATAL ERROR(S): problems unpacking zip files\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   332
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   333
	&do_system("rmdir /s/q $evaliddir") if (-d $evaliddir);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   334
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   335
	# Restore original files, if any
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   336
	if (-e "$mmpname.orig.$platform.zip")
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   337
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   338
		&do_system("unzip -q -o $mmpname.orig.$platform.zip -d \\");
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   339
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   340
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   341
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   342
sub fixup_XML($)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   343
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   344
	my ($xmlfile) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   345
	open XML,"<$xmlfile" or return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   346
	my @lines = <XML>;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   347
	close XML;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   348
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   349
	foreach (@lines)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   350
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   351
		# Insist that build commands are logged to the output window, irrespective of CW version
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   352
		s-<SETTING><NAME>LogMessages</NAME><VALUE>false</VALUE></SETTING>-<SETTING><NAME>LogMessages</NAME><VALUE>true</VALUE></SETTING>-;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   353
		s-<SETTING><NAME>ShowCommandLine</NAME><VALUE>false</VALUE></SETTING>-<SETTING><NAME>ShowCommandLine</NAME><VALUE>true</VALUE></SETTING>-;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   354
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   355
		# Remove generation of Browse info by Language Parser (temporary workaround for crashes in automated IDE builds)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   356
		s-<SETTING><NAME>BrowserGenerator</NAME><VALUE>2</VALUE></SETTING>-<SETTING><NAME>BrowserGenerator</NAME><VALUE>0</VALUE></SETTING>-;		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   357
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   358
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   359
	open XML,">$xmlfile" or return;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   360
	print XML @lines;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   361
	close XML;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   362
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   363
	
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   364
sub BuildTargets($$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   365
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   366
	my ($targets,$platform) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   367
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   368
	for (my $item=0; $item<$targets->Count; $item++ ) 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   369
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   370
		my $target = $targets->Item($item);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   371
	    my $targetName = $target->name;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   372
	    # Skip platforms we aren't interested in...
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   373
	    next if ($targetName !~ /$platform /i);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   374
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   375
		print "Building $targetName...\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   376
		     
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   377
	    $target->RemoveObjectCode( 'true' );
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   378
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   379
		my $buildMessages = $target->BuildAndWaitToComplete();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   380
		if (!defined($buildMessages))
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   381
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   382
			printf "FATAL ERROR(S): build aborted? (%s)\n", $target->LastError();
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   383
			return 0;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   384
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   385
			
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   386
		my $messageList = $buildMessages->Informations;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   387
		&printMessages("",$messageList) if defined($messageList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   388
		
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   389
		my $warningCount = $buildMessages->WarningCount;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   390
		my $errorCount = $buildMessages->ErrorCount;    
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   391
		print "Completed $targetName with $errorCount errors and $warningCount warnings\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   392
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   393
		if ($errorCount > 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   394
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   395
			$messageList = $buildMessages->Errors;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   396
			&printMessages("FATAL ERROR(S): ", $messageList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   397
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   398
		if ($warningCount > 0)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   399
			{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   400
			$messageList = $buildMessages->Warnings;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   401
			&printMessages("WARNING: ", $messageList);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   402
			}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   403
		} 
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   404
	return 1;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   405
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   406
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   407
sub	printMessages ($$)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   408
	{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   409
    my ($prefix,$messageList) = @_;
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   410
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   411
	# traverse through the list of messages
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   412
	for (my $item = 0; $item < ($messageList->Count); $item++)
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   413
		{
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   414
        my $message = $messageList->Item($item);
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   415
		print $prefix,$message->MessageText,"\n";
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   416
		}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   417
	}
fa7a3cc6effd Add sbsv1 to new structure
jjkang
parents:
diff changeset
   418