Support customizing behavior around sourceOrOutputDependencyTag
Previously, modules customized behavior around the handling of
sourceOrOutputDependencyTag by comparing them to android.SourceDepTag
and retrieving the module using something like this:
ctx.GetDirectDepWithTag(m, android.SourceDepTag)
The problem with that is it does not allow an output tag to be
specified and does not handle fully qualified names properly.
This adds the following:
* IsSourceDepTag and IsSourceDepTagWithOutputTag to check whether a
blueprint.DependencyTag is a sourceOrOutputDependencyTag. The latter
also checks that it has the correct output tag.
* GetModuleFromPathDep(ctx, moduleName, outputTag) as a replacement for
ctx.GetDirectDepWithTag(m, android.SourceDepTag).
Replaces usages of:
* t == SourceDepTag with IsSourceDepTagWithOutputTag(t, "")
* ctx.GetDirectDepWithTag(m, android.SourceDepTag) with
GetModuleFromPathDep(ctx, m, "")
It also deprecates the following:
* android.SourcDepTag - as a follow up change needs to modify the
sourceOrOutputDependencyTag will make this useless.
* ExpandSources, ExpandsSources - copies existing deprecated messages
from the implementation to the interface so that they can be seen
by users of that interface.
Bug: 193228441
Test: m nothing
Change-Id: I8c397232b8d7dc1f9702c04ad45ea7819d4631ae
diff --git a/rust/rust.go b/rust/rust.go
index 0a9869f..38f1742 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -990,7 +990,9 @@
case procMacroDepTag:
directProcMacroDeps = append(directProcMacroDeps, rustDep)
mod.Properties.AndroidMkProcMacroLibs = append(mod.Properties.AndroidMkProcMacroLibs, makeLibName)
- case android.SourceDepTag:
+ }
+
+ if android.IsSourceDepTagWithOutputTag(depTag, "") {
// Since these deps are added in path_properties.go via AddDependencies, we need to ensure the correct
// OS/Arch variant is used.
var helper string
@@ -1120,8 +1122,7 @@
}
if srcDep, ok := dep.(android.SourceFileProducer); ok {
- switch depTag {
- case android.SourceDepTag:
+ if android.IsSourceDepTagWithOutputTag(depTag, "") {
// These are usually genrules which don't have per-target variants.
directSrcDeps = append(directSrcDeps, srcDep)
}