Reapply "Make the enabled property configurable"
Previously, I had changed some loadhook-appended property structs
to use selects instead of the "target" property struct. This seems
to not be exactly equivalent because "target" properties are merged
with the regular properties later, at the time the arch mutator runs.
With this reapplication, leave those target property structs alone
to avoid breakages, but I'll have to look into what the issue is
with them later.
This reverts commit ed5276f0827915166e89b72bf26f7e65f68d2dd5.
Ignore-AOSP-First: This cl needs to be in a topic with internal-only projects, will cherrypick to aosp after.
Bug: 323382414
Test: m nothing --no-skip-soong-tests
Change-Id: If355d24506e3f117d27b21442a6c02bca3402dc7
diff --git a/cc/cc.go b/cc/cc.go
index e9cdc34..c84a65e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2509,7 +2509,7 @@
}
func (c *Module) DepsMutator(actx android.BottomUpMutatorContext) {
- if !c.Enabled() {
+ if !c.Enabled(actx) {
return
}
@@ -2757,7 +2757,7 @@
}
func BeginMutator(ctx android.BottomUpMutatorContext) {
- if c, ok := ctx.Module().(*Module); ok && c.Enabled() {
+ if c, ok := ctx.Module().(*Module); ok && c.Enabled(ctx) {
c.beginMutator(ctx)
}
}
diff --git a/cc/fuzz.go b/cc/fuzz.go
index 2436f33..b3e6639 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -433,7 +433,7 @@
return
}
// Discard non-fuzz targets.
- if ok := fuzz.IsValid(ccModule.FuzzModuleStruct()); !ok {
+ if ok := fuzz.IsValid(ctx, ccModule.FuzzModuleStruct()); !ok {
return
}
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index ae9da98..cf229c9 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -181,7 +181,7 @@
return
}
- if shouldSkipLlndkMutator(m) {
+ if shouldSkipLlndkMutator(mctx, m) {
return
}
@@ -201,8 +201,8 @@
}
// Check for modules that mustn't be LLNDK
-func shouldSkipLlndkMutator(m *Module) bool {
- if !m.Enabled() {
+func shouldSkipLlndkMutator(mctx android.BottomUpMutatorContext, m *Module) bool {
+ if !m.Enabled(mctx) {
return true
}
if !m.Device() {
diff --git a/cc/makevars.go b/cc/makevars.go
index 9251d6a..51bcbf0 100644
--- a/cc/makevars.go
+++ b/cc/makevars.go
@@ -279,7 +279,7 @@
sanitizerLibs := android.SortedStringValues(sanitizerVariables)
var sanitizerLibStems []string
ctx.VisitAllModules(func(m android.Module) {
- if !m.Enabled() {
+ if !m.Enabled(ctx) {
return
}
diff --git a/cc/ndk_abi.go b/cc/ndk_abi.go
index 86166dc..5beeab1 100644
--- a/cc/ndk_abi.go
+++ b/cc/ndk_abi.go
@@ -40,7 +40,7 @@
func (n *ndkAbiDumpSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var depPaths android.Paths
ctx.VisitAllModules(func(module android.Module) {
- if !module.Enabled() {
+ if !module.Enabled(ctx) {
return
}
@@ -78,7 +78,7 @@
func (n *ndkAbiDiffSingleton) GenerateBuildActions(ctx android.SingletonContext) {
var depPaths android.Paths
ctx.VisitAllModules(func(module android.Module) {
- if m, ok := module.(android.Module); ok && !m.Enabled() {
+ if m, ok := module.(android.Module); ok && !m.Enabled(ctx) {
return
}
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 25231fd..f326068 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -148,7 +148,7 @@
}
func (this *stubDecorator) stubsVersions(ctx android.BaseMutatorContext) []string {
- if !ctx.Module().Enabled() {
+ if !ctx.Module().Enabled(ctx) {
return nil
}
if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go
index e815172..3c48f68 100644
--- a/cc/ndk_sysroot.go
+++ b/cc/ndk_sysroot.go
@@ -150,7 +150,7 @@
var installPaths android.Paths
var licensePaths android.Paths
ctx.VisitAllModules(func(module android.Module) {
- if m, ok := module.(android.Module); ok && !m.Enabled() {
+ if m, ok := module.(android.Module); ok && !m.Enabled(ctx) {
return
}
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 2a1ee3c..3f70f37 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -82,7 +82,7 @@
hwasanGlobalOptions = []string{"heap_history_size=1023", "stack_history_size=512",
"export_memory_stats=0", "max_malloc_fill_size=131072", "malloc_fill_byte=0"}
memtagStackCommonFlags = []string{"-march=armv8-a+memtag"}
- memtagStackLlvmFlags = []string{"-dom-tree-reachability-max-bbs-to-explore=128"}
+ memtagStackLlvmFlags = []string{"-dom-tree-reachability-max-bbs-to-explore=128"}
hostOnlySanitizeFlags = []string{"-fno-sanitize-recover=all"}
deviceOnlySanitizeFlags = []string{"-fsanitize-trap=all"}
@@ -858,7 +858,7 @@
flags.Local.CFlags = append(flags.Local.CFlags, cfiCflags...)
flags.Local.AsFlags = append(flags.Local.AsFlags, cfiAsflags...)
- flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath + "/" + cfiBlocklistFilename))
+ flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath+"/"+cfiBlocklistFilename))
if Bool(s.Properties.Sanitize.Config.Cfi_assembly_support) {
flags.Local.CFlags = append(flags.Local.CFlags, cfiAssemblySupportFlag)
}
@@ -1378,7 +1378,7 @@
// Add the dependency to the runtime library for each of the sanitizer variants
func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
if c, ok := mctx.Module().(*Module); ok && c.sanitize != nil {
- if !c.Enabled() {
+ if !c.Enabled(mctx) {
return
}
var sanitizers []string
diff --git a/cc/tidy.go b/cc/tidy.go
index 76ac7d5..ec1e8a2 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -220,7 +220,7 @@
// (1) Collect all obj/tidy files into OS-specific groups.
ctx.VisitAllModuleVariants(module, func(variant android.Module) {
- if ctx.Config().KatiEnabled() && android.ShouldSkipAndroidMkProcessing(variant) {
+ if ctx.Config().KatiEnabled() && android.ShouldSkipAndroidMkProcessing(ctx, variant) {
return
}
if m, ok := variant.(*Module); ok {
diff --git a/cc/vndk.go b/cc/vndk.go
index 50e6d4b..548992d 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -322,8 +322,8 @@
}
// Check for modules that mustn't be VNDK
-func shouldSkipVndkMutator(m *Module) bool {
- if !m.Enabled() {
+func shouldSkipVndkMutator(ctx android.ConfigAndErrorContext, m *Module) bool {
+ if !m.Enabled(ctx) {
return true
}
if !m.Device() {
@@ -338,7 +338,7 @@
}
func IsForVndkApex(mctx android.BottomUpMutatorContext, m *Module) bool {
- if shouldSkipVndkMutator(m) {
+ if shouldSkipVndkMutator(mctx, m) {
return false
}
@@ -369,7 +369,7 @@
return
}
- if shouldSkipVndkMutator(m) {
+ if shouldSkipVndkMutator(mctx, m) {
return
}
@@ -548,6 +548,7 @@
func (txt *vndkLibrariesTxt) OutputFiles(tag string) (android.Paths, error) {
return android.Paths{txt.outputFile}, nil
}
+
func getVndkFileName(m *Module) (string, error) {
if library, ok := m.linker.(*libraryDecorator); ok {
return library.getLibNameHelper(m.BaseModuleName(), true, false) + ".so", nil