diff options
author | Adam Mitz <mitza@ociweb.com> | 2016-09-22 14:29:23 -0500 |
---|---|---|
committer | Adam Mitz <mitza@ociweb.com> | 2016-09-22 14:29:23 -0500 |
commit | f0ac54f82ac90d0a1be88cf19fcd744a3de3e6ff (patch) | |
tree | 927f32321a896dc0f1975634cb93d1f075f16f1c /modules/ProjectCreator.pm | |
parent | 20b67e492882cf7a890d3979de58554496841d26 (diff) | |
download | MPC-f0ac54f82ac90d0a1be88cf19fcd744a3de3e6ff.tar.gz |
Allow CommandHelper::get_output to return more detailed dependency info.
Diffstat (limited to 'modules/ProjectCreator.pm')
-rw-r--r-- | modules/ProjectCreator.pm | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/modules/ProjectCreator.pm b/modules/ProjectCreator.pm index 011c47c1..7cbb6c91 100644 --- a/modules/ProjectCreator.pm +++ b/modules/ProjectCreator.pm @@ -1280,6 +1280,22 @@ sub handle_scoped_unknown { return 0, "Unrecognized line: $line"; } +sub add_custom_depend { + my($self, $tag, $key, $aref) = @_; + + my @deps = @$aref; + if ($self->{'convert_slashes'}) { + foreach my $dep (@deps) { + $dep =~ s/\//\\/g; + } + } + + $self->{'custom_special_depend'}->{$tag}->{$key} = [] + unless defined $self->{'custom_special_depend'}->{$tag}->{$key}; + StringProcessor::merge($self->{'custom_special_depend'}->{$tag}->{$key}, + \@deps); +} + sub process_component_line { my($self, $tag, $line, $fh, $flags, $grname, $current, $excarr, $comps, $count) = @_; @@ -1353,12 +1369,7 @@ sub process_component_line { $self->{'custom_special_output'}->{$tag}->{$key} = $self->create_array($out); } if (defined $dep) { - $self->{'custom_special_depend'}->{$tag}->{$key} = $self->create_array($dep); - if ($self->{'convert_slashes'}) { - foreach my $depfile (@{$self->{'custom_special_depend'}->{$tag}->{$key}}) { - $depfile =~ s/\//\\/g; - } - } + $self->add_custom_depend($tag, $key, $self->create_array($dep)); } } @@ -1370,8 +1381,15 @@ sub process_component_line { my $key = $line; $key =~ s/\\/\//g if ($self->{'convert_slashes'}); my $cmdflags = $$flags{'commandflags'}; - my $add_out = $cmdHelper->get_output($key, $cmdflags); + my($add_out, $deps) = $cmdHelper->get_output($key, $cmdflags); + push(@{$self->{'custom_special_output'}->{$tag}->{$key}}, @$add_out); + foreach my $depTag (keys %$deps) { + foreach my $depFile (keys %{$deps->{$depTag}}) { + $self->add_custom_depend($depTag, $depFile, + $deps->{$depTag}->{$depFile}); + } + } } ## Set up the files array. If the line contains a wild card @@ -3268,9 +3286,15 @@ sub generate_default_components { my $flags = defined $flo->{$tag}->{$file} ? $flo->{$tag}->{$file}->{$cmdflags} : $genext->{$tag}->{$cmdflags}; - my $add_out = $cmdHelper->get_output($file, $flags); + my ($add_out, $deps) = $cmdHelper->get_output($file, $flags); push(@{$self->{'custom_special_output'}->{$tag}->{$file}}, @$add_out); + foreach my $depTag (keys %$deps) { + foreach my $depFile (keys %{$deps->{$depTag}}) { + $self->add_custom_depend($depTag, $depFile, + $deps->{$depTag}->{$depFile}); + } + } } } } |