Stop using deprecated functionality for managing path deps
This change stops using deprecated functionality and migrates this
repository's custom Soong code to support current practices to manage
path property related dependencies. i.e. when a property includes
something that looks like ":module".
ExtractSourcesDeps has been deprecated in favor of tagging properties
with `android:"path"` which will cause the pathDepsMutator to add the
dependencies automatically.
android.SourceDepTag has been deprecated as the underlying type needs
to be changed and this will no longer work for its current uses.
* ctx.GetDirectDepWithTag(moduleName, android.SourceDepTag) will not
work to retrieve a reference to the module dependency added for
path properties. GetModuleFromPathDep(ctx, moduleName, "") must be
used instead.
* depTag == android.SourceDepTag can no longer be used to check to
see if depTag was used to add a module dependency for a module
reference in a path property without any output tag.
IsSourceDepTagWithOutputTag(depTag, "") must be used instead.
Bug: 193228441
Test: m nothing
Change-Id: I307039612f0f2a541ac7dbfddd052ef78c290f60
diff --git a/build/soong/cil_compat_map.go b/build/soong/cil_compat_map.go
index f304e62..47fd14c 100644
--- a/build/soong/cil_compat_map.go
+++ b/build/soong/cil_compat_map.go
@@ -64,7 +64,7 @@
// compatibility mapping file. bottom_half may reference the outputs of
// other modules that produce source files like genrule or filegroup using
// the syntax ":module". srcs has to be non-empty.
- Bottom_half []string
+ Bottom_half []string `android:"path"`
// name of the output
Stem *string
}
@@ -97,7 +97,7 @@
expandedSrcFiles := make(android.Paths, 0, len(srcFiles))
for _, s := range srcFiles {
if m := android.SrcIsModule(s); m != "" {
- module := ctx.GetDirectDepWithTag(m, android.SourceDepTag)
+ module := android.GetModuleFromPathDep(ctx, m, "")
if module == nil {
// Error will have been handled by ExtractSourcesDeps
continue
@@ -161,7 +161,6 @@
}
func (c *cilCompatMap) DepsMutator(ctx android.BottomUpMutatorContext) {
- android.ExtractSourcesDeps(ctx, c.properties.Bottom_half)
if c.properties.Top_half != nil {
ctx.AddDependency(c, TopHalfDepTag, String(c.properties.Top_half))
}
diff --git a/build/soong/compat_cil.go b/build/soong/compat_cil.go
index 230fdc3..46b0f71 100644
--- a/build/soong/compat_cil.go
+++ b/build/soong/compat_cil.go
@@ -41,7 +41,7 @@
type compatCilProperties struct {
// List of source files. Can reference se_filegroup type modules with the ":module" syntax.
- Srcs []string
+ Srcs []string `android:"path"`
// Output file name. Defaults to module name if unspecified.
Stem *string
@@ -55,7 +55,7 @@
srcPaths := make(android.Paths, 0, len(c.properties.Srcs))
for _, src := range c.properties.Srcs {
if m := android.SrcIsModule(src); m != "" {
- module := ctx.GetDirectDepWithTag(m, android.SourceDepTag)
+ module := android.GetModuleFromPathDep(ctx, m, "")
if module == nil {
// Error would have been handled by ExtractSourcesDeps
continue
@@ -76,10 +76,6 @@
return srcPaths
}
-func (c *compatCil) DepsMutator(ctx android.BottomUpMutatorContext) {
- android.ExtractSourcesDeps(ctx, c.properties.Srcs)
-}
-
func (c *compatCil) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if c.ProductSpecific() || c.SocSpecific() || c.DeviceSpecific() {
ctx.ModuleErrorf("Compat cil files only support system and system_ext partitions")
diff --git a/build/soong/selinux_contexts.go b/build/soong/selinux_contexts.go
index a9aed60..bbb8639 100644
--- a/build/soong/selinux_contexts.go
+++ b/build/soong/selinux_contexts.go
@@ -140,7 +140,11 @@
var inputs android.Paths
- ctx.VisitDirectDepsWithTag(android.SourceDepTag, func(dep android.Module) {
+ ctx.VisitDirectDeps(func(dep android.Module) {
+ depTag := ctx.OtherModuleDependencyTag(dep)
+ if !android.IsSourceDepTagWithOutputTag(depTag, "") {
+ return
+ }
segroup, ok := dep.(*fileGroup)
if !ok {
ctx.ModuleErrorf("srcs dependency %q is not an selinux filegroup",