Support tagged module references

There are cases where a module needs to refer to an intermediate
output of another module instead of its final output.  For example,
a module may want to use the .jar containing .class files from
another module whose final output is a .jar containing classes.dex
files.  Support a new ":module{.tag}" format in any property that
is annotated with `android:"path"`, which will query the target
module for its ".tag" output(s).

Test: path_properties_test.go, paths_test.go
Test: no unexpected changes in build.ninja
Change-Id: Icd3c9b0d83ff125771767c04046fcffb9fc3f65a
This commit is contained in:
Colin Cross
2019-05-29 14:40:35 -07:00
parent 4c2c46f0a7
commit 41955e8895
14 changed files with 408 additions and 87 deletions

View File

@@ -39,14 +39,12 @@ func pathDepsMutator(ctx BottomUpMutatorContext) {
pathProperties := pathPropertiesForPropertyStruct(ctx, ps)
pathProperties = FirstUniqueStrings(pathProperties)
var deps []string
for _, s := range pathProperties {
if m := SrcIsModule(s); m != "" {
deps = append(deps, m)
if m, t := SrcIsModuleWithTag(s); m != "" {
ctx.AddDependency(ctx.Module(), sourceOrOutputDepTag(t), m)
}
}
ctx.AddDependency(ctx.Module(), SourceDepTag, deps...)
}
}