diff -r 59bb7c4d6172 -r 0f5e3a7fb6af buildframework/helium/tools/localisation/localiser/ECLocaliser.pm --- a/buildframework/helium/tools/localisation/localiser/ECLocaliser.pm Fri Feb 05 11:59:41 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1959 +0,0 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# 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: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# -#------------------------------------------------------------------------------ -# Name : Localiser.pm -# Use : Implementation of a new localisation process. - -# -# Version History : -# -# v1.1.2 (30/01/2008) : Valliappan Ramanathan - ISIS -# - Updated to build with EC build - -# -# v1.1.1 (04/08/2006) : -# - Update include management, now it uses cpp. -# -# v1.1.0 (12/05/2006) : -# - Corrected include parsing, remove that fact that file must start with \ -# - Added locales_xx.iby creation -# -# v1.0.1 (12/05/2006) : -# - Corrected __MakeRlt function -# -# v1.0 (19/04/2006) : -# - First version of the script. -#------------------------------------------------------------------------------ - -## @ file -# - -#------------------------------------------------------------------------------ -# Package __OUT -#------------------------------------------------------------------------------ -package __OUT; -use strict; - -my $outputer = "__OUT"; - -sub SetLoggerPackage -{ - my ($p) = shift; - return unless($p); - $outputer = $p; -} - -sub AUTOLOAD -{ - my ($method) = (our $AUTOLOAD); - if ( $outputer eq "__OUT" ) - { - $method =~ s/^__OUT:://; - if ($method =~ /print/i) - { - print ("@_"); - } - elsif ($method =~ /die/i) - { - die (@_); - } - else - { - print (uc($method).": @_"); - } - } - elsif ( defined ($outputer) and defined($method) ) - { - print "@_\n" if ($method =~ /die/i); - $method =~ s/^__OUT::/$outputer\::/; - no strict 'refs'; - &$method( @_ ); - } -} - -1; - -## @class ZipUp -# -# -# -package ZipUp; -use strict; -use Archive::Zip; -use File::Copy; - -sub new -{ - my ( $class, $filename ) = @_; - return undef unless ($filename); - - my $self = { - __filename => $filename, - }; - - return bless $self, $class; -} - -sub AddFile -{ - my ( $self, $filename ) = (shift,shift); - &__OUT::Print ("Adding '\\$filename'\n"); - my $cmd = "zip ".$self->{ __filename }." $filename\n"; - &__OUT::Print (scalar(`$cmd`)); -} - -sub AddFilesFromList -{ - my ( $self, $listfilename ) = (shift,shift); - if ( -e $listfilename ) - { - &__OUT::Print ("Adding files using '$listfilename'\n"); - my $cmd = "more $listfilename | zip -9 ".$self->{ __filename }." -@"; - &__OUT::Print ( $cmd."\n" ); - &__OUT::Print ( scalar( `$cmd` ) ); - } -} -1; - - -## @class Finder -# -# -# -package Finder; - -sub new -{ - my ( $class, $regexp, $rootdir ) = @_; - - my $self = { - __rootdir => $rootdir, - __regexp => $regexp, - }; - - return bless $self, $class; -} - -sub Find -{ - my ($self, $dir, $list) = @_; - - my @fake; - $list = \@fake unless (defined ($list)); - $dir = $self->{__rootdir} unless (defined($dir)); - - opendir (DIR, $dir); - my @l = readdir(DIR); - closedir(DIR); - - foreach my $name (@l) - { - next if ($name =~ /^\.+$/); - my $filename = "$dir/$name"; - - if ( -d $filename ) - { - $self->Find($filename, $list); - } - elsif ( $filename =~ /$self->{__regexp}/i ) - { - push @$list, $filename; - } - } - - return $list; -} - -1; - - -## @class Localiser -# -# -package Localiser; -use strict; -use File::Path; -#use ISIS::GenBuildTools; -use IPC::Open3; -use File::Spec; -use File::Basename; - -my $DEFAULT_LOC_PATH = "\\s60\\S60LocFiles"; -use constant DEFAULT_XML_PATH => ".xml"; -use constant DEFAULT_WHATXML_PATH => "_what.xml"; -use constant DEFAULT_CHECKXML_PATH => "_check.xml"; -use constant DEFAULT_TPATH => "\\zips"; - - -use constant DEFAULT_MAKE_PATH => ".make"; -use constant DEFAULT_WHATMAKE_PATH => "whatMakefile"; -use constant DEFAULT_CHECKMAKE_PATH => "checkMakefile"; - -sub new -{ - my $class = shift; - - my $configfiles = shift; - my $languagelist = shift; - my $includepath = shift; - my $bldfile = shift; - my $tpath = shift || DEFAULT_TPATH; - my @configuration; - my %platform;# = ("armv5"); - my $self = { - __configfiles => $configfiles, - __includepath => $includepath, - __languagelist => $languagelist, - __configuration => \@configuration, - __platform => \%platform, - __tpath => $tpath, - __bldfile => $bldfile - }; - return bless $self, $class; -} - - -sub DefaultLocPath -{ - my ($k) = @_; - $DEFAULT_LOC_PATH = $k if (defined ($k)); - return $DEFAULT_LOC_PATH; -} - -sub Keepgoing -{ - my ($self, $k) = @_; - $self->{__keepgoing} = $k if (defined ($k)); - return $self->{__keepgoing}; -} - -sub SetLoggerPackage -{ - my ($self, $outputer) = @_; - return unless($outputer); - &__OUT::SetLoggerPackage($outputer); -} - -sub Initialise() -{ - my $self = shift; - my ($drive) = File::Spec->splitpath(File::Spec->rel2abs(File::Spec->curdir())); - foreach my $filename ( @{ $self->{__configfiles} } ) - { - # adding path of the input file into the include path list - my $includepath = ""; - $includepath .= "-I ".File::Spec->rel2abs(dirname($filename)); - foreach my $path ( @{ $self->{__includepath} } ) - { - $path = File::Spec->rel2abs($path); - $path = "$drive$path" if ($path =~ /^\\/); - $includepath .= " -I $path"; - } - - # command line to execute - my $cmd = "cpp -nostdinc -u $includepath ".File::Spec->rel2abs($filename); - __OUT::Print( "$cmd\n"); - - # parsing using cpp... - my $childpid = open3(\*WTRFH, \*RDRFH, \*ERRFH, $cmd); - close(WTRFH); - - while () - { - if ( /^\s*