Apply "excludes" for OutputFileProducer

"excludes" should be applied both SourceFileProducer and
OutputFileProducer. But we've been missing the latter.
(see android/paths_test.go)

There's one more to note. Previously, the exclusion was done by
modifying slice directly, which caused some problem(b/76179848).
The fix was returning a copy from Srcs() method. But there're still many
implementors which just return internal slices directly.

This change creates a new array when it needs to exclude something from
returned slice.

Bug: n/a
Test: m (soong test added)
Change-Id: I1ba91e490cb55fc243020681667278cdc75f59df
This commit is contained in:
Jooyung Han
2020-07-05 10:23:14 +09:00
parent 8fab5bcce3
commit 7607dd3564
3 changed files with 30 additions and 22 deletions

View File

@@ -1090,6 +1090,21 @@ func TestPathsForModuleSrc(t *testing.T) {
srcs: []string{buildDir + "/.intermediates/ofp/b/gen/c"},
rels: []string{"gen/c"},
},
{
name: "output file provider with exclude",
bp: `
test {
name: "foo",
srcs: [":b", ":c"],
exclude_srcs: [":c"]
}
output_file_provider {
name: "c",
outs: ["gen/c"],
}`,
srcs: []string{buildDir + "/.intermediates/ofp/b/gen/b"},
rels: []string{"gen/b"},
},
{
name: "special characters glob",
bp: `