summaryrefslogtreecommitdiff
path: root/modules/WB26WorkspaceCreator.pm
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2008-03-18 18:56:24 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2008-03-18 18:56:24 +0000
commitdc692a066bd6394f7c2bc8084d32ffd40e45ff87 (patch)
tree4108a721c04642f76a3fc15767ee4a2564ec848e /modules/WB26WorkspaceCreator.pm
parent63aa1f627a3807be650d0ab3ca491438054c1e5b (diff)
downloadMPC-dc692a066bd6394f7c2bc8084d32ffd40e45ff87.tar.gz
ChangeLogTag: Tue Mar 18 18:56:35 UTC 2008 Chad Elliott <elliott_c@ociweb.com>
Diffstat (limited to 'modules/WB26WorkspaceCreator.pm')
-rw-r--r--modules/WB26WorkspaceCreator.pm64
1 files changed, 50 insertions, 14 deletions
diff --git a/modules/WB26WorkspaceCreator.pm b/modules/WB26WorkspaceCreator.pm
index 86af10be..eb9dbe1b 100644
--- a/modules/WB26WorkspaceCreator.pm
+++ b/modules/WB26WorkspaceCreator.pm
@@ -11,6 +11,8 @@ package WB26WorkspaceCreator;
# ************************************************************
use strict;
+use FileHandle;
+use File::Basename;
use WB26ProjectCreator;
use WorkspaceCreator;
@@ -28,11 +30,11 @@ sub workspace_file_name {
}
sub pre_workspace {
- my($self) = shift;
- my($fh) = shift;
+ my($self, $fh) = @_;
my($crlf) = $self->crlf();
- print $fh '#----------------------------------------------------------------------------', $crlf,
+ $self->print_workspace_comment($fh,
+ '#----------------------------------------------------------------------------', $crlf,
'# WindRiver Workbench generator', $crlf,
'#', $crlf,
'# $Id$', $crlf,
@@ -43,27 +45,61 @@ sub pre_workspace {
'#', $crlf,
'# MPC Command:', $crlf,
"# $0 @ARGV", $crlf,
- '#----------------------------------------------------------------------------', $crlf,
- 'version=1', $crlf,
+ '#----------------------------------------------------------------------------', $crlf);
+ print $fh 'version=1', $crlf,
'eclipse.preferences.version=1', $crlf,
'description.defaultbuildorder=false', $crlf;
}
sub write_comps {
- my($self) = shift;
- my($fh) = shift;
- my($projects) = $self->get_projects();
- my($pjs) = $self->get_project_info();
- my(%targnum) = ();
- my(@list) = $self->number_target_deps($projects, $pjs, \%targnum, 0);
- my($crlf) = $self->crlf();
- my($all) = 'description.buildorder=';
+ my($self, $fh) = @_;
+ my($pjs) = $self->get_project_info();
+ my(%targnum) = ();
+ my(@list) = $self->number_target_deps($self->get_projects(),
+ $pjs, \%targnum, 0);
+ my($all) = 'description.buildorder=';
## Construct the target
foreach my $project (@list) {
$all .= "$$pjs{$project}->[0]/";
}
- print $fh $all, $crlf;
+ print $fh $all, $self->crlf();
+
+ $self->write_list_file(\@list);
+}
+
+sub write_list_file {
+ my($self, $list) = @_;
+
+ ## Create the accompanying list file. It always goes in the same
+ ## directory as the "true" workspace output file.
+ my $fh = new FileHandle();
+ my $out = dirname($self->{'current_output'}) . '/wb26projects.lst';
+ if (open($fh, ">$out")) {
+ my $crlf = $self->crlf();
+ $self->print_workspace_comment($fh,
+ '#----------------------------------------------------------------------------', $crlf,
+ '# WindRiver Workbench generator', $crlf,
+ '#', $crlf,
+ '# $Id$', $crlf,
+ '#', $crlf,
+ '# This file was generated by MPC. Any changes made directly to', $crlf,
+ '# this file will be lost the next time it is generated.', $crlf,
+ '# MPC Command:', $crlf,
+ "# $0 @ARGV", $crlf,
+ '#----------------------------------------------------------------------------', $crlf);
+
+ ## Print out each target separately
+ foreach my $project (@$list) {
+ print $fh Cwd::abs_path($self->mpc_dirname($project)),
+ '/.project', $crlf;
+ }
+
+ close($fh);
+ }
+ else {
+ $self->warning("Unable to write to $out");
+ }
}
1;