diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2008-05-07 13:27:20 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2008-05-07 13:27:20 +0000 |
commit | 9b93544b0ee1323fbb5498cf7f599d97e374be7f (patch) | |
tree | 78d3ddb4e216f0df26ced8dc9bc44bb1cc912ffb /modules/WB26WorkspaceCreator.pm | |
parent | 614123bb124dd4081d753b9557daecf9851c4716 (diff) | |
download | MPC-9b93544b0ee1323fbb5498cf7f599d97e374be7f.tar.gz |
ChangeLogTag: Wed May 7 13:30:37 UTC 2008 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/WB26WorkspaceCreator.pm')
-rw-r--r-- | modules/WB26WorkspaceCreator.pm | 106 |
1 files changed, 38 insertions, 68 deletions
diff --git a/modules/WB26WorkspaceCreator.pm b/modules/WB26WorkspaceCreator.pm index e3d54d33..e55451cc 100644 --- a/modules/WB26WorkspaceCreator.pm +++ b/modules/WB26WorkspaceCreator.pm @@ -70,13 +70,8 @@ sub write_comps { } sub post_workspace { - my($self) = shift; - my($fh) = shift; - my($creator) = shift; - my($crlf) = $self->crlf(); - my $pjs = $self->get_project_info(); - my @list = $self->sort_dependencies($self->get_projects(), 0); - my $all = 'description.buildorder='; + my($self, $fh, $creator) = @_; + my $crlf = $self->crlf(); foreach my $project ($self->sort_dependencies($self->get_projects(), 0)) { print $fh "$project$crlf"; @@ -86,7 +81,8 @@ sub post_workspace { sub get_additional_output { ## Create the accompanying list file. It always goes in the same - ## directory as the first workspace output file. + ## directory as the first workspace output file. See + ## WorkspaceCreator.pm for a description of the array elements. return [[undef, 'wb26projects.lst', \&list_file_body]]; } @@ -115,75 +111,49 @@ sub list_file_body { sub add_dependencies { my($self, $creator, $proj) = @_; - my $fh = new FileHandle(); - my($outdir) = Cwd::abs_path($self->mpc_dirname($proj)); - my($outfile) = $outdir . '/.project'; - - if (open($fh, "$outfile")) { - my $write; - my @read = (); - my $cwd = $self->getcwd(); - while(<$fh>) { - if (/MPC\s+ADD\s+DEPENDENCIES/) { - $write = 1; - my $crlf = $self->crlf(); - my $deps = $self->get_validated_ordering($proj); - foreach my $dep (@$deps) { - my $relative = $self->get_relative_dep_file($creator, - "$cwd/$proj", $dep); - if (defined $relative) { - push(@read, "\t\t<project>$dep\</project>$crlf"); + my $fh = new FileHandle(); + my $pre = "\t\t" . '<project>'; + my $post = '</project>'; + my $outdir = Cwd::abs_path($self->mpc_dirname($proj)); + my $outfile = $outdir . '/.project'; + + ## Go through twice to edit both the .project and .wrproject files + for(my $i = 0; $i < 2; $i++) { + if (open($fh, "$outfile")) { + my @read = (); + my $cwd = $self->getcwd(); + while(<$fh>) { + if (/MPC\s+ADD\s+DEPENDENCIES/) { + my $crlf = $self->crlf(); + my $deps = $self->get_validated_ordering($proj); + foreach my $dep (@$deps) { + my $relative = $self->get_relative_dep_file($creator, + "$cwd/$proj", $dep); + if (defined $relative) { + push(@read, "$pre$dep$post$crlf"); + } } } - last if (!$write); - } - else { - push(@read, $_); - } - } - close($fh); - - if ($write && open($fh, ">$outfile")) { - foreach my $line (@read) { - print $fh $line; + else { + push(@read, $_); + } } close($fh); - } - } - ## The dependencies need to go into the .wrproject - $outfile = $outdir . '/.wrproject'; - - if (open($fh, $outfile)) { - my $write; - my @read = (); - my $cwd = $self->getcwd(); - while(<$fh>) { - if (/MPC\s+ADD\s+DEPENDENCIES/) { - $write = 1; - my $crlf = $self->crlf(); - my $deps = $self->get_validated_ordering($proj); - foreach my $dep (@$deps) { - my $relative = $self->get_relative_dep_file($creator, - "$cwd/$proj", $dep); - if (defined $relative) { - push(@read, " <subproject project=\"/$dep\"/>$crlf"); - } + if (open($fh, ">$outfile")) { + foreach my $line (@read) { + print $fh $line; } - last if (!$write); - } - else { - push(@read, $_); + close($fh); } } - close($fh); - if ($write && open($fh, ">$outfile")) { - foreach my $line (@read) { - print $fh $line; - } - close($fh); - } + ## The dependencies need to go into the .wrproject too, so transform + ## the name and the pre and post values. + $outfile = $outdir . '/.wrproject'; + $pre = ' <subproject project="/'; + $post = '"/>'; + } } |