diff options
author | Mathias Bauer <mba@openoffice.org> | 2009-09-15 18:25:50 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2009-09-15 18:25:50 +0200 |
commit | 559022a94f0d8fca158134782f2206b88218a4cd (patch) | |
tree | 8f38cb4abf869ac0af5969adedf8cbc2e1cb2df6 /soldep | |
parent | febdf577f7716df95e9d7e7edf15baaa2bfdf4a5 (diff) |
remove dependency on perl by throwing out superfluous XML stuff
Diffstat (limited to 'soldep')
-rw-r--r-- | soldep/bootstrp/XMLBuildListParser.pm | 1966 | ||||
-rw-r--r-- | soldep/bootstrp/XmlBuildList.cxx | 436 | ||||
-rw-r--r-- | soldep/bootstrp/makefile.mk | 11 | ||||
-rw-r--r-- | soldep/bootstrp/prj.cxx | 248 | ||||
-rwxr-xr-x | soldep/inc/XmlBuildListDef.hxx | 50 | ||||
-rw-r--r-- | soldep/inc/soldep/XmlBuildList.hxx | 160 | ||||
-rw-r--r-- | soldep/inc/soldep/prj.hxx | 21 | ||||
-rw-r--r-- | soldep/inc/soldep/soldep.hxx | 1 | ||||
-rw-r--r-- | soldep/prj/d.lst | 1 | ||||
-rw-r--r-- | soldep/source/soldep.cxx | 24 |
10 files changed, 43 insertions, 2875 deletions
diff --git a/soldep/bootstrp/XMLBuildListParser.pm b/soldep/bootstrp/XMLBuildListParser.pm deleted file mode 100644 index 857723657568..000000000000 --- a/soldep/bootstrp/XMLBuildListParser.pm +++ /dev/null @@ -1,1966 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2008 by Sun Microsystems, Inc. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# $RCSfile: XMLBuildListParser.pm,v $ -# -# $Revision: 1.3 $ -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* - - -#************************************************************ -# Data structure and XML parser/creator for the changeover * -# of the current build.lst to build.xlist files * -# programmer: Pascal Junck, Sun Microsystems GmbH * -#************************************************************ - -# The current XMLBuildListParser is the second step for the changeover to XML. -# It was written to create a complex structure with more possibilities to store informations -# of the 'build.lst' files in the new XML files. The important informations were parsed by the -# 'buildlst_parser.pl' from the old files and then are (temporary) stored by the set and add -# methods in the module 'XMLBuildListParser' and 'XML::Parser'. By the API of this module it's -# possible to create the new XML 'build.xlist' files. - -# If the '$Product' or the '$JobPlatform' (as also '$BuildReqPlatform') have no value, -# their value are automatically 'all'. -# It doesn't matter whether it's the set/add or the get method, that receives or sends -# these optional parameters. -# In the created XML file the default values aren't set, because of the constraints of the -# 'Document Type Definition'(DTD). -# If there is no product/platform attribute in the 'build.xlist' it means a default of 'all'! - -# The important parameters are: - -# $ModuleName = it's the name of the current module - -# $DependencyType = here are the three possible scalar dependency values -# for all other depending modules(of the current module): -# 'md-simple', 'md-always' and 'md-force' - -# $Products = which products can be used for the module dependencies -# and might have more different whitespace separated values -# e.g.'so oo' (scalar type) - -# $Dir = it means a string(scalar) with the current working directory, -# with a '/'(current directory) at the beginning of the string - -# $JobType = it means a job e.g. 'make' - -# $Platforms = in this scalar parameter might be more than one different value, -# like: 'wnt unx mac' and 'all'('all' includes the three values) -# it must be whitespace separated - -# @DependingDirs = a list(array) of all inner depending directories -# of the current working directory - -# %BuildReq = means a hash with build requirement pairs: -# 'BuildReqName'(key) => 'BuildReqPlatform'(value) - - - -############################## begin of main ######################################## - -use strict; - -use XML::Parser; - -package XMLBuildListParser; - -# global variable for printing out all results at parsing -# if the debug variable is set to '1' it prints the results to STDOUT -my $Debug = 0; - - -############################# begin of subroutines ################################### - -sub new -{ - my $invocant = shift; - my $class = ref($invocant) || $invocant; - - my $self = {}; - - # no real instance data yet, might change if package is extended - bless($self, $class); - $$self{'error_string'} = ''; - $self->beginXMLStructure(); - - return $self; -} - -# VG: procedure for a better error handling -sub getError -{ - my $self = shift; - return $$self{'error_string'}; -}; - -######################################################################################## -# sub: loadXMLFile -# gets: $File -# optional: - -# returns: - -# description: get the 'path' of the 'build.xlist'(s), load it in the 'xml parser tree' -# and fill it in the own data_structure to make it available for the API -######################################################################################## -sub loadXMLFile -{ - my $self = shift; - my $File = shift; - - if (-f $File) - { - my $TreeParse = new XML::Parser(Style => 'Tree'); - - my $File_ref; - - eval - { - $File_ref = $TreeParse->parsefile($File); - }; - - if ($@) - { - $@ =~ s/[\r\n]//g; - print"ERROR: $@" if ($Debug); - $$self{'error_string'} = 'ERROR: ' . $@ . ". Error occured while trying to parse $File"; - - return 0; - } - else - { - filterXMLFile($File_ref); - - $$self{"ModuleData"} = $File_ref; - - return 1; - } - } - else - { - $$self{'error_string'} = "ERROR: cannot find file $File"; - return 0; - } -} - -######################################################################################## -# sub: filterXMLFile -# gets: $ArrayContent_ref -# optional: - -# returns: - -# description: filters all '0' and whitespace based pairs of the XML file -# -> all spaces, tabs and new lines -######################################################################################## -sub filterXMLFile -{ - my $ArrayContent_ref = shift; - - # get the number of elements of the array_ref - my $Count = getContentCount($ArrayContent_ref); - - for (my $i = 0; $i < $Count;) - { - # get each content pair - my $Content_ref = getContent($ArrayContent_ref, $i); - - # in each content pair the first element is either - # a tag name or the value '0' - my $FirstContent = getTagName($Content_ref); - - # we need the second part of the content pair to check - # which value is inside - my $SecondContent = getSecondContent($Content_ref); - - my $tempArray_ref = ""; - if (($FirstContent eq "task") or ($FirstContent eq "depend")) - { - my $dir = $Content_ref->[1]->[0]->{dir}; - $dir =~ s/\/$//; - $Content_ref->[1]->[0]->{dir} = $dir; - $i++; - filterXMLFile($Content_ref); - } - elsif ($FirstContent eq "0") - { - # only if there is in the first part a '0' and in the - # second part are whitespaces... - if ($SecondContent =~ /\s+/) - { - # ...make a ref at this position - $tempArray_ref = @$ArrayContent_ref[1]; - - # and delete this element pair - removeContent($tempArray_ref, $i); - - # now we have one element pair fewer - $Count--; - } - else - { - # is there a '0' but in the second part not a whitespace, - # increase 'i' by 1 - $i++; - } - } - else - { - # if it's a tag name, increase 'i' by one and call recursive - # the 'filterXMLFile' with the 'content ref' - $i++; - - # look further after the '0' and whitespace content - filterXMLFile($Content_ref); - } - } -} - -######################################################################################## -# sub: removeContent -# gets: $File_ref, $Count -# optional: - -# returns: - -# description: removes the '0' and the whitespace based pairs of the XML structure -# whitespace could be: tabs, new lines and whitespace itself -######################################################################################## -sub removeContent -{ - my $tempArray_ref = shift; - my $i = shift; - - my $Start = (2*$i) + 1; - - splice(@$tempArray_ref, $Start, 2); -} - -######################################################################################## -# sub: beginXMLStructure -# gets: $ModuleData_ref -# optional: - -# returns: - -# description: create a new beginning of the XML file structure -######################################################################################## -sub beginXMLStructure -{ - my $self = shift; - - # global variable for the complete filled data structure - my $ModuleData_ref = createTag("build-list", {}); - - $$self{"ModuleData"} = $ModuleData_ref; -} - -######################################################################################## -# sub: insertContent -# gets: $HigherLevelTag_ref, $currentTag_ref, $Pos -# optional: - -# returns: - -# description: insert a content at the right (alphabetical sorted) position -######################################################################################## -sub insertContent -{ - my $HigherLevelTag_ref = shift; - my $currentTag_ref = shift; - my $Pos = shift; - - my $Array_ref = $HigherLevelTag_ref->[1]; - - $Pos = ($Pos*2)+1; - - splice(@$Array_ref, $Pos, 0, @$currentTag_ref); -} - -######################################################################################## -# sub: saveXMLFile -# gets: $Path -# optional: - -# returns: - -# description: creates a XML file of the whole data structure -######################################################################################## -sub saveXMLFile -{ - my $self = shift; - my $Path = shift; - - my $ModuleData_ref = $$self{"ModuleData"}; - - # open the filehandle 'CREATE_XML' for creating the XML files - open (SAVE_XML, ">".$Path) - or die "Error. Open the file <build.xlist> wasn't successful!\n\n"; - - select SAVE_XML; - - print"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; - print"<!DOCTYPE build-list SYSTEM \"build_xlist.dtd\">\n"; - print"<!--\n" - ."***************************************************************************\n" - ."* \n" - ."* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. \n" - ."* \n" - ."* Copyright 2008 by Sun Microsystems, Inc. \n" - ."* \n" - ."* OpenOffice.org - a multi-platform office productivity suite \n" - ."* \n" - ."* \$RCSfile: XMLBuildListParser.pm,v $ \n" - ."* \n" - ."* \$Revision: 1.3 $ \n" - ."* \n" - ."* This file is part of OpenOffice.org. \n" - ."* \n" - ."* OpenOffice.org is free software: you can redistribute it and/or modify \n" - ."* it under the terms of the GNU Lesser General Public License version 3 \n" - ."* only, as published by the Free Software Foundation. \n" - ."* \n" - ."* OpenOffice.org is distributed in the hope that it will be useful, \n" - ."* but WITHOUT ANY WARRANTY; without even the implied warranty of \n" - ."* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the \n" - ."* GNU Lesser General Public License version 3 for more details \n" - ."* (a copy is included in the LICENSE file that accompanied this code). \n" - ."* \n" - ."* You should have received a copy of the GNU Lesser General Public License \n" - ."* version 3 along with OpenOffice.org. If not, see \n" - ."* <http://www.openoffice.org/license.html> \n" - ."* for a copy of the LGPLv3 License. \n" - ."* \n" - ."***************************************************************************\n" - ."-->\n"; - - printTag($ModuleData_ref); - - # flush the buffer - # it's the same like the both lines below here, but we make it manually without module 'IO' - # use IO::Handle; - # SAVE_XML -> autoflush(1); - $| = 1; - - select STDOUT; - - close (SAVE_XML); - -} - -######################################################################################## -# sub: printTag -# gets: $Tag_ref -# optional: - -# returns: - -# description: prints out each tag of the existing data structure (XML tree) -######################################################################################## -sub printTag -{ - my $Tag_ref = shift; - - # the first time we call this function the 'pos counter' has the default value of '0', - # because it is for the begin tag -> it shouldn't have a distance to the left side - my $PosCounter = shift || 0; - - # makes it possible that each tag has a specified distance from the left sided margin - my $Distance = " " x $PosCounter; - - # it's possible that the content is a text(case 1) between a begin and end tag - # or a tag name(case 2) - # case 1: ( 0 , "Text between the begin and end tag" ) - my $TagName = getTagName($Tag_ref); - - if ($TagName eq "0") - { - print"$Tag_ref->[1]"; - } - # case 2: ( "TagName" , (...) ) - else - { - # open the tag - # only a new line if it is not the first tag - print"\n" if ($PosCounter != 0); - print $Distance."<".$TagName; - - my $Attributes_ref = getAttributesRef($Tag_ref); - - # print all sorted attributes of this tag - foreach my $Attribute (sort keys %$Attributes_ref) - { - my $value = $$Attributes_ref{$Attribute}; - print" $Attribute=\"$value\""; - } - - # get the number of elements of the array - my $ContentCount = getContentCount($Tag_ref); - - # close the tag - # if it is an empty tag create a '/' before we close it with '>' - print"/" if ($ContentCount == 0); - print">"; - - # get and print all tags recursive - for (my $i = 0; $i < $ContentCount; $i++) - { - # here we get the content of the current tag, - # we rise the 'pos counter' that each level of tags - # has a specified distance from the left side - printTag(getContent($Tag_ref, $i), $PosCounter + 2); - } - - # check that the tag has a text between the begin and end tag - # first: had the tag further inner tags? - if ($ContentCount > 0) - { - my $Content_ref = getContent($Tag_ref, 0); - my $TagName = getTagName($Tag_ref); - my $TagContent = getTagName($Content_ref); - - # if a tag has a begin tag and a following text, create the end tag behind the text - print"</$TagName>" if ($TagContent eq "0"); - - print"\n".$Distance."</$TagName>" if ($TagContent ne "0"); - } - } -} - -######################################################################################## -# sub: getTagName -# gets: $Content_ref -# optional: - -# returns: $TagName -# description: gets a reference of an array and returns the tag name at position '0' -######################################################################################## -sub getTagName -{ - my $Content_ref = shift; - - my $TagName = $$Content_ref[0]; - - return $TagName; -} - -######################################################################################## -# sub: getSecondContent -# gets: $Content_ref -# optional: - -# returns: $SecondContent -# description: gets a reference of an array and returns the second value(index '1') -######################################################################################## -sub getSecondContent -{ - my $Content_ref = shift; - - my $SecondContent = $$Content_ref[1]; - - return $SecondContent; -} - -######################################################################################## -# sub: createSortKey -# gets: $DependencyType, $DepModuleName -# optional: - -# returns: $SortKey -# description: creates a key with a number(depending of the dependency type) -# and a string and returns it -######################################################################################## -sub createSortKey -{ - my $DependencyType = shift; - my $DepModuleName = shift; - - my $DepTypeAsValue = 0; - - if ($DependencyType eq "md-simple") - { - $DepTypeAsValue = 1; - } - elsif ($DependencyType eq "md-always") - { - $DepTypeAsValue = 2; - } - elsif ($DependencyType eq "md-force") - { - $DepTypeAsValue = 3; - } - - my $SortKey = $DepTypeAsValue.$DepModuleName; - - return $SortKey; -} - -######################################################################################## -# sub: searchTag -# gets: $TagName, $Tag_ref -# optional: - -# returns: $TagValues_ref -# description: gets a reference and goes in the lower level tag, -# looks after the specified tag name and returns the reference -# of itself and the neighbour element -######################################################################################## -sub searchTag -{ - my $TagName = shift; - my $Tag_ref = shift; - - my $TagSerie_ref = $Tag_ref->[1]; - - # (all elements of the array) - 1 => highest index of the array - my $IndexEnd = scalar(@$TagSerie_ref)-1; - - my $TagValues_ref = undef; - - for (my $i = 1; $i <= $IndexEnd; $i += 2) - { - if ($TagSerie_ref->[$i] eq $TagName) - { - @$TagValues_ref = @$TagSerie_ref[$i..$i+1]; - - last; - } - } - - return $TagValues_ref; -} - -######################################################################################## -# sub: createTag -# gets: $TagName, $Attribute_ref -# optional: - -# returns: $Tag_ref -# description: creates an anonymous array with a tag name and the reference of its -# attributes; then returns the reference of this array -######################################################################################## -sub createTag -{ - my $TagName = shift; - my $Attribute_ref = shift; - - my $Tag_ref = [$TagName, [$Attribute_ref]]; - - return $Tag_ref; -} - -######################################################################################## -# sub: createText -# gets: $Text -# optional: - -# returns: $TagText_ref -# description: creates an anonymous array(which contains a '0' and a string) -# for the data structure and returns a reference of it -######################################################################################## -sub createText -{ - my $Text = shift; - - my $TagText_ref = [0, $Text]; - - return $TagText_ref; -} - -######################################################################################## -# sub: addContent -# gets: $Tag_ref, $NextInfos_ref -# optional: - -# returns: - -# description: creates and adds a tag with its following content -######################################################################################## -sub addContent -{ - # '$NextInfos_ref' has two infos: - # either: '0' and a string -> [Tag, [{}, 0 , string ]] - # or: 'tag' and a ref of a anonymous array -> [Tag, [{}, newTag, [.....] ]] - my $Tag_ref = shift; - my $NextInfos_ref = shift; - - my $SecondPart_ref = $Tag_ref->[1]; - - # '$Tag_ref' gets now the right structure: - # e.g. ['tag1', [{}, 0, "text of tag1" ...]...] - # or ['tag1', [{}, 'tag2', [...] ...]...] - push(@$SecondPart_ref, @$NextInfos_ref); -} - -######################################################################################## -# sub: getContent -# gets: $Tag_ref, $i -# optional: - -# returns: \@Content (ref of array 'content') -# description: creates and returns a reference of an array with two elements, -# which are a part of the array of the current tag -######################################################################################## -sub getContent -{ - my $Tag_ref = shift; - my $i = shift; - - # e.g. - # [ "tag 1", [ {} , 0 , "string", "tag 2", [{}..], "tag 3", [{}..], ..] ..] - # $Tag_ref [ [0] [1] ..] - # $Content_ref [ [0] [1] [2] [3] [4] [5] [6] ..] - - my $Content_ref = $$Tag_ref[1]; - - # '$start' contains: elements with the index 1, 3, 5 ...(and so on) - # '$end' contains: elements with the index 2, 4, 6 ...(and so on) - my $start = (2 * $i) + 1; - my $end = $start + 1; - - my @Content = @$Content_ref[$start..$end]; - - return \@Content; -} - -######################################################################################## -# sub: getAttribute -# gets: $Tag_ref, $AttributeName -# optional: - -# returns: $Attribute -# description: finds and returns an attribute as a string -######################################################################################## -sub getAttribute -{ - my $Tag_ref = shift; - my $AttributeName = shift; - - # [ "tag1", [ { attribute1 = "..", attribute2 = ".." } , "tag2"... ] ] - # Tag_ref [ [0] [1] ] ] - # [ [0]->'attribute1' , [0]->'attribute2' , [1] ... ] ] - - # get the scalar of the value of the 'AttributeName' in the anonymous hash - my $Attribute = $Tag_ref->[1]->[0]->{$AttributeName}; - - return $Attribute; -} - -######################################################################################## -# sub: getAttributeRef -# gets: $Tag_ref -# optional: - -# returns: $Attribute_ref -# description: finds and returns the reference of the hash which contains the attributes -######################################################################################## -sub getAttributesRef -{ - my $Tag_ref = shift; - - # [ "tag1", [ { attribute1 = "..", attribute2 = ".." } , "tag2"... ] ] - # Tag_ref [ [0] [1] ] ] - # [ [0] , [1] ] ] - - # get the reference of the anonymous hash - my $Attribute_ref = $Tag_ref->[1]->[0]; - - return $Attribute_ref; -} - -######################################################################################## -# sub: getContentCount -# gets: $Tag_ref -# optional: - -# returns: $IndexValue -# description: returns the sum of elements pairs of the array (less the anonymous hash) -######################################################################################## -sub getContentCount -{ - my $Tag_ref = shift; - - # get the content array (address of the inner array) - my $Content_ref = $$Tag_ref[1]; - - # get the number of the element pairs of the array (without the anonymous hash) - my $IndexValue = scalar(@$Content_ref); - $IndexValue = ($IndexValue-1)/2; - - return $IndexValue; -} - -######################################################################################## -# sub: getIterationData -# gets: $TagName -# optional: - -# returns: $IndexValue, $TagDepend_ref -# description: gets a tag name and returns the sum of elements pairs of the array -# (less the anonymous hash) and the reference of the anonymous array -######################################################################################## -sub getIterationData -{ - my $self = shift; - my $TagName = shift; - - my $ModuleData_ref = $$self{"ModuleData"}; - - my $TagDepend_ref = searchTag($TagName, $ModuleData_ref); - my $IndexValue = getContentCount($TagDepend_ref); - - return ($IndexValue, $TagDepend_ref); -} - -######################################################################################## -# sub: printErrorMessage -# gets: $BuildReqPlatforms or $Platforms or $Products -# optional: - -# returns: - -# description: it's an error, if a platform or a product content (e.g.'so oo') -# has at least one valid value and also the value 'all', -# because 'all' includes all other possible values -######################################################################################## -sub printErrorMessage -{ - my $self = shift; - my $Content = shift; - - my $ModuleData_ref = $$self{"ModuleData"}; - - my $Module_ref = searchTag("module-name", $ModuleData_ref); - my $ModuleContent_ref = getContent($Module_ref, 0); - my $Module = @$ModuleContent_ref[1]; - - print"Error in module <$Module> in Content <$Content>!\n"; - print"The value 'all' includes all currently existing valid values.\n\n"; -} - -######################################################################################## -# sub: adjustRedundancy -# gets: $Task_ref, $JobPlatform, $BuildReq_ref -# optional: - -# returns: - -# description: the tag <task> (it means 'job') should be created with no redundant infos, -# like: <task dir="/uno" platform="unx"> ... -# <task dir="/uno" platform="wnt"> ... -# <build-requirement name="test10" platform="wnt"> -# -# it should be: <task dir="/uno" platform="unx wnt"> -# <build-requirement name="test10" platform="wnt"> -######################################################################################## -sub adjustRedundancy -{ - my $Task_ref = shift; - my $JobPlatform = shift; - my $BuildReq_ref = shift; - - my %sortedJobPlatforms = (); - my @JobPlatforms = (); - my $PlatformContent = ""; - - # get the 'task platforms' in one content - my $Attributes_ref = getAttributesRef($Task_ref); - - # get the existing 'task platform' - my $existingPlatform = getAttribute($Task_ref, "platform"); - $existingPlatform = "all" if (!($existingPlatform)); - - if ( ($existingPlatform ne "all") && ($JobPlatform ne "all") ) - { - # get the sorted platform content - $sortedJobPlatforms{$JobPlatform} = ""; - $sortedJobPlatforms{$existingPlatform} = ""; - - @JobPlatforms = sort keys %sortedJobPlatforms; - - $PlatformContent = join " ", @JobPlatforms; - - $$Attributes_ref{"platform"} = $PlatformContent; - } - elsif ( ($existingPlatform ne "all") && ($JobPlatform eq "all") ) - { - delete $$Attributes_ref{"platform"}; - } - - if ($BuildReq_ref) - { - my $JobType_ref = getContent($Task_ref, 0); - - # if it exists add the 'build requirements' at the - # previous(with the same directory as the current) <task> tag - addBuildReq($JobType_ref, $BuildReq_ref); - } -} - -######################################################################################## -# sub: addBuildReq -# gets: $JobTypeInfos_ref, $BuildReq_ref -# optional: - -# returns: - -# description: add the 'build requirements' to the existing data structure -# case 1: if the 'job directory' is not redundant -# case 2: if it is redundant create it to the first existing 'job' -######################################################################################## -sub addBuildReq -{ - my $JobTypeInfos_ref = shift; - my $BuildReq_ref = shift; - - my @sortedBuildReqPlatforms = (); - - foreach my $BuildReqName (sort keys %$BuildReq_ref) - { - my $BuildReqPlatforms = $$BuildReq_ref{$BuildReqName}; - - $BuildReqPlatforms = "all" if (!($BuildReqPlatforms)); - - my $Attributes_ref = {"name" => "$BuildReqName"}; - - # it's wrong, if in a platform content(e.g. "unx wnt") are at least - # one or more platform(s) and within a 'all' term, - # because 'all' is default and means it includes all other possible values! - if ( ($BuildReqPlatforms ne "all") && ($BuildReqPlatforms =~ /\ball\b/) ) - { - printErrorMessage($BuildReqPlatforms); - } - elsif (!($BuildReqPlatforms =~ /\ball\b/)) - { - @sortedBuildReqPlatforms = sort(split(/\s+/, $BuildReqPlatforms)); - $BuildReqPlatforms = join " ", @sortedBuildReqPlatforms; - - $$Attributes_ref{"platform"} = "$BuildReqPlatforms"; - } - - # create the tag <build-requirement> - my $BuildReqInfos_ref = createTag("build-requirement", $Attributes_ref); - - # append the <build-requirement> tag to the <'$JobType'> tag - addContent($JobTypeInfos_ref, $BuildReqInfos_ref); - } -} - -######################################################################################## -# sub: checkJobRedundancy -# gets: $Task_ref, $JobType, $DependingDirs_ref, $JobPlatform, $BuildReq_ref -# optional: - -# returns: $LineIsRedundant -# description: checks whether the values of the 'job' line are redundant, like: -# 'job dir', 'job'(e.g.: make) and 'depending dirs' -######################################################################################## -sub checkJobRedundancy -{ - my $Task_ref = shift; - my $JobType = shift; - my $DependingDirs_ref = shift; - my $JobPlatform = shift; - my $BuildReq_ref = shift; - - my $LineIsRedundant = 0; - - - # get the ref of the existing 'depending directories' - # if they also equal with the current 'depending directories', - # make one tag instead of two, which differences only in the platform - # (and the 'build requirement', if it exists) - my $JobType_ref = getContent($Task_ref, 0); - my $JobName = getTagName($JobType_ref); - - # get the existing 'task platform' - my $existingPlatform = getAttribute($Task_ref, "platform"); - - # are the jobs equal? - if ($JobType eq $JobName) - { - my @existingDepDirs = (); - - my $IndexEnd = getContentCount($JobType_ref); - - # get all existing 'depending dirs' of this redundant 'job' - for (my $j = 0; $j < $IndexEnd; $j++) - { - my $Content_ref = getContent($JobType_ref, $j); - - my $TagName = getTagName($Content_ref); - - # create an array of the 'depending directories' - if ($TagName eq "depend") - { - my $DepDir = getAttribute($Content_ref, "depend"); - - push(@existingDepDirs, $DepDir); - } - } - - # if now the current 'depending dirs' equal with the existing, - # we know that is redundant and have to create only one instead - # of two tags, e.g. - # before: <task dir="/uno" platform="unx">... - # <task dir="/uno" platform="wnt"> ... - # <build-requirement name="test10" platform="wnt"> - # - # it should be: <task dir="/uno" platform="unx wnt"> - # <build-requirement name="test10" platform="wnt"> - if (@$DependingDirs_ref eq @existingDepDirs) - { - $LineIsRedundant = 1; - - # check redundant directories and create no redundant 'task dirs' - adjustRedundancy($Task_ref, $JobPlatform, $BuildReq_ref); - } - } - - return $LineIsRedundant; -} - -######################################################################################## -# sub: existsTag -# gets: $TagName -# optional: - -# returns: $TagExists_ref -# description: checks whether that a tag exists and returns the ref of the content -######################################################################################## -sub existsTag -{ - my $self = shift; - my $TagName = shift; - - my $TagExists_ref = undef; - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <module-depend> tag exists - $TagExists_ref = searchTag($TagName, $ModuleData_ref); - - return $TagExists_ref; -} - -######################################################################################## -# API - (internal) 'set/add' methods # -######################################################################################## - -######################################################################################## -# sub: setModuleName -# gets: $ModuleName -# optional: - -# returns: - -# description: gets the name of the current module and set it at the right position -# in the data structure -######################################################################################## -sub setModuleName -{ - my $self = shift; - my $ModuleName = shift; - - my $ModuleData_ref = $$self{"ModuleData"}; - - my $Tag_ref = createTag("module-name", {}); - my $TagText_ref = createText($ModuleName); - - addContent($Tag_ref, $TagText_ref); - - addContent($ModuleData_ref, $Tag_ref); -} - -######################################################################################## -# sub: addModuleDependencies -# gets: $ModuleName, $DependencyType, $Products -# optional: $Products(default: 'all' -> includes currently 'so' and 'oo') -# but the default should not set in the data structure, -# it's only a 'Document Type Definition' based term -# returns: - -# description: add the module dependencies and their attributes into the data structure -######################################################################################## -sub addModuleDependencies -{ - my $self = shift; - my $ModuleName = shift; - my $DependencyType = shift; - my $Products = shift || "all"; - - my $ModuleData_ref = $$self{"ModuleData"}; - - my @sortedProducts = (); - - # change all possible upper cases to lower cases - $Products =~ s/($Products)/\L$Products/; - - # before we add the module dependencies, we have to prove that the <module-depend> tag was set - # because this tag must be set once before the module dependency tags begin - my $ModuleDepend_ref = searchTag("module-depend", $ModuleData_ref); - - # if it doesn't exist, create this tag '<module-depend>' - if (!($ModuleDepend_ref)) - { - $ModuleDepend_ref = createTag("module-depend", {}); - - # add it to the global data structure - addContent($ModuleData_ref, $ModuleDepend_ref); - } - - my $Attributes_ref = {"module" => "$ModuleName"}; - - # it's wrong, if in a product content(e.g. "so") are at least - # one or more product(s) and within a 'all' term, - # because 'all' is default and means it includes all other possible values! - if ( ($Products ne "all") && ($Products =~ /\ball\b/) ) - { - printErrorMessage($Products); - } - elsif (!($Products =~ /\ball\b/)) - { - @sortedProducts = sort(split(/\s+/ ,$Products)); - $Products = join " ", @sortedProducts; - - $$Attributes_ref{"product"} = "$Products"; - } - - my $ModuleDependenciesInfos_ref = createTag("$DependencyType", $Attributes_ref); - - my $currentKey = createSortKey($DependencyType, $ModuleName); - - # search and get the position in which we have to insert the current 'module depend name' - # at first get the current 'module depend name' - my $currentName = getAttribute($ModuleDependenciesInfos_ref, "module"); - - # get the information about the number of 'Contents'(= elements) of the array - my $ContentCount = getContentCount($ModuleDepend_ref); - - # we have to sort the serie of the 'name' contents, - # therefore we need a 'Pos'(position) of the array in which we want to sort in the 'name' content - my $Pos = 0; - - # and we need a control variable 'isInsert' - # that we won't add the 'name' and the content more than one time - my $isInsert = 0; - - for (my $i = 0; $i < $ContentCount; $i++) - { - # get each 'Content' of the array = ('task', ARRAY(...)) - my $Content_ref = getContent($ModuleDepend_ref, $i); - my $TagName = getTagName($Content_ref); - - # get the existing 'task dir' to compare it with the current 'task dir' - my $existingName = getAttribute($Content_ref, "module"); - - my $existingKey = createSortKey(getTagName($Content_ref), $existingName); - - # compare both dirs... - # only if the 'current dir' is lower than a 'existing dir' - # insert it in the data structure - if ($currentKey lt $existingKey) - { - $Pos = $i; - - insertContent($ModuleDepend_ref, $ModuleDependenciesInfos_ref, $Pos); - - $isInsert = 1; - - last; - } - } - # only if the 'current name' is greater (or equal) than the other 'existing names' - # insert it at the end of the data structure - addContent($ModuleDepend_ref, $ModuleDependenciesInfos_ref) if ($isInsert == 0); -} - -######################################################################################## -# sub: addJob -# gets: $Dir, $JobType, $JobPlatform, $DependingDirs_ref, $BuildReq_ref, -# $JobPlatform, $DependingDirs_ref, $BuildReq_ref -# optional: $JobPlatform(default: 'all' -> includes all other possible values), -# $DependingDirs_ref, $BuildReq_ref -# returns: - -# description: add the infos about a job from the old build lists(by ascii parser) and -# sort it in the data structure -######################################################################################## -sub addJob -{ - my $self = shift; - my $Dir = shift; - my $JobType = shift; - my $JobPlatform = shift || "all"; - my $DependingDirs_ref = shift; - my $BuildReq_ref = shift; - - my $ModuleData_ref = $$self{"ModuleData"}; - - # before we add the "build" tag, we have to prove that the <build> tag was set - # because this tag must be set once before the job tag(s) follows - my $buildTag_ref = searchTag("build", $ModuleData_ref); - - # if it doesn't exist, create the tag '<build>' - if (!($buildTag_ref)) - { - # If the tag wasn't found, create it - $buildTag_ref = createTag("build", {}); - - # add it to the global data structure - addContent($ModuleData_ref, $buildTag_ref); - } - - my $Attributes_ref = {"dir" => "$Dir"}; - - # it's wrong, if a 'job platform' content(e.g. "unx wnt") has at least - # one or more 'job platform(s)' and an 'all' term, - # because 'all' is default and means it includes all other possible values - if ( ($JobPlatform ne "all") && ($JobPlatform =~ /\ball\b/) ) - { - printErrorMessage($JobPlatform); - } - elsif (!($JobPlatform =~ /\ball\b/)) - { - my @sortedPlatforms = sort(split /\s+/, $JobPlatform); - $JobPlatform = join " ", @sortedPlatforms; - - $$Attributes_ref{"platform"} = "$JobPlatform"; - } - - # create the tags: <task>, <make> and (if it exists)... - # <depend> and/or <build-requirement> - my $taskInfos_ref = createTag("task", $Attributes_ref); - - # search and get the position in which we have to insert the current task - # at first get the current 'task directory' - my $currentDir = getAttribute($taskInfos_ref, "dir"); - - # get the information about the number of 'Contents'(= elements) of the array - my $IndexValue = getContentCount($buildTag_ref); - - # we have to sort the serie of the 'task contents', - # therefore we need a '$pos'(position) of the array in which we want to sort in the 'task content' - my $Pos = 0; - - # and we need a control variable 'isInsert' - # that we won't add the 'task content' more than one time - my $isInsert = 0; - - # control variable for the redundancy check - my $LineIsRedundant = 0; - - # go in the array of the corresponding <build> tag element - for (my $i = 0; $i < $IndexValue; $i++) - { - # get each content of the <build> tag => ('task1', ARRAY1(...), task2...) - my $Task_ref = getContent($buildTag_ref, $i); - - # get the existing 'task dir' to compare it with the current 'task dir' - my $existingDir = getAttribute($Task_ref, "dir"); - - # is the 'job dir' redundant? - if ($currentDir eq $existingDir) - { - $LineIsRedundant = checkJobRedundancy($Task_ref, $JobType, $DependingDirs_ref, $JobPlatform, $BuildReq_ref); - } - - # if it's not a redundant line, compare both dirs: - # only if the 'current dir' is lower than an 'existing dir' - # insert it in the data structure - if ( ($LineIsRedundant == 0) && ($currentDir lt $existingDir) ) - { - $Pos = $i; - - insertContent($buildTag_ref, $taskInfos_ref, $Pos); - - $isInsert = 1; - - last; - } - } - - # only if the 'current dir' is greater (or equal) than the other 'existing dirs' - # and it is not redundant insert it at the end of the data structure - if ( ($isInsert == 0) && ($LineIsRedundant == 0) ) - { - addContent($buildTag_ref, $taskInfos_ref); - } - - if ($LineIsRedundant == 0) - { - # create the <'$JobType'> tag - my $JobTypeInfos_ref = createTag($JobType, {}); - - # append the <'$JobType'> tag to the <task> tag - addContent($taskInfos_ref, $JobTypeInfos_ref); - - # before we add the "depend" infos - # we have to get the alphabetical sorted 'Depending Directories' - @$DependingDirs_ref = sort(@$DependingDirs_ref) if ($DependingDirs_ref); - - foreach my $DependDir (@$DependingDirs_ref) - { - my $DependInfos_ref = createTag("depend", {"dir" => "$DependDir"}); - - # append the <depend> tag to the <'$JobType'> tag - addContent($JobTypeInfos_ref, $DependInfos_ref); - } - - # if a 'build requirement' exists, create the tag <build-requirement> - if ($BuildReq_ref) - { - addBuildReq($JobTypeInfos_ref, $BuildReq_ref); - } - } -} - -######################################################################################## -# end of (internal) 'set/add' methods # -######################################################################################## - - -######################################################################################## -# API - (external) 'get' methods # -######################################################################################## - -######################################################################################## -# sub: getModuleDependencies -# gets: $Product, $DependencyType -# optional: $Product(default: 'all', means all currently used valid values), -# $DependencyType(default: 'md-simple', 'md-always' and 'md-force') -# returns: @ModuleDependencies -# description: gets a ref of an array (with the products) and creates and -# returns an array with the sorted depending modules -######################################################################################## -sub getModuleName { - my $self = shift; - if ($self->existsTag("module-name")) { - my ($IndexValue, $ModuleDepend_ref) = $self->getIterationData("module-name"); - return $$ModuleDepend_ref[1][2]; - }; - return ""; - -}; -sub getModuleDependencies -{ - my $self = shift; - my $Products_ref = shift; - my $DependencyType = shift || "all"; - - push(@$Products_ref, "all") if (!scalar @$Products_ref); - - my $Product = ""; - my %tempModuleDeps = (); - my @ModuleDependencies = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <module-depend> tag exists - if ($self->existsTag("module-depend")) - { - # change all possible upper cases to lower cases - $DependencyType =~ s/($DependencyType)/\L$DependencyType/ if ($DependencyType ne "all"); - - foreach $Product (@$Products_ref) - { - # change all possible upper cases to lower cases - $Product =~ s/($Product)/\L$Product/; - - my $ProductContent = undef; - my $ModuleDependencyName = ""; - - # get the number of elements and the ref of the <module-depend> tag - my ($IndexValue, $ModuleDepend_ref) = $self->getIterationData("module-depend"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - my $Content_ref = getContent($ModuleDepend_ref, $i); - - my $ModuleDependencyName = getAttribute($Content_ref, "module"); - - # get the name of each existing tag - my $TagName = getTagName($Content_ref); - - $ProductContent = getAttribute($Content_ref, "product"); - - # if the attribute 'product' wasn't set in the internal data structure, - # it means the default of 'all' is valid and includes all other possible values - $ProductContent = "all" if (!($ProductContent)); - - if ($Product ne "all") - { - if ($DependencyType ne "all") - { - # if the caller wants all (e.g.)'so' product based dependency types, - # we must get the 'so' and the 'all' matching products - # because 'all' matches also the product 'so' - if ( ($DependencyType eq $TagName) && - ((($ProductContent eq "all") || $ProductContent =~ /\b($Product)\b/)) ) - { - $tempModuleDeps{$ModuleDependencyName} = ""; - - print"ModuleDeps (Product != 'all' && DepType != 'all') = <$ModuleDependencyName>\n" if ($Debug); - } - } - # we get from the caller only the 'product' parameter, - # 'dependency type' is now 'all'(default) and includes all possible values - elsif ( ($ProductContent =~ /\b($Product)\b/) || ($ProductContent eq "all") ) - { - $tempModuleDeps{$ModuleDependencyName} = ""; - - print"ModuleDeps (Product != 'all' && DepType = 'all') = <$ModuleDependencyName>\n" if ($Debug); - } - } - # now the product is 'all' and we only need to check the 'dependency type' - elsif ($DependencyType ne "all") - { - if ($DependencyType eq $TagName) - { - $tempModuleDeps{$ModuleDependencyName} = ""; - - print"ModuleDeps (Product = 'all' && DepType != 'all') = <$ModuleDependencyName>\n" if ($Debug); - } - } - else - { - $tempModuleDeps{$ModuleDependencyName} = ""; - - print"ModuleDeps (Product = 'all' && DepType = 'all') = <$ModuleDependencyName>\n" if ($Debug); - } - } - } - - @ModuleDependencies = sort keys %tempModuleDeps; - } - - print"ModuleDependencies = <@ModuleDependencies>\n" if ($Debug); - - return @ModuleDependencies; -} - -######################################################################################## -# sub: getModuleDepType -# gets: $DepModuleName -# optional: - -# returns: $DependencyType -# description: gets a module name and returns the dependency type of it -######################################################################################## -sub getModuleDepType -{ - my $self = shift; - my $DepModuleName = shift; - - my $DependencyType = ""; - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <module-depend> tag exists - if ($self->existsTag("module-depend")) - { - # change all possible upper cases to lower cases - $DepModuleName =~ s/($DepModuleName)/\L$DepModuleName/; - - my ($IndexValue, $ModuleDepend_ref) = $self->getIterationData("module-depend"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - my $Content_ref = getContent($ModuleDepend_ref, $i); - my $existingModuleName = getAttribute($Content_ref, "module"); - - if ($DepModuleName eq $existingModuleName) - { - $DependencyType = getTagName($Content_ref); - last; - } - } - } - - print"DependencyType = <$DependencyType>\n" if ($Debug); - - return $DependencyType; -} - -######################################################################################## -# sub: getModuleProducts -# gets: $DepModuleName -# optional: - -# returns: @ModuleProducts -# description: gets a module name and returns the associated products -######################################################################################## -sub getModuleProducts -{ - my $self = shift; - my $DepModuleName = shift; - - my @ModuleProducts = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <module-depend> tag exists - if ($self->existsTag("module-depend")) - { - # change all possible upper cases to lower cases - $DepModuleName =~ s/($DepModuleName)/\L$DepModuleName/; - - my $ProductContent = undef; - - my ($IndexValue, $ModuleDepend_ref) = $self->getIterationData("module-depend"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - my $Content_ref = getContent($ModuleDepend_ref, $i); - - my $existingModuleName = getAttribute($Content_ref, "module"); - - # if the attribute 'product' wasn't set in the internal data structure, - # it means the default of 'all' is valid and includes all other possible values - $ProductContent = getAttribute($Content_ref, "product"); - - if ($DepModuleName eq $existingModuleName) - { - $ProductContent = "all" if (!($ProductContent)); - - @ModuleProducts = split /\s+/, $ProductContent; - - last; - } - } - } - - print"Products = <@ModuleProducts>\n" if ($Debug); - - return @ModuleProducts; -} - -######################################################################################## -# sub: getProducts -# gets: - -# optional: - -# returns: @ModuleProducts -# description: returns the products of the whole depending modules -# each found product name may occurs only once in the module products array -######################################################################################## -sub getProducts -{ - my $self = shift; - my $ProductContent = undef; - my @tempProducts = (); - my @ModuleProducts = (); - my %Products = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <module-depend> tag exists - if ($self->existsTag("module-depend")) - { - my ($IndexValue, $ModuleDepend_ref) = $self->getIterationData("module-depend"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - my $Content_ref = getContent($ModuleDepend_ref, $i); - - $ProductContent = getAttribute($Content_ref, "product"); - - # if the attribute 'product' wasn't set in the internal data structure, - # it means the default of 'all' is valid and includes all other possible values - # but here we need only all 'not-all' values! - if (!($ProductContent)) - { - $ProductContent=""; - } - else - { - # here are the products of the current depending module - @tempProducts = split /\s+/, $ProductContent; - - foreach my $Product (@tempProducts) - { - $Products{$Product} = ""; - } - } - } - - # fill the sorted 'module products' in the array - @ModuleProducts = sort keys %Products; - } - - print"All ModuleProducts = <@ModuleProducts>\n" if ($Debug); - - return @ModuleProducts; -} - -######################################################################################## -# sub: getJobDirectories -# gets: $JobType, $JobPlatform -# optional: $JobType, $JobPlatform(default: 'all' -> includes all possible values) -# returns: @JobDirectories -# description: creates and returns an array with the sorted directories, which -# fulfil the expected values of the job type and the job platform -######################################################################################## -sub getJobDirectories -{ - my $self = shift; - my $JobType = shift; - my $JobPlatform = shift || "all"; - - my @JobDirectories = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <build> tag exists - if ($self->existsTag("build")) - { - # change all possible upper cases to lower cases - $JobType =~ s/($JobType)/\L$JobType/ if ($JobType); - $JobPlatform =~ s/($JobPlatform)/\L$JobPlatform/ if ($JobPlatform ne "all"); - - my $PlatformContent = undef; - my %tempJobDirectories = (); - - # get the ref of the <build> tag - my ($IndexValue, $Build_ref) = $self->getIterationData("build"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - my $Content_ref = getContent($Build_ref, $i); - - my $PlatformContent = getAttribute($Content_ref, "platform"); - my $existingDir = getAttribute($Content_ref, "dir"); - - # three cases are possible... - if ($JobType) - { - my $JobType_ref = getContent($Content_ref, 0); - my $existingJobType = getTagName($JobType_ref); - - # if the attribute 'job platform' wasn't set in the internal data structure, - # it means the default of 'all' is valid and includes all other possible values - $PlatformContent = "all" if (!($PlatformContent)); - - # first case: we get from the caller the parameters 'job type' and 'job platform' - if ($JobPlatform ne "all") - { - # if the caller wants all e.g.'wnt' job platform based directories, - # we have to get the 'wnt' or the 'all' matching platform - # because 'all' includes also 'wnt' - if ( ($JobType eq $existingJobType) && - (($PlatformContent =~ /\b($JobPlatform)\b/) || ($PlatformContent eq "all")) ) - { - $tempJobDirectories{$existingDir} = ""; - } - } - # second case: we get from the caller only the 'job type' parameter - # 'job platform' is now 'all'(default) and includes all possible values - elsif ($JobType eq $existingJobType) - { - $tempJobDirectories{$existingDir} = ""; - } - } - # third case: we get from the caller no parameter; now we take each existing 'job directory', - # no matter which 'job type' and 'job platform' it has - else - { - $tempJobDirectories{$existingDir} = ""; - } - } - - # sort each unique 'job directory' alphabetical - @JobDirectories = sort keys %tempJobDirectories; - } - print"JobDirectories = <@JobDirectories>\n" if ($Debug); - - return @JobDirectories; -} - -######################################################################################## -# sub: getDirDependencies -# gets: $Dir, $JobType, $JobPlatform -# optional: $JobPlatform(default: 'all' -> includes all possible values) -# returns: @JobDependencies -# description: creates and returns an array with the sorted depending directories -######################################################################################## -sub getDirDependencies -{ - my $self = shift; - my $Dir = shift; - my $JobType = shift; - my $JobPlatform = shift || "all"; - - my @JobDependencies = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <build> tag exists - if ($self->existsTag("build")) - { - # change all possible upper cases to lower cases - $JobType =~ s/($JobType)/\L$JobType/; - $JobPlatform =~ s/($JobPlatform)/\L$JobPlatform/ if ($JobPlatform ne "all"); - - my $PlatformContent = undef; - my %tempJobDependencies = (); - - # first we need a reference of the higher level tag <build> - my ($IndexValue, $Build_ref) = $self->getIterationData("build"); - - # get all 'job directories' with the matching values of the 'job type' and the 'job platform' - my @tempDepDirs = (); - @tempDepDirs = $self->getJobDirectories($JobType, $JobPlatform); - - # get each content of the <build> tag - for (my $i = 0; $i < $IndexValue; $i++) - { - # get the ref of the content of the <build> tag - my $Task_ref = getContent($Build_ref, $i); - - # get both attributes: 'job dir' and 'job platform' - my $existingDir = getAttribute($Task_ref, "dir"); - my $PlatformContent = getAttribute($Task_ref, "platform"); - - # if the attribute 'job platform' wasn't set in the internal data structure, - # it means the default of 'all' is valid and includes all other possible values - $PlatformContent = "all" if (!($PlatformContent)); - - # get the 'job type' ref which is inside the <task> tag on position '0' - my $JobType_ref = getContent($Task_ref, 0); - - my $existingJobType = getTagName($JobType_ref); - - if ( ($Dir eq $existingDir) && ($JobType eq $existingJobType) ) - { - # each 'job type' can have several 'depends' and 'build requirements' - # here we get the number of the including elements - my $IndexEnd = getContentCount($JobType_ref); - - for (my $j = 0; $j < $IndexEnd; $j++) - { - # create a ref of the existing content - my $Content_ref = getContent($JobType_ref, $j); - - # the content_ref can be 'depend' or 'build requirement' - # but we only need the 'depend' informations - next if (getTagName($Content_ref) ne "depend"); - - # get the 'depend dir' - my $DependDir = getAttribute($Content_ref, "dir"); - - # look in the list of all existing 'job directories' - foreach my $DepDir (@tempDepDirs) - { - # get it, if one of these 'job dirs' is equal with one of the 'depending dirs' - if ($DepDir eq $DependDir) - { - # get all unique values only once - $tempJobDependencies{$DepDir} = ""; - } - } - } - } - } - - # get the unique sorted values in the array - @JobDependencies = sort keys %tempJobDependencies; - } - - print"Depending Dirs = <@JobDependencies>\n" if ($Debug); - - return @JobDependencies; -} - -######################################################################################## -# sub: getJobTypes -# gets: $Dir -# optional: - -# returns: @JobTypes -# description: creates and returns an array with the sorted 'job types' -######################################################################################## -sub getJobTypes -{ - my $self = shift; - my $Dir = shift; - - my @JobTypes = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <build> tag exists - if ($self->existsTag("build")) - { - # it's for creating unique 'job types' which exists only once in the (later) array - my %tempJobTypes = (); - - # first we need a reference of the higher level tag <build> - my ($IndexValue, $Build_ref) = $self->getIterationData("build"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - # get the ref of the <build> tag - my $Task_ref = getContent($Build_ref, $i); - my $existingDir = getAttribute($Task_ref, "dir"); - - # we only need the 'task(s)' with the matching dir - next if ($Dir ne $existingDir); - - # get the ref of the <task> tag at the position '0' - my $JobType_ref = getContent($Task_ref, 0); - my $JobType = getTagName($JobType_ref); - - # get the 'job type' as a key in the hash - # so we can guarantee that each 'job type' stays unique! - $tempJobTypes{$JobType} = ""; - } - - # fill the unique sorted 'job types' in the array - @JobTypes = sort keys %tempJobTypes; - } - - print"JobTypes = <@JobTypes>\n" if ($Debug); - - return @JobTypes; -} - -######################################################################################## -# sub: getJobBuildReqs -# gets: $Dir, $BuildReqPlatform -# optional: $BuildReqPlatform(default: 'all' -> includes all possible values) -# returns: @JobBuildRequirements -# description: creates and returns an array with the sorted 'job build requirements' -######################################################################################## -sub getJobBuildReqs -{ - my $self = shift; - my $Dir = shift; - my $BuildReqPlatform = shift || "all"; - - my @JobBuildRequirements = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <build> tag exists - if ($self->existsTag("build")) - { - # change all possible upper cases to lower cases - $BuildReqPlatform =~ s/($BuildReqPlatform)/\L$BuildReqPlatform/ if ($BuildReqPlatform ne "all"); - - my $BuildReqPlatformContent = undef; - my %tempJobBuildRequirements = (); - - # first we need a reference of the higher level tag <build> - my ($IndexValue, $Build_ref) = $self->getIterationData("build"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - # get the ref to the content of the array of the <build> tag - my $Task_ref = getContent($Build_ref, $i); - - # get the attribute 'task dir' - my $existingDir = getAttribute($Task_ref, "dir"); - - # get the 'job type' ref which is inside the <task> tag - my $JobType_ref = getContent($Task_ref, 0); - - # each 'job type' can have several 'depends' and 'build requirements' - # here we get the number of the included elements - my $IndexEnd = getContentCount($JobType_ref); - - for (my $j = 0; $j < $IndexEnd; $j++) - { - # create a ref of the existing content - my $Content_ref = getContent($JobType_ref, $j); - - # the content_ref can be 'build requirement' or 'depend' - # but we need only the 'build requirement' informations - next if (getTagName($Content_ref) ne "build-requirement"); - - my $BuildReqName = getAttribute($Content_ref, "name"); - $BuildReqPlatformContent = getAttribute($Content_ref, "platform"); - - $BuildReqPlatformContent = "all" if (!($BuildReqPlatformContent)); - - if ($BuildReqPlatform ne "all") - { - # compare the parameters: 'dir' and 'platform' - # other values('wnt', 'unx' and 'mac') for 'platform' - # including the value 'all' in the existing 'platform' list - # get each 'build requirement name' only once (unique) - if ( ($Dir eq $existingDir) && - (($BuildReqPlatformContent =~ /\b($BuildReqPlatform)\b/) || ($BuildReqPlatformContent =~ /\ball\b/)) ) - { - $tempJobBuildRequirements{$BuildReqName} = ""; - - print"JobBuildRequirements (if) = <$BuildReqName>\n" if ($Debug); - } - } - # if the 'build requirement platform' was not allocated, it is "all" (default) - # now we only need to compare the directories - elsif ($Dir eq $existingDir) - { - $tempJobBuildRequirements{$BuildReqName} = ""; - - print"JobBuildRequirements (elsif) = <$BuildReqName>\n" if ($Debug); - } - } - } - - # fill the unique sorted 'build requirement names' in the array - @JobBuildRequirements = sort keys %tempJobBuildRequirements; - } - - print"JobBuildRequirements = <@JobBuildRequirements>\n" if ($Debug); - - return @JobBuildRequirements; -} - -######################################################################################## -# sub: getJobBuildReqPlatforms -# gets: $Dir, $BuildReqName -# optional: - -# returns: @JobBuildReqPlatforms -# description: creates and returns an array with -# the sorted 'job build requirement platforms' -######################################################################################## -sub getJobBuildReqPlatforms -{ - my $self = shift; - my $Dir = shift; - my $JobBuildReqName = shift; - - my @JobBuildReqPlatforms = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <build> tag exists - if ($self->existsTag("build")) - { - # change all possible upper cases to lower cases - $JobBuildReqName =~ s/($JobBuildReqName)/\L$JobBuildReqName/; - - my $BuildReqPlatformContent = undef; - my @tempPlatforms = (); - my %tempJobBuildReqPlatforms = (); - - # first we need a reference of the higher level tag <build> - my ($IndexValue, $Build_ref) = $self->getIterationData("build"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - # get the ref to the content of the array of the <build> tag - my $Task_ref = getContent($Build_ref, $i); - - # get the attribute 'task dir' - my $existingDir = getAttribute($Task_ref, "dir"); - - # get the 'job type' ref which is inside the <task> tag - my $JobType_ref = getContent($Task_ref, 0); - - # each 'job type' can have several 'depends' and 'build requirements' - # here we get the number of the included elements - my $IndexEnd = getContentCount($JobType_ref); - - for (my $j = 0; $j < $IndexEnd; $j++) - { - # create a ref of the existing content - my $Content_ref = getContent($JobType_ref, $j); - - # the content_ref can be 'build requirement' or 'depend' - # but we need only the 'build requirement' informations - next if (getTagName($Content_ref) ne "build-requirement"); - - my $existingJobBuildReqName = getAttribute($Content_ref, "name"); - $BuildReqPlatformContent = getAttribute($Content_ref, "platform"); - - $BuildReqPlatformContent = "all" if (!($BuildReqPlatformContent)); - - if ( ($Dir eq $existingDir) && ($JobBuildReqName eq $existingJobBuildReqName) ) - { - # here are the platforms of the current 'build requirement' - @tempPlatforms = split /\s+/, $BuildReqPlatformContent; - - foreach my $BuildReqPlatform (@tempPlatforms) - { - $tempJobBuildReqPlatforms{$BuildReqPlatform} = ""; - } ######### - } - } - } - - # fill the unique sorted 'build requirement platforms' in the array - @JobBuildReqPlatforms = sort keys %tempJobBuildReqPlatforms; - } - - print"JobBuildReqPlatforms = <@JobBuildReqPlatforms>\n" if ($Debug); - - return @JobBuildReqPlatforms; -} - -######################################################################################## -# sub: getJobPlatforms -# gets: $Dir -# optional: - -# returns: @JobPlatforms -# description: creates and returns an array with the sorted depending 'job platforms' -######################################################################################## -sub getJobPlatforms -{ - my $self = shift; - my $Dir = shift; - - my @JobPlatforms = (); - - my $ModuleData_ref = $$self{"ModuleData"}; - - # check whether that the <build> tag exists - if ($self->existsTag("build")) - { - my $PlatformContent = undef; - my %tempJobPlatforms = (); - - # control variable: if a value 'all' exists in the platform content - # it doesn't matter which platforms are also existing, - # because 'all' includes all possible values! - my $allExists = 0; - - # first we need a reference of the higher level tag <build> - my ($IndexValue, $Build_ref) = $self->getIterationData("build"); - - for (my $i = 0; $i < $IndexValue; $i++) - { - my $Task_ref = getContent($Build_ref, $i); - - # get the attributes of the <task> tag - my $existingTaskDir = getAttribute($Task_ref, "dir"); - $PlatformContent = getAttribute($Task_ref, "platform"); - - # if it is not set in the data structure, - # it has automatically the default value 'all' - $PlatformContent = "all" if (!($PlatformContent)); - - if ($Dir eq $existingTaskDir) - { - # if a platform value 'all' exists, we remember it - # and don't look further after other platforms - if ($PlatformContent =~ /\ball\b/) - { - $allExists = 1; - - @JobPlatforms = "all"; - - last; - } - - my @tempPlatforms = (); - - push(@tempPlatforms, split(/\s+/, $PlatformContent)); - - foreach my $Platform (@tempPlatforms) - { - $tempJobPlatforms{$Platform} = ""; - } - } - } - - # fill the unique sorted 'job platforms' in the array, - # but only if the content "all" is not present in the platform content - @JobPlatforms = sort keys %tempJobPlatforms if ($allExists == 0); - } - - print"JobPlatforms = <@JobPlatforms>\n" if ($Debug); - - return @JobPlatforms; -} - -######################################################################################## -# end of 'get' methods # -######################################################################################## - -1 ; diff --git a/soldep/bootstrp/XmlBuildList.cxx b/soldep/bootstrp/XmlBuildList.cxx deleted file mode 100644 index 670a3eb7f771..000000000000 --- a/soldep/bootstrp/XmlBuildList.cxx +++ /dev/null @@ -1,436 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XmlBuildList.cxx,v $ - * $Revision: 1.5 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#include <EXTERN.h> /* from the Perl distribution */ - -#ifdef WNT -#include <tools/prewin.h> -#include "perl.h" -#include <tools/postwin.h> -#else -#include "perl.h" -#endif -#undef Copy /* from Perl handy.h */ - -#include <soldep/XmlBuildList.hxx> -#include "XmlBuildListDef.hxx" - -#ifdef __cplusplus -# define EXTERN_C extern "C" -#else -# define EXTERN_C extern -#endif - -static PerlInterpreter *my_perl; /*** The Perl interpreter ***/ -static const char * DEP_MD_SIMPLE_STR = "md-simple"; - -EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); -static void xs_init (pTHX); -static void dl_init (pTHX); - -static void xs_init(pTHX) -{ - char *file = __FILE__; - dXSUB_SYS; - { - /* DynaLoader is a special case */ - newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); - } -} - -static void dl_init(pTHX) -{ - char *file = __FILE__; - dTARG; - dSP; -/* Dynamicboot strapping code*/ - SAVETMPS; - targ=sv_newmortal(); - FREETMPS; -/* end Dynamic bootstrapping code */ -#ifdef MACOSX - *file=0; // how does this works??? - sp=0; -#endif -} - -FullByteStringList::FullByteStringList() - : FullByteStingListImpl(), - nRef (0) -{ -} - -FullByteStringList::~FullByteStringList() -{ - ByteString* pStr = First(); - while (pStr) - { - delete pStr; - pStr = Next(); - } -} - -ULONG FullByteStringList::GetPos (ByteString& rStr) -{ - ULONG nCurPos = GetCurPos(); - ULONG nPos = 0; - ByteString* pStr = First(); - while (pStr) - { - if (*pStr == rStr) - { - GetObject (nCurPos); - return nPos; - } - pStr = Next(); - nPos ++; - } - GetObject (nCurPos); - return LIST_ENTRY_NOTFOUND; -} - -FullByteStringListWrapper& FullByteStringListWrapper::operator=( const FullByteStringListWrapper& rFullByteStringListWrapper ) -{ - if (pStringList) - if (pStringList->GetRef() == 0) - delete pStringList; - else - pStringList->DecRef(); - - pStringList = rFullByteStringListWrapper.GetStringList(); - if (pStringList) - pStringList->IncRef(); - return *this; -} - -FullByteStringListWrapper::~FullByteStringListWrapper () -{ - if (pStringList) - { - if (pStringList->GetRef() == 0) - delete pStringList; - else - pStringList->DecRef(); - } -} - -// -// Function initializes Perl -// ATTENTION: No check built in - YET TO DO -// -void XmlBuildList::initPerl(const char* ModulePath) { - if (PerlInitialized) - return; - my_perl = perl_alloc(); - if (!my_perl) - throw XmlBuildListException("Cannot initialize perl"); - perl_construct(my_perl); - char* embedding[] = {"", "-e", "0"}; - int exitstatus = perl_parse(my_perl, xs_init, 3, embedding, (char **)NULL); - if (!exitstatus) { - dl_init(aTHX); - exitstatus = perl_run(my_perl); - } - //perl_run(my_perl); - // Create a variable (s. perlguts) - SV* sv = get_sv("main::module_path", TRUE); - sv_setpv(sv, ModulePath); - eval_pv("use lib $main::module_path; use XMLBuildListParser;", FALSE); - checkOperationSuccess(); - eval_pv("$main::build_lst_obj = XMLBuildListParser->new();", FALSE); - checkOperationSuccess(); - eval_pv("@array = ();", FALSE); - checkOperationSuccess(); - PerlInitialized = TRUE; -}; - -// Function proves if the $@ perl variable is set, if yes - -// last operation was unsuccessfull -> throws exception -void XmlBuildList::checkOperationSuccess() { - char* op_result = SvPV_nolen(get_sv("main::@", FALSE)); - if (strcmp(op_result, "")) - throw XmlBuildListException(op_result); -} - -// -// Function generates a regular array with NULL as last element -// from the Perl-object @array -// -FullByteStringList* XmlBuildList::extractArray() { - FullByteStringList* pStringList = new FullByteStringList(); - AV* theArrayObj = get_av("main::array", FALSE); - I32 arrayLength = av_len(theArrayObj); // $#array value - if (arrayLength == -1) - return pStringList; - - SV** string_ptr; - char* pStoredString; - // populate vector with strings (char*) - for (int i = 0; i <= arrayLength; i++) { - string_ptr = av_fetch(theArrayObj, i, NULL); - //pStoredString = savepv(SvPV_nolen(*string_ptr)); - pStoredString = SvPV_nolen(*string_ptr); - ByteString* pStr = new ByteString(pStoredString); - pStringList->Insert(pStr, LIST_APPEND); - }; - return pStringList; -}; - - -char* XmlBuildList::getError() { - eval_pv("$main::string1 = $main::build_lst_obj->getError();", FALSE); - checkOperationSuccess(); - return SvPV_nolen(get_sv("main::string1", FALSE)); -}; - -/*****************************************************************************/ -XmlBuildList::XmlBuildList(const ByteString& rModulePath) -/*****************************************************************************/ - : PerlInitialized (FALSE) -{ - initPerl(rModulePath.GetBuffer()); - string_obj1 = get_sv("main::string1", TRUE); - string_obj2 = get_sv("main::string2", TRUE); - string_obj3 = get_sv("main::string3", TRUE); - if (!(string_obj1 && string_obj2 && string_obj3)) - throw XmlBuildListException("Cannot initialize Perl string objects"); -}; - -// -// Function uninitializes Perl -// -/*****************************************************************************/ -XmlBuildList::~XmlBuildList() -/*****************************************************************************/ -{ - if (!PerlInitialized) - return; - perl_destruct(my_perl); - perl_free(my_perl); - PerlInitialized = FALSE; -}; - -/*****************************************************************************/ -void XmlBuildList::loadXMLFile(const ByteString& rBuildList) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rBuildList.GetBuffer()); - eval_pv("$main::string2 = $main::build_lst_obj->loadXMLFile($main::string1);", FALSE); - checkOperationSuccess(); - if(!SvTRUE(string_obj2)) { - const char* Message = getError(); - throw XmlBuildListException(Message); - }; -}; - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getProducts() -/*****************************************************************************/ -{ - eval_pv("@array = $main::build_lst_obj->getProducts();", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -} - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getJobDirectories(const ByteString& rJobType, const ByteString& rJobPlatform) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rJobType.GetBuffer()); - sv_setpv(string_obj2, rJobPlatform.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getJobDirectories($main::string1, $main::string2);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -} - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getModuleDependencies(const ByteString& rProduct, const ByteString& rDependencyType) -/*****************************************************************************/ -{ - FullByteStringList* pProducts = new FullByteStringList(); - FullByteStringListWrapper aProducts (pProducts); - if (rProduct != "") - aProducts.Insert (new ByteString(rProduct), LIST_APPEND); - return getModuleDependencies(aProducts, rDependencyType); -}; - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getModuleDependencies(FullByteStringListWrapper& rProducts, const ByteString& rDependencyType) -/*****************************************************************************/ -{ - eval_pv("@products = ();", FALSE); - checkOperationSuccess(); - AV* theArrayObj = get_av("main::products", FALSE); - FullByteStringList* pProducts = rProducts.GetStringList(); - ByteString* pStr = pProducts->First(); - while (pStr) - { - sv_setpv(string_obj2, pStr->GetBuffer()); - av_push(theArrayObj, string_obj2); - pStr = pProducts->Next(); - } - - sv_setpv(string_obj1, rDependencyType.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getModuleDependencies(\\@products, $main::string1);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -}; - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getJobBuildReqs(const ByteString& rJobDir, const ByteString& rBuildReqPlatform) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rJobDir.GetBuffer()); - sv_setpv(string_obj2, rBuildReqPlatform.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getJobBuildReqs($main::string1, $main::string2);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -} - -/*****************************************************************************/ -ByteString XmlBuildList::getModuleDepType(const ByteString& rDepModuleName) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rDepModuleName.GetBuffer()); - eval_pv("$main::string1 = $main::build_lst_obj->getModuleDepType($main::string1);", FALSE); - checkOperationSuccess(); - char* pString = SvPV_nolen(get_sv("main::string1", FALSE)); - ByteString sDependencyType(pString); - return sDependencyType; -} - -/*****************************************************************************/ -sal_Bool XmlBuildList::hasModuleDepType(FullByteStringListWrapper& rProducts, const ByteString& rDependencyType) -/*****************************************************************************/ -{ - FullByteStringListWrapper aDepencendModules = getModuleDependencies(rProducts, rDependencyType); - if (aDepencendModules.Count()>0) - { - return sal_True; - } - return sal_False; -} - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getModuleDepTypes(FullByteStringListWrapper& rProducts) -/*****************************************************************************/ -{ - FullByteStringList * pList = new FullByteStringList(); - - ByteString aDepType = ByteString( DEP_MD_SIMPLE_STR ); - bool bHasType = hasModuleDepType(rProducts, aDepType); - if (bHasType) - pList->Insert(new ByteString (aDepType)); - - aDepType = ByteString(DEP_MD_ALWAYS_STR); - bHasType = hasModuleDepType(rProducts, aDepType); - if (bHasType) - pList->Insert(new ByteString (aDepType)); - - aDepType = ByteString(DEP_MD_FORCE_STR); - bHasType = hasModuleDepType(rProducts, aDepType); - if (bHasType) - pList->Insert(new ByteString (aDepType)); - - return FullByteStringListWrapper (pList); -} - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getModuleProducts(const ByteString& rDepModuleName) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rDepModuleName.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getModuleProducts($main::string1);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -}; - -/*****************************************************************************/ -ByteString XmlBuildList::getModuleName() -/*****************************************************************************/ -{ - eval_pv("$main::string1 = $main::build_lst_obj->getModuleName();", FALSE); - checkOperationSuccess(); - char* pString = SvPV_nolen(get_sv("main::string1", FALSE)); - ByteString sModuleName(pString); - return sModuleName; -} - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getDirDependencies(const ByteString& rJobDir, const ByteString& rJobType, const ByteString& rJobPlatform) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rJobDir.GetBuffer()); - sv_setpv(string_obj2, rJobType.GetBuffer()); - sv_setpv(string_obj3, rJobPlatform.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getDirDependencies($main::string1, $main::string2, $main::string3);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -}; - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getJobTypes(const ByteString& rJobDir) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rJobDir.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getJobTypes($main::string1);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -}; - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getJobPlatforms(const ByteString& rJobDir) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rJobDir.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getJobPlatforms($main::string1);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -}; - -/*****************************************************************************/ -FullByteStringListWrapper XmlBuildList::getJobBuildReqPlatforms(const ByteString& rJobDir, const ByteString& rBuildReqName) -/*****************************************************************************/ -{ - sv_setpv(string_obj1, rJobDir.GetBuffer()); - sv_setpv(string_obj2, rBuildReqName.GetBuffer()); - eval_pv("@array = $main::build_lst_obj->getJobBuildReqPlatforms($main::string1, $main::string2);", FALSE); - checkOperationSuccess(); - FullByteStringList* pList = extractArray(); - return FullByteStringListWrapper(pList); -}; diff --git a/soldep/bootstrp/makefile.mk b/soldep/bootstrp/makefile.mk index 48a6b244201f..52b21c878158 100644 --- a/soldep/bootstrp/makefile.mk +++ b/soldep/bootstrp/makefile.mk @@ -1,7 +1,7 @@ #************************************************************************* # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# +# # Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite @@ -35,7 +35,6 @@ PRJNAME=soldep TARGET=bootstrpdt ENABLE_EXCEPTIONS=true - # --- Settings ----------------------------------------------------- .INCLUDE : $(PRJ)$/util$/perl.mk @@ -50,8 +49,7 @@ all: # --- Files -------------------------------------------------------- EXCEPTIONSFILES= \ - $(SLO)$/prj.obj \ - $(SLO)$/XmlBuildList.obj + $(SLO)$/prj.obj SLOFILES=\ $(SLO)$/dep.obj \ @@ -59,8 +57,7 @@ SLOFILES=\ $(SLO)$/prodmap.obj \ $(SLO)$/appdef.obj \ $(SLO)$/hashtbl.obj \ - $(SLO)$/prj.obj \ - $(SLO)$/XmlBuildList.obj + $(SLO)$/prj.obj SHL1TARGET =$(TARGET)$(DLLPOSTFIX) @@ -73,7 +70,7 @@ SHL1STDLIBS=\ $(BTSTRPLIB) \ $(VOSLIB) \ $(SALLIB) \ - $(PERL_LIB) + $(PERL_LIB) DEF1NAME =$(SHL1TARGET) DEF1DEPN =$(MISC)$/$(SHL1TARGET).flt diff --git a/soldep/bootstrp/prj.cxx b/soldep/bootstrp/prj.cxx index c6a0fedd12b4..79cf654276c1 100644 --- a/soldep/bootstrp/prj.cxx +++ b/soldep/bootstrp/prj.cxx @@ -37,8 +37,6 @@ #include <tools/geninfo.hxx> #include <soldep/prj.hxx> #include <bootstrp/inimgr.hxx> -#include <soldep/XmlBuildList.hxx> -#include "XmlBuildListDef.hxx" #ifndef MACOSX #pragma hdrstop @@ -74,8 +72,6 @@ #endif #endif -static const char * XML_ALL = "all"; - // // class SimpleConfig // @@ -1105,46 +1101,42 @@ Prj& Prj::operator<< ( SvStream& rStream ) // /*****************************************************************************/ -Star::Star(XmlBuildList* pXmlBuildListObj) +Star::Star() /*****************************************************************************/ : pDepMode (NULL), - pAllDepMode (NULL), - mpXmlBuildList (pXmlBuildListObj) + pAllDepMode (NULL) { // this ctor is only used by StarWriter } /*****************************************************************************/ -Star::Star(XmlBuildList* pXmlBuildListObj, String aFileName, USHORT nMode ) +Star::Star( String aFileName, USHORT nMode ) /*****************************************************************************/ : nStarMode( nMode ), sFileName( aFileName ), pDepMode (NULL), - pAllDepMode (NULL), - mpXmlBuildList (pXmlBuildListObj) + pAllDepMode (NULL) { Read( aFileName ); } /*****************************************************************************/ -Star::Star(XmlBuildList* pXmlBuildListObj, SolarFileList *pSolarFiles ) +Star::Star( SolarFileList *pSolarFiles ) /*****************************************************************************/ : nStarMode( STAR_MODE_MULTIPLE_PARSE ), pDepMode (NULL), - pAllDepMode (NULL), - mpXmlBuildList (pXmlBuildListObj) + pAllDepMode (NULL) { // this ctor is used by StarBuilder to get the information for the whole workspace Read( pSolarFiles ); } /*****************************************************************************/ -Star::Star(XmlBuildList* pXmlBuildListObj, GenericInformationList *pStandLst, ByteString &rVersion, +Star::Star( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal, const char *pSourceRoot ) /*****************************************************************************/ : pDepMode (NULL), - pAllDepMode (NULL), - mpXmlBuildList (pXmlBuildListObj) + pAllDepMode (NULL) { UpdateFileList (pStandLst, rVersion, TRUE, bLocal, pSourceRoot); } @@ -1393,14 +1385,9 @@ void Star::Read( String &rFileName ) ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); StarFile *pFile = new StarFile( ssFileName ); if ( pFile->Exists()) { - if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) - { - ReadXmlBuildList(sFileName_l); - } else { SimpleConfig aSolarConfig( ssFileName ); while (( aString = aSolarConfig.GetNext()) != "" ) InsertToken (( char * ) aString.GetBuffer()); - } } aMutex.acquire(); ReplaceFileEntry (&aLoadedFilesList, pFile); @@ -1459,15 +1446,11 @@ void Star::Read( SolarFileList *pSolarFiles ) ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); StarFile *pFile = new StarFile( ssFileName ); - if ( pFile->Exists()) { - if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) - { - ReadXmlBuildList(sFileName_l); - } else { - SimpleConfig aSolarConfig( ssFileName ); - while (( aString = aSolarConfig.GetNext()) != "" ) - InsertToken (( char * ) aString.GetBuffer()); - } + if ( pFile->Exists()) + { + SimpleConfig aSolarConfig( ssFileName ); + while (( aString = aSolarConfig.GetNext()) != "" ) + InsertToken (( char * ) aString.GetBuffer()); DirEntry aEntry( pFile->GetName() ); DirEntry aEntryPrj = aEntry.GetPath().GetPath(); @@ -1500,7 +1483,6 @@ String Star::CreateFileName( String& rProject, String& rSourceRoot ) // this method is used to find solarlist parts of nabours (other projects) String sPrjDir( String::CreateFromAscii( "prj" )); String sBuildList( String::CreateFromAscii( "build.lst" )); - String sXmlBuildList( String::CreateFromAscii( "build.xlist" )); DirEntry aEntry( rSourceRoot ); aEntry += DirEntry( rProject ); @@ -1519,15 +1501,10 @@ String Star::CreateFileName( String& rProject, String& rSourceRoot ) aEntry += DirEntry( sPrjDir ); - DirEntry aPossibleEntry(aEntry); - aPossibleEntry += DirEntry( sXmlBuildList ); - aEntry += DirEntry( sBuildList ); DirEntry& aActualEntry = aEntry; - if (aPossibleEntry.Exists()) { - aActualEntry = aPossibleEntry; - } else if ( !aActualEntry.Exists() && aDBNotFoundHdl.IsSet()) + if ( !aActualEntry.Exists() && aDBNotFoundHdl.IsSet()) aDBNotFoundHdl.Call( &rProject ); return aActualEntry.GetFull(); } @@ -1986,164 +1963,6 @@ void Star::SetCurrentDeps (SByteStringList* pDepList) } /*****************************************************************************/ -void Star::ReadXmlBuildList(const ByteString& sBuildLstPath) { -/*****************************************************************************/ - if (mpXmlBuildList) { - Prj* pPrj = NULL; - - try { - mpXmlBuildList->loadXMLFile(sBuildLstPath); - } - catch (XmlBuildListException) { - DirEntry aDirEntry (sBuildLstPath); - String ssPrjName = aDirEntry.GetPath().GetPath().GetBase(); - ByteString sPrjName = ByteString(ssPrjName, RTL_TEXTENCODING_ASCII_US); - pPrj = GetPrj( sPrjName ); - if (pPrj) - { - //remove old Project - RemovePrj (pPrj); - } - return; - } - - try { - ByteString sProjectName = mpXmlBuildList->getModuleName(); - pPrj = GetPrj( sProjectName ); - if (pPrj) - { - //remove old Project - RemovePrj (pPrj); - } - - // insert new Project - pPrj = new Prj ( sProjectName ); - pPrj->SetPreFix( sProjectName ); // use ProjectName as Prefix - Insert(pPrj,LIST_APPEND); - - // get global dependencies - FullByteStringListWrapper aProducts = mpXmlBuildList->getProducts(); - ByteString aDepType = ByteString(DEP_MD_ALWAYS_STR); - if (mpXmlBuildList->hasModuleDepType(aProducts, aDepType)) - pPrj->HasHardDependencies( TRUE ); - - aDepType = ByteString(DEP_MD_FORCE_STR); - if (mpXmlBuildList->hasModuleDepType(aProducts, aDepType)) - { - pPrj->HasHardDependencies( TRUE ); - pPrj->HasFixedDependencies( TRUE ); - } - - // modul dependencies - ByteString sModulDepType = ByteString(); - FullByteStringListWrapper aModulDeps = mpXmlBuildList->getModuleDependencies(aProducts, sModulDepType); - ByteString * pModulDep = aModulDeps.First(); - while (pModulDep) - { - FullByteStringListWrapper aModulProducts = mpXmlBuildList->getModuleProducts(*pModulDep); - ByteString *pModulePoduct = aModulProducts.First(); - while (pModulePoduct) - { - if (*pModulePoduct == XML_ALL) - pPrj->AddDependencies( *pModulDep ); - else - pPrj->AddDependencies( *pModulDep, *pModulePoduct); - - pModulePoduct = aModulProducts.Next(); - } - pModulDep = aModulDeps.Next(); - } - - // job dirs - ByteString sJobType = ByteString(); - ByteString sJobPlatforms = ByteString(); - FullByteStringListWrapper aJobDirs = mpXmlBuildList->getJobDirectories(sJobType, sJobPlatforms); // all dirs - ByteString* pJobDir = aJobDirs.First(); - while (pJobDir) - { - FullByteStringListWrapper aJobPlatforms = mpXmlBuildList->getJobPlatforms (*pJobDir); - ByteString* pJobPlatform = aJobPlatforms.First(); - while (pJobPlatform) - { - ByteString sJobRestriction = ByteString(); - FullByteStringListWrapper aJobReq = mpXmlBuildList->getJobBuildReqs (*pJobDir, *pJobPlatform); - // nur ein Req pro Platform wird zur Zeit untersttzt - // mehr geht wegen der Struktur zur Zeit nicht! - // lese sie trotzdem kommasepariert ein, wenn ntig - if (aJobReq.Count() > 0) - { - ByteString* pRestriction = aJobReq.First(); - sJobRestriction = ByteString (*pRestriction); - pRestriction = aJobReq.Next(); - while (pRestriction) - { - sJobRestriction += ByteString (","); - sJobRestriction += ByteString (*pRestriction); - pRestriction = aJobReq.Next(); - } - } - - FullByteStringListWrapper aJobTypes = mpXmlBuildList->getJobTypes (*pJobDir); - ByteString * pJobType = aJobTypes.First(); - while(pJobType) - { - FullByteStringListWrapper aDirDependencies = mpXmlBuildList->getDirDependencies(*pJobDir, *pJobType, *pJobPlatform); - SByteStringList *pDepList = NULL; - if (aDirDependencies.Count() > 0) - { - pDepList = new SByteStringList; - ByteString* pDirDep = aDirDependencies.First(); - while (pDirDep) - { - ByteString sFullDir = sProjectName; - sFullDir += *pDirDep; - sFullDir.SearchAndReplaceAll('/', '\\'); - *pDirDep = sFullDir; - pDepList->PutString(pDirDep); // String wird bergeben - aDirDependencies.Remove(); // Zeiger aus alter Liste lschen - pDirDep = aDirDependencies.First(); - } - } - // insert CommandData - CommandData * pCmdData = new CommandData; - ByteString sRequiredPath = sProjectName; - sRequiredPath += *pJobDir; - sRequiredPath.SearchAndReplaceAll('/', '\\'); - pCmdData->SetPath(sRequiredPath); - pCmdData->SetCommandType( GetJobType(*pJobType) ); - pCmdData->SetCommandPara( ByteString() ); - pCmdData->SetOSType( GetOSType(*pJobPlatform) ); - ByteString sLogFileName = sProjectName; - sLogFileName += ByteString::CreateFromInt64( pPrj->Count() ); - pCmdData->SetLogFile( sLogFileName ); - pCmdData->SetClientRestriction( sJobRestriction ); - if ( pDepList ) - pCmdData->SetDependencies( pDepList ); - - pPrj->Insert ( pCmdData, LIST_APPEND ); - - pJobType = aJobTypes.Next(); - } - - pJobPlatform = aJobPlatforms.Next(); - } - - pJobDir = aJobDirs.Next(); - } - pPrj->ExtractDependencies(); - } - catch (XmlBuildListException) { - if (pPrj) - { - RemovePrj (pPrj); - delete pPrj; - } - - } - } -} - -/*****************************************************************************/ int Star::GetOSType ( ByteString& aWhatOS ) { /*****************************************************************************/ int nOSType = OS_NONE; @@ -2275,27 +2094,24 @@ Star& Star::operator<< ( SvStream& rStream ) // /*****************************************************************************/ -StarWriter::StarWriter( XmlBuildList* pXmlBuildListObj, String aFileName, BOOL bReadComments, USHORT nMode ) +StarWriter::StarWriter( String aFileName, BOOL bReadComments, USHORT nMode ) /*****************************************************************************/ - : Star (pXmlBuildListObj) { sFileName = aFileName; Read ( aFileName, bReadComments, nMode ); } /*****************************************************************************/ -StarWriter::StarWriter( XmlBuildList* pXmlBuildListObj, SolarFileList *pSolarFiles, BOOL bReadComments ) +StarWriter::StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments ) /*****************************************************************************/ - : Star (pXmlBuildListObj) { Read( pSolarFiles, bReadComments ); } /*****************************************************************************/ -StarWriter::StarWriter( XmlBuildList* pXmlBuildListObj, GenericInformationList *pStandLst, ByteString &rVersion, +StarWriter::StarWriter( GenericInformationList *pStandLst, ByteString &rVersion, ByteString &rMinor, BOOL bReadComments, BOOL bLocal, const char *pSourceRoot ) /*****************************************************************************/ - : Star (pXmlBuildListObj) { ByteString sPath( rVersion ); if ( pSourceRoot ) @@ -2444,15 +2260,11 @@ USHORT StarWriter::Read( String aFileName, BOOL bReadComments, USHORT nMode ) String ssFileName = *aFileList.GetObject(( ULONG ) 0 ); ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); StarFile *pFile = new StarFile( ssFileName ); - if ( pFile->Exists()) { - if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) - { - ReadXmlBuildList(sFileName_l); - } else { - SimpleConfig aSolarConfig( ssFileName ); - while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) - InsertTokenLine ( aString ); - } + if ( pFile->Exists()) + { + SimpleConfig aSolarConfig( ssFileName ); + while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) + InsertTokenLine ( aString ); } aMutex.acquire(); @@ -2480,17 +2292,11 @@ USHORT StarWriter::Read( SolarFileList *pSolarFiles, BOOL bReadComments ) String ssFileName = *pSolarFiles->GetObject(( ULONG ) 0 ); ByteString sFileName_l(ssFileName, RTL_TEXTENCODING_ASCII_US); StarFile *pFile = new StarFile( ssFileName); - if ( pFile->Exists()) { - if (sFileName_l.Len() >= RTL_CONSTASCII_LENGTH(XML_EXT) && ssFileName.EqualsAscii(XML_EXT, sFileName_l.Len() - RTL_CONSTASCII_LENGTH(XML_EXT), RTL_CONSTASCII_LENGTH(XML_EXT))) - { - ReadXmlBuildList(sFileName_l); - } - else - { - SimpleConfig aSolarConfig( ssFileName ); - while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) - InsertTokenLine ( aString ); - } + if ( pFile->Exists()) + { + SimpleConfig aSolarConfig( ssFileName ); + while (( aString = aSolarConfig.GetCleanedNextLine( bReadComments )) != "" ) + InsertTokenLine ( aString ); } aMutex.acquire(); diff --git a/soldep/inc/XmlBuildListDef.hxx b/soldep/inc/XmlBuildListDef.hxx deleted file mode 100755 index 2ea62679eb11..000000000000 --- a/soldep/inc/XmlBuildListDef.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XmlBuildListDef.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XMLBUILDLISTDEF_HXX -#define _XMLBUILDLISTDEF_HXX - -enum DepTypes -{ - mdsimple, - mdalways, - mdforce -}; - -#define DEP_MD_SIMPLE 1; -#define DEP_MD_ALWAYS 2; -#define DEP_MD_FORCE 4; - -static const char * DEP_MD_ALWAYS_STR = "md-always"; -static const char * DEP_MD_FORCE_STR = "md-force"; - -#endif - - diff --git a/soldep/inc/soldep/XmlBuildList.hxx b/soldep/inc/soldep/XmlBuildList.hxx deleted file mode 100644 index cfab946d453c..000000000000 --- a/soldep/inc/soldep/XmlBuildList.hxx +++ /dev/null @@ -1,160 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: XmlBuildList.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _XMLBUILDLIST_HXX -#define _XMLBUILDLIST_HXX - -#ifndef _STRING_HXX -#include <tools/string.hxx> -#endif - -#ifndef _LIST_HXX -#include <tools/list.hxx> -#endif - -#include <sal/types.h> - -class FullByteStringListWrapper; - -struct STRUCT_SV; - -DECLARE_LIST ( FullByteStingListImpl, ByteString* ) - -class FullByteStringList : public FullByteStingListImpl -{ - friend class FullByteStringListWrapper; - ULONG nRef; - void IncRef() { nRef ++; } - void DecRef() { nRef --; } - ULONG GetRef() { return nRef; } -public: - FullByteStringList(); - ~FullByteStringList(); - ULONG GetPos (ByteString& rStr); - ULONG GetPos( const ByteString* p ) const { return FullByteStingListImpl::GetPos(p); } - ULONG GetPos( const ByteString* p, ULONG nStartIndex, - BOOL bForward = TRUE ) const { return - FullByteStingListImpl::GetPos(p, nStartIndex, bForward); } -}; - -class FullByteStringListWrapper -{ -private: - FullByteStringList* pStringList; - -public: - FullByteStringListWrapper (FullByteStringList* pList) {pStringList = pList;} - ~FullByteStringListWrapper (); - - FullByteStringList* GetStringList() const {return pStringList;} - - void Insert( ByteString* p ){pStringList->Insert(p);} - void Insert( ByteString* p, ULONG nIndex ){pStringList->Insert(p, nIndex);} - void Insert( ByteString* pNew, ByteString* pOld ){pStringList->Insert(pNew, pOld);} - - ByteString* Remove(){return pStringList->Remove();} - ByteString* Remove( ULONG nIndex ){return pStringList->Remove(nIndex);} - ByteString* Remove( ByteString* p ) - { return pStringList->Remove(p); } - - ByteString* Replace( ByteString* p ){ return pStringList->Replace(p); } - ByteString* Replace( ByteString* p, ULONG nIndex ){ return pStringList->Replace(p, nIndex); } - ByteString* Replace( ByteString* pNew, ByteString* pOld ) - { return pStringList->Replace( pNew, pOld ); } - - ULONG Count() const { return pStringList->Count(); } - void Clear(){pStringList->Clear(); } - - ByteString* GetCurObject() const { return pStringList->GetCurObject(); } - ULONG GetCurPos() const { return pStringList->GetCurPos(); } - ByteString* GetObject( ULONG nIndex ) const { return pStringList->GetObject( nIndex ); } - ULONG GetPos( const ByteString* p ) const { return pStringList->GetPos(p); } - ULONG GetPos( const ByteString* p, ULONG nStartIndex, - BOOL bForward = TRUE ) const { return - pStringList->GetPos(p, nStartIndex, bForward); } - ULONG GetPos (ByteString& rStr) { return pStringList->GetPos(rStr); } - - ByteString* Seek( ULONG nIndex ) { return pStringList->Seek(nIndex); } - ByteString* Seek( ByteString* p ) { return pStringList->Seek(p); } - - ByteString* First() { return pStringList->First(); }; - ByteString* Last() { return pStringList->Last(); }; - ByteString* Next() { return pStringList->Next(); }; - ByteString* Prev() { return pStringList->Prev(); }; - - FullByteStringListWrapper & operator= ( const FullByteStringListWrapper &); -}; - - -class XmlBuildListException { - private: - const char* ExceptionMessage; - public: - XmlBuildListException(const char* Message) - :ExceptionMessage(Message) {}; - const char* getMessage() {return ExceptionMessage;}; -}; - -class XmlBuildList { - protected: - bool PerlInitialized; - void initPerl(const char* ModulePath); - // Set of arrays for each function, which uses char* arrays - // as a return value. Each call to such function clears its array up - // before it's being populated - FullByteStringList* extractArray(); - // C objects for $string1 & $string2 Perl variables - STRUCT_SV* string_obj1; - STRUCT_SV* string_obj2; - STRUCT_SV* string_obj3; - char* getError(); - void checkOperationSuccess(); - public: - // alternative to constructor - XmlBuildList(const ByteString& rModulePath); - ~XmlBuildList(); - void loadXMLFile(const ByteString& rBuildList); - FullByteStringListWrapper getProducts(); - FullByteStringListWrapper getJobDirectories(const ByteString& rJobType, const ByteString& rJobPlatform); - FullByteStringListWrapper getModuleDependencies(const ByteString& rProduct, const ByteString& rDependencyType); - FullByteStringListWrapper getModuleDependencies(FullByteStringListWrapper& rProducts, const ByteString& rDependencyType); - FullByteStringListWrapper getJobBuildReqs(const ByteString& rJobDir, const ByteString& rBuildReqPlatform); - ByteString getModuleDepType(const ByteString& rDepModuleName); - FullByteStringListWrapper getModuleDepTypes(FullByteStringListWrapper& rProducts); - sal_Bool hasModuleDepType(FullByteStringListWrapper& rProducts, const ByteString& rDependencyType); - FullByteStringListWrapper getModuleProducts(const ByteString& rDepModuleName); - ByteString getModuleName(); - FullByteStringListWrapper getDirDependencies(const ByteString& rJobDir, const ByteString& rJobType, const ByteString& rJobPlatform); - FullByteStringListWrapper getJobTypes(const ByteString& rJobDir); - FullByteStringListWrapper getJobPlatforms(const ByteString& rJobDir); - FullByteStringListWrapper getJobBuildReqPlatforms(const ByteString& rJobDir, const ByteString& rBuildReqName); -}; - -#endif diff --git a/soldep/inc/soldep/prj.hxx b/soldep/inc/soldep/prj.hxx index df6833eb8bcd..f3f1823eb480 100644 --- a/soldep/inc/soldep/prj.hxx +++ b/soldep/inc/soldep/prj.hxx @@ -39,8 +39,6 @@ #include <vos/mutex.hxx> #include <tools/string.hxx> -#define XML_EXT "xlist" - #define OS_NONE 0x0000 #define OS_WIN16 0x0001 #define OS_WIN32 0x0002 @@ -58,7 +56,6 @@ class SByteStringList; class GenericInformationList; -class XmlBuildList; /* // Pfade auf Konfigurationsdateien des Build-Servers @@ -377,7 +374,6 @@ protected: String sFileName; SByteStringList* pDepMode; SByteStringList* pAllDepMode; - XmlBuildList* mpXmlBuildList; Link aFileIOErrorHdl; // called with &String as parameter!!! @@ -389,11 +385,10 @@ protected: ULONG SearchFileEntry( StarFileList *pStarFiles, StarFile* pFile ); public: - Star( XmlBuildList* pXmlBuildListObj ); - Star( XmlBuildList* pXmlBuildListObj, String aFileName, USHORT nMode = STAR_MODE_SINGLE_PARSE ); - Star( XmlBuildList* pXmlBuildListObj, SolarFileList *pSolarFiles ); - Star( XmlBuildList* pXmlBuildListObj, GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal = FALSE, - const char *pSourceRoot = NULL ); + Star( ); + Star( String aFileName, USHORT nMode = STAR_MODE_SINGLE_PARSE ); + Star( SolarFileList *pSolarFiles ); + Star( GenericInformationList *pStandLst, ByteString &rVersion, BOOL bLocal = FALSE, const char *pSourceRoot = NULL ); ~Star(); @@ -403,8 +398,6 @@ public: ByteString GetName(){ return aStarName; }; // dummy function of VG void Read( String &rFileName ); void Read( SolarFileList *pSOlarFiles ); - void ReadXmlBuildList(const ByteString& sBuildLstPath); - BOOL HasProject( ByteString aProjectName ); Prj* GetPrj( ByteString aProjectName ); @@ -446,9 +439,9 @@ private: USHORT WritePrj( Prj *pPrj, SvFileStream& rStream ); public: - StarWriter( XmlBuildList* pXmlBuildListObj, String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE ); - StarWriter( XmlBuildList* pXmlBuildListObj, SolarFileList *pSolarFiles, BOOL bReadComments = FALSE ); - StarWriter( XmlBuildList* pXmlBuildListObj, GenericInformationList *pStandLst, ByteString &rVersion, ByteString &rMinor, + StarWriter( String aFileName, BOOL bReadComments = FALSE, USHORT nMode = STAR_MODE_SINGLE_PARSE ); + StarWriter( SolarFileList *pSolarFiles, BOOL bReadComments = FALSE ); + StarWriter( GenericInformationList *pStandLst, ByteString &rVersion, ByteString &rMinor, BOOL bReadComments = FALSE, BOOL bLocal = FALSE, const char *pSourceRoot = NULL ); void CleanUp(); diff --git a/soldep/inc/soldep/soldep.hxx b/soldep/inc/soldep/soldep.hxx index cca9ccbc6721..8c65e9ca08eb 100644 --- a/soldep/inc/soldep/soldep.hxx +++ b/soldep/inc/soldep/soldep.hxx @@ -55,7 +55,6 @@ class SolDep : public Depper ByteString msProject; ObjectWin* mpFocusWin; BOOL mbIsHide; - XmlBuildList* mpXmlBuildList; GenericInformationList *mpStandLst; diff --git a/soldep/prj/d.lst b/soldep/prj/d.lst index 25dd1b8530c9..73301a558e61 100644 --- a/soldep/prj/d.lst +++ b/soldep/prj/d.lst @@ -27,7 +27,6 @@ mkdir: %COMMON_DEST%\res%_EXT%\img\additional ..\inc\soldep\prj.hxx %_DEST%\inc%_EXT%\soldep\prj.hxx ..\inc\dep.hxx %_DEST%\inc%_EXT%\soldep\dep.hxx ..\inc\prodmap.hxx %_DEST%\inc%_EXT%\soldep\prodmap.hxx -..\inc\soldep\XmlBuildList.hxx %_DEST%\inc%_EXT%\soldep\XmlBuildList.hxx ..\inc\appdef.hxx %_DEST%\inc%_EXT%\soldep\appdef.hxx ..\inc\soldep\soldlg.hrc %_DEST%\inc%_EXT%\soldep\soldlg.hrc diff --git a/soldep/source/soldep.cxx b/soldep/source/soldep.cxx index a1188eb43c7d..bc4d096f764e 100644 --- a/soldep/source/soldep.cxx +++ b/soldep/source/soldep.cxx @@ -1,7 +1,7 @@ /*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -43,7 +43,6 @@ #include <soldep/depper.hxx>
#include <soldep/soldep.hxx>
#include <soldep/soldlg.hxx>
-#include <soldep/XmlBuildList.hxx>
#include "dtsodcmp.hrc"
IMPLEMENT_HASHTABLE_OWNER( SolIdMapper, ByteString, ULONG* );
@@ -66,19 +65,8 @@ SolDep::SolDep( Window* pBaseWindow ) : Depper( pBaseWindow ),
mbBServer(FALSE),
mpTravellerList( NULL ),
- mbIsHide( FALSE ),
- mpXmlBuildList (NULL)
+ mbIsHide( FALSE )
{
- /*
- ByteString sModulPath ("."); // wo soll das Perlmodul stehen???
- try
- {
- mpXmlBuildList = new XmlBuildList (sModulPath);
- }
- catch (XmlBuildListException& Exception) {
- const char* Message = Exception.getMessage();
- }
- */
mnSolWinCount = 0;
mnSolLastId = 0;
// mpPrjIdMapper = new SolIdMapper( 63997 );
@@ -103,8 +91,6 @@ SolDep::~SolDep() delete mpSolIdMapper;
delete mpStarWriter;
delete mpStandLst;
- if (mpXmlBuildList)
- delete mpXmlBuildList;
}
/*****************************************************************************/
@@ -296,7 +282,7 @@ IMPL_LINK( SolDep, ToolSelect, SoldepToolBox* , pBox) SvFileStream aStream( String::CreateFromAscii("d:\\out.svm"), STREAM_STD_READWRITE );
aMtf.Write( aStream );
break;
- }
+ }
case TID_SOLDEP_HIDE_INDEPENDEND:
{
ToggleHideDependency();
@@ -571,12 +557,12 @@ USHORT SolDep::ReadSource(BOOL bUpdater) mpSolIdMapper = new SolIdMapper( 63997 );
if (mpStandLst && bUpdater)
{
- mpStarWriter = new StarWriter( mpXmlBuildList, mpStandLst, msVersionMajor, msVersionMinor, TRUE );
+ mpStarWriter = new StarWriter( mpStandLst, msVersionMajor, msVersionMinor, TRUE );
} else
{
SolarFileList* pSolarFileList;
pSolarFileList = GetPrjListFromDir();
- mpStarWriter = new StarWriter( mpXmlBuildList, pSolarFileList, TRUE );
+ mpStarWriter = new StarWriter( pSolarFileList, TRUE );
}
ByteString sTitle( SOLDEPL_NAME );
if ( mpStarWriter->GetMode() == STAR_MODE_SINGLE_PARSE ) {
|