1 package CCWorkspaceCreator
;
3 # ************************************************************
4 # Description : A Code Composer Workspace creator
5 # Author : Chad Elliott
6 # Create Date : 9/18/2006
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
20 @ISA = qw(WinWorkspaceBase WorkspaceCreator);
22 # ************************************************************
24 # ************************************************************
32 sub workspace_file_extension
{
34 return '.code_composer';
39 my($self, $fh, $creator) = @_;
40 my $crlf = $self->crlf();
42 ## Workspace only consists of the name of the project. Really, Code
43 ## Composer doesn't use a workspace. Each project contains the
45 foreach my $project ($self->sort_dependencies($self->get_projects(), 0)) {
46 print $fh "$project$crlf";
47 $self->add_dependencies($creator, $project);
52 sub add_dependencies
{
53 my($self, $creator, $proj) = @_;
54 my $fh = new FileHandle
();
55 my $outdir = $self->get_outdir();
56 $outdir = $self->getcwd() if ($outdir eq '.');
58 if (open($fh, "$outdir/$proj")) {
61 my $cwd = $self->getcwd();
63 ## This is a comment found in cc.mpd if the project contains the
64 ## 'after' keyword setting.
65 if (/MPC\s+ADD\s+DEPENDENCIES/) {
67 my $crlf = $self->crlf();
68 my $deps = $self->get_validated_ordering($proj);
69 foreach my $dep (@
$deps) {
70 my $relative = $self->get_relative_dep_file($creator,
72 if (defined $relative) {
74 ## Indicate that we need to re-write the file and add in
75 ## the start of the project dependencies section
77 push(@read, "[Project Dependencies]$crlf");
80 ## Add in the dependency and save the project name for later.
81 push(@read, "Source=\"$relative\"$crlf");
82 push(@projs, $relative);
86 ## Finish off the dependency information for the current
89 foreach my $proj (@projs) {
90 push(@read, "[\"$proj\" Settings]$crlf",
91 "MatchConfigName=true$crlf", $crlf);
95 ## We don't need to re-write the file, so we can stop reading
101 ## Save the line to possibly be written out at the end.
107 ## If we need to re-write the file, then do so
108 if ($write && open($fh, ">$outdir/$proj")) {
109 foreach my $line (@read) {