diff options
author | elliott_c <ocielliottc@users.noreply.github.com> | 2010-01-04 15:29:07 +0000 |
---|---|---|
committer | elliott_c <ocielliottc@users.noreply.github.com> | 2010-01-04 15:29:07 +0000 |
commit | 45c1b1500f69ebf04959e44cc3846115ab363cdc (patch) | |
tree | 27c3e9ec7c0cb128abe6e11d8b113b09c9b7e5ce | |
parent | 95c25eef9f5c102b318f946acebbf16e8fcbd944 (diff) | |
download | MPC-45c1b1500f69ebf04959e44cc3846115ab363cdc.tar.gz |
ChangeLogTag: Mon Jan 4 15:25:54 UTC 2010 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r-- | ChangeLog | 25 | ||||
-rw-r--r-- | config/qt.mpb | 5 | ||||
-rw-r--r-- | modules/Creator.pm | 31 | ||||
-rw-r--r-- | modules/Depgen/DependencyEditor.pm | 5 | ||||
-rw-r--r-- | modules/ProjectCreator.pm | 21 | ||||
-rw-r--r-- | modules/WorkspaceCreator.pm | 21 |
6 files changed, 73 insertions, 35 deletions
@@ -1,3 +1,28 @@ +Mon Jan 4 15:25:54 UTC 2010 Chad Elliott <elliott_c@ociweb.com> + + * config/qt.mpb: + + Added an include path for non-Windows project types. + + * modules/Creator.pm: + + Added a method to replace environment variables within a string. + This isn't new code, it's just removal of duplicated code. + + * modules/Depgen/DependencyEditor.pm: + + Don't process directories as if they were files. + + * modules/ProjectCreator.pm: + + Use environment variable replacement method from Creator. + + * modules/WorkspaceCreator.pm: + + Replace environment variables in non-scoped assignments as they + are encountered. This avoids errors in 'cmdline' assignments + within aggregated workspaces. + Sat Jan 2 16:37:15 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu> * config/odbc.mpb: diff --git a/config/qt.mpb b/config/qt.mpb index 00653cae..d0dca9f7 100644 --- a/config/qt.mpb +++ b/config/qt.mpb @@ -8,6 +8,11 @@ project { macros += QT_THREAD_SUPPORT lit_libs += qt-mt$(QT_VERSION) + // Some Linux installations have the includes here. + specific(!prop:windows) { + includes += /usr/include/qt3 + } + Define_Custom(UIC) { automatic = 1 command = $(QTDIR)/bin/uic diff --git a/modules/Creator.pm b/modules/Creator.pm index 559513a4..c0d1e71f 100644 --- a/modules/Creator.pm +++ b/modules/Creator.pm @@ -40,7 +40,7 @@ my %languages = (cplusplus => 1, csharp => 1, java => 1, vb => 1, - ); + ); my $assign_key = 'assign'; my $gassign_key = 'global_assign'; @@ -996,7 +996,7 @@ sub expand_variables { } $ival .= $append if (defined $append); - ## We have to remove the leading ./ if there is one. + ## We have to remove the leading ./ if there is one. ## Otherwise, if this value is used as an exclude value it will ## not match up correctly. $ival =~ s!^\./!!; @@ -1070,6 +1070,33 @@ sub expand_variables { } +sub replace_env_vars { + my($self, $lref) = @_; + my $one_empty = undef; + + ## Loop through the string until we find no more environment variables. + while($$lref =~ /\$(\w+)/) { + my $name = $1; + my $val = ''; + + ## PWD is a special variable. It isn't set on Windows, but in MPC we + ## must guarantee that it is always there. + if ($name eq 'PWD') { + $val = $self->getcwd(); + } + elsif (defined $ENV{$name}) { + $val = $ENV{$name}; + } + else { + ## Keep track of an environment variable not being set. + $one_empty = 1; + } + $$lref =~ s/\$\w+/$val/; + } + return $one_empty; +} + + sub relative { my($self, $value, $expand_template, $scope) = @_; diff --git a/modules/Depgen/DependencyEditor.pm b/modules/Depgen/DependencyEditor.pm index 23787261..6f551d64 100644 --- a/modules/Depgen/DependencyEditor.pm +++ b/modules/Depgen/DependencyEditor.pm @@ -56,7 +56,10 @@ sub process { $type, $noinline, $exclude); ## Sort the files so the dependencies are reproducible foreach my $file (sort @$files) { - print $fh $dep->process($file), "\n"; + ## In some situations we may be passed a directory as part of an + ## option. If it is an unknown option, we may think the directory + ## needs to be part of the dependencies when it should not. + print $fh $dep->process($file), "\n" if (!-d $file); } ## Write out the end of the block warning diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm index 082bc53c..28e14ac5 100644 --- a/modules/ProjectCreator.pm +++ b/modules/ProjectCreator.pm @@ -1162,23 +1162,8 @@ sub handle_scoped_unknown { } else { if (!defined $self->{'expanded'}->{$type}) { - my $ok = 1; - while($line =~ /\$(\w+)/) { - my $name = $1; - my $val = ''; - if ($name eq 'PWD') { - $val = $self->getcwd(); - } - elsif (defined $ENV{$name}) { - $val = $ENV{$name}; - } - else { - $ok = undef; - last; - } - $line =~ s/\$\w+/$val/; - } - if ($ok) { + my $undef = $self->replace_env_vars(\$line); + if (!$undef) { ## This is a special concession for Windows. It will not allow ## you to set an empty environment variable. If an empty ## double quoted string is found, we will assume that the user @@ -3153,7 +3138,7 @@ sub remove_duplicated_files { ## There's no point in going on if there's nothing in this component ## list. return undef if ($#slist == -1); - + ## Convert the array into keys for a hash table my %shash; @shash{@slist} = (); diff --git a/modules/WorkspaceCreator.pm b/modules/WorkspaceCreator.pm index d11c81ef..f4c497a0 100644 --- a/modules/WorkspaceCreator.pm +++ b/modules/WorkspaceCreator.pm @@ -130,10 +130,8 @@ sub set_verbose_ordering { sub modify_assignment_value { - my($self, $name, $value) = @_; - ## Workspace assignments do not need modification. - return $value; + return $_[2]; } @@ -233,6 +231,11 @@ sub parse_line { } elsif ($values[0] eq '1') { if (defined $validNames{$values[1]}) { + ## This code only runs when there is a non-scoped assignment. As + ## such, we can safely replace all environment variables here so + ## that they are not incorrectly handled in aggregated + ## workspaces. + $self->replace_env_vars(\$values[2]) if ($values[2] =~ /\$/); $self->process_assignment_add($values[1], $values[2], $flags); } else { @@ -1881,17 +1884,7 @@ sub process_cmdline { ## Look for environment variables foreach my $arg (@$args) { - while($arg =~ /\$(\w+)/) { - my $name = $1; - my $val = ''; - if ($name eq 'PWD') { - $val = $self->getcwd(); - } - elsif (defined $ENV{$name}) { - $val = $ENV{$name}; - } - $arg =~ s/\$\w+/$val/; - } + $self->replace_env_vars(\$arg) if ($arg =~ /\$/); } my $options = $self->options('MWC', {}, 0, @$args); |