نديم ابن ﺤﻣﻮﺪﺓ الخمير - Nadim Khemir > PerlBuildSystem-0.44 > PBS::SubpbsResult

Download:
PerlBuildSystem-0.44.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  5
Open  2
View/Report Bugs
Module Version: 0.02   Source  

NAME ^

PBS::SubpbsResult - Support for hierarchical projects

SYNOPSIS ^

  use PBS::SubpbsResult ;

 my $subpbs_result = new PBS::SubpbsResult($file_name) ;
 my @search_paths = @{ $subpbs_result->GetLibrarySearchPaths()} ;

DESCRIPTION ^

Pbs strives to let you build hierarchical projects, this module simplifies the task of returning sub module information to the module parent. This module is amainly used in Builders.

This module lets you create files which hold the information. Below are two examples.

linker information

Say you have module A which has a link dependency on module B. Module B needs to be linked with and extra library. A and B are build in different project (a subpbs for B exists).

When linking your project, you need to know at the top level what B needs to be linked with. To avoid putting knowledge of B's dependencies in the build of A, we would like the link information to be returned in a generic way to A.

Module B build result, when invoked from A's build is a '.subpbs_result' file.

 # make A depend on B's build result
 AddRule 'module B', ['A.o' => 'some_A_file.o', 'B.subpbs_result'], \&Build_A ;
 
 # Build B in a subpbs
 AddSubpbRule('B.subpbs_result', 'somepbs_file.pl')
 
 sub Build_A
 {
 use PBS::SubpbsResult ;
 ...
 
 my @objects_to_link ;
 my @libs ;
 my @other_specific_information ;
 my $very_special_information ;
 
 for my $dependency (@dependencies)
        {
        if($dependency =~ /\.subpbs_result/)
                {
                my $subpbs_result = new PBS::SubpbsResult($dependency) ;
                
                push @objects_to_link, GetObjects($subpbs_result) ;
                push @libs, GetLibraries($subpbs_result) ;
                
                push @other_specific_information = GetOtherSpecificInformation($subpbs_result) ;
                $very_special_information = GetVerySpecialInformation($subpbs_result)[0] ;
                }
        }
 ...
 }
 
 # in somepbs_file.pl
 
 my @libraries = ('some_lib', 'some_other_lib') ;
 my @other_specific_information = ('specific1', 'specific2') ;
 my $very_special_information = 1 ;
 
 AddRule 'B.subpbs_result', ['B.subpbs_result' => 'b1.o', 'b2.o', 'C.subpbs_result'], \&BuildSubpbsResult ;
 
 sub BuildSubpbsResult
 {
 ...
 
 use PBS::SubpbsResult ;
 my $subpbs_result = new PBS::SubpbsResult() ;
 
 for my $dependency (@dependencies)
        {
        if($dependency =~ /\.subpbs_result$/)
                {
                $subpbs_result->Append($dependency) ;
                }
        else
                {
                $subpbs_result->AddObjects({NAME =>$dependency, MD5 => $md5}) ;
                }
        }
 
 $subpbs_result->AddLibraries(@libraries) ;
 $subpbs_result->AddWithMd5('other_specific_information', @other_specific_information) ;
 $subpbs_result->Add('very_special_information', $very_special_information) ;
 
 $subpbs_result->Write($dependent) ;
 }

speeding sub module archives creation

We (Anders and I) had a project, which had a top-down hierarchy, though of building archives at all the sub levels and merge the archives while going up the levels. We soon find out that 'ar' didn't merge archives so we had to unpack the sub levels archives before archiving them again. That took very long time! We stopped using 'ar' and instead uses a pbs_result file where the archive was replaced with a list of file links.

MEMBER FUNCTIONS ^

new

Create a new SubpbsResult object. an optional setup argument can be passed to i<new>

Append

This function can be passed a SubpbsResult or the name of a file containing a SubpbsResult serialization (Done with Data::Dumper).

Add

Adds an entry to the object. The entry class is created if it doesn't exist.

Arguments:

Get

Returns the list of values added in the class.

Arguments:

Read

Deserialized the object from a file.

Arguments:

Write

Serialized the object to a file.

Arguments:

EXPORT ^

Nothing.

AUTHOR ^

Khemir Nadim ibn Hamouda. nadim@khemir.net

syntax highlighting: