Replace ModuleContext.AConfig() with Config()
AConfig() now duplicates Config(). Replace the uses of AConfig()
with Config(). Leave AConfig() for now until code in other
projects is cleaned up.
Test: m checkbuild
Change-Id: Ic88be643049d21dba45dbd1a65588ed94bf43bdc
diff --git a/cc/binary.go b/cc/binary.go
index 5f81866..206237a 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -182,7 +182,7 @@
if !ctx.toolchain().Bionic() {
if ctx.Os() == android.Linux {
- if binary.Properties.Static_executable == nil && Bool(ctx.AConfig().ProductVariables.HostStaticBinaries) {
+ if binary.Properties.Static_executable == nil && Bool(ctx.Config().ProductVariables.HostStaticBinaries) {
binary.Properties.Static_executable = BoolPtr(true)
}
} else {
@@ -204,7 +204,7 @@
flags = binary.baseLinker.linkerFlags(ctx, flags)
if ctx.Host() && !binary.static() {
- if !ctx.AConfig().IsEnvTrue("DISABLE_HOST_PIE") {
+ if !ctx.Config().IsEnvTrue("DISABLE_HOST_PIE") {
flags.LdFlags = append(flags.LdFlags, "-pie")
if ctx.Windows() {
flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
diff --git a/cc/cc.go b/cc/cc.go
index e18b2cc..891dccb 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -945,7 +945,7 @@
clang = true
}
- if ctx.Device() && ctx.AConfig().DeviceUsesClang() {
+ if ctx.Device() && ctx.Config().DeviceUsesClang() {
clang = true
}
}
@@ -1441,10 +1441,10 @@
}
func getCurrentNdkPrebuiltVersion(ctx DepsContext) string {
- if ctx.AConfig().PlatformSdkVersionInt() > config.NdkMaxPrebuiltVersionInt {
+ if ctx.Config().PlatformSdkVersionInt() > config.NdkMaxPrebuiltVersionInt {
return strconv.Itoa(config.NdkMaxPrebuiltVersionInt)
}
- return ctx.AConfig().PlatformSdkVersion()
+ return ctx.Config().PlatformSdkVersion()
}
var Bool = proptools.Bool
diff --git a/cc/compiler.go b/cc/compiler.go
index fc2eeec..d510aa3 100644
--- a/cc/compiler.go
+++ b/cc/compiler.go
@@ -218,7 +218,7 @@
}
func addToModuleList(ctx ModuleContext, list string, module string) {
- getWallWerrorMap(ctx.AConfig(), list).Store(module, true)
+ getWallWerrorMap(ctx.Config(), list).Store(module, true)
}
// Create a Flags struct that collects the compile flags from global values,
@@ -360,7 +360,7 @@
fmt.Sprintf("${config.%sGlobalCflags}", hod))
}
- if Bool(ctx.AConfig().ProductVariables.Brillo) {
+ if Bool(ctx.Config().ProductVariables.Brillo) {
flags.GlobalFlags = append(flags.GlobalFlags, "-D__BRILLO__")
}
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index e69128c..459d980 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -117,7 +117,7 @@
return apiLevel, nil
}
- minVersion := ctx.AConfig().MinSupportedSdkVersion()
+ minVersion := ctx.Config().MinSupportedSdkVersion()
firstArchVersions := map[android.ArchType]int{
android.Arm: minVersion,
android.Arm64: 21,
@@ -188,7 +188,7 @@
}
func generateStubApiVariants(mctx android.BottomUpMutatorContext, c *stubDecorator) {
- platformVersion := mctx.AConfig().PlatformSdkVersionInt()
+ platformVersion := mctx.Config().PlatformSdkVersionInt()
firstSupportedVersion, err := normalizeNdkApiLevel(mctx, String(c.properties.First_version),
mctx.Arch())
@@ -207,7 +207,7 @@
for version := firstGenVersion; version <= platformVersion; version++ {
versionStrs = append(versionStrs, strconv.Itoa(version))
}
- versionStrs = append(versionStrs, mctx.AConfig().PlatformVersionActiveCodenames()...)
+ versionStrs = append(versionStrs, mctx.Config().PlatformVersionActiveCodenames()...)
versionStrs = append(versionStrs, "current")
modules := mctx.CreateVariations(versionStrs...)
diff --git a/cc/pgo.go b/cc/pgo.go
index ea23124..9fea154 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -181,7 +181,7 @@
//
// TODO Validate that each benchmark instruments at least one module
pgo.Properties.ShouldProfileModule = false
- pgoBenchmarks := ctx.AConfig().Getenv("ANDROID_PGO_INSTRUMENT")
+ pgoBenchmarks := ctx.Config().Getenv("ANDROID_PGO_INSTRUMENT")
pgoBenchmarksMap := make(map[string]bool)
for _, b := range strings.Split(pgoBenchmarks, ",") {
pgoBenchmarksMap[b] = true
@@ -215,7 +215,7 @@
return props.addProfileGatherFlags(ctx, flags)
}
- if !ctx.AConfig().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") {
+ if !ctx.Config().IsEnvTrue("ANDROID_PGO_NO_PROFILE_USE") {
return props.addProfileUseFlags(ctx, flags)
}
diff --git a/cc/relocation_packer.go b/cc/relocation_packer.go
index 614f15c..5006623 100644
--- a/cc/relocation_packer.go
+++ b/cc/relocation_packer.go
@@ -53,7 +53,7 @@
if ctx.Target().Os != android.Android {
enabled = false
}
- if ctx.AConfig().Getenv("DISABLE_RELOCATION_PACKER") == "true" {
+ if ctx.Config().Getenv("DISABLE_RELOCATION_PACKER") == "true" {
enabled = false
}
if ctx.useSdk() {
@@ -68,7 +68,7 @@
}
func (p *relocationPacker) needsPacking(ctx ModuleContext) bool {
- if ctx.AConfig().EmbeddedInMake() {
+ if ctx.Config().EmbeddedInMake() {
return false
}
return p.Properties.PackingRelocations
diff --git a/cc/sanitize.go b/cc/sanitize.go
index bf58d0f..1afec26 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -151,12 +151,12 @@
if ctx.clang() {
if ctx.Host() {
- globalSanitizers = ctx.AConfig().SanitizeHost()
+ globalSanitizers = ctx.Config().SanitizeHost()
} else {
- arches := ctx.AConfig().SanitizeDeviceArch()
+ arches := ctx.Config().SanitizeDeviceArch()
if len(arches) == 0 || inList(ctx.Arch().ArchType.Name, arches) {
- globalSanitizers = ctx.AConfig().SanitizeDevice()
- globalSanitizersDiag = ctx.AConfig().SanitizeDeviceDiag()
+ globalSanitizers = ctx.Config().SanitizeDevice()
+ globalSanitizersDiag = ctx.Config().SanitizeDeviceDiag()
}
}
}
@@ -194,13 +194,13 @@
}
if found, globalSanitizers = removeFromList("cfi", globalSanitizers); found && s.Cfi == nil {
- if !ctx.AConfig().CFIDisabledForPath(ctx.ModuleDir()) {
+ if !ctx.Config().CFIDisabledForPath(ctx.ModuleDir()) {
s.Cfi = boolPtr(true)
}
}
if found, globalSanitizers = removeFromList("integer_overflow", globalSanitizers); found && s.Integer_overflow == nil {
- if !ctx.AConfig().IntegerOverflowDisabledForPath(ctx.ModuleDir()) {
+ if !ctx.Config().IntegerOverflowDisabledForPath(ctx.ModuleDir()) {
s.Integer_overflow = boolPtr(true)
}
}
@@ -225,15 +225,15 @@
}
// Enable CFI for all components in the include paths
- if s.Cfi == nil && ctx.AConfig().CFIEnabledForPath(ctx.ModuleDir()) {
+ if s.Cfi == nil && ctx.Config().CFIEnabledForPath(ctx.ModuleDir()) {
s.Cfi = boolPtr(true)
- if inList("cfi", ctx.AConfig().SanitizeDeviceDiag()) {
+ if inList("cfi", ctx.Config().SanitizeDeviceDiag()) {
s.Diag.Cfi = boolPtr(true)
}
}
// CFI needs gold linker, and mips toolchain does not have one.
- if !ctx.AConfig().EnableCFI() || ctx.Arch().ArchType == android.Mips || ctx.Arch().ArchType == android.Mips64 {
+ if !ctx.Config().EnableCFI() || ctx.Arch().ArchType == android.Mips || ctx.Arch().ArchType == android.Mips64 {
s.Cfi = nil
s.Diag.Cfi = nil
}
@@ -611,7 +611,7 @@
modules[1].(*Module).Properties.HideFromMake = true
}
} else {
- cfiStaticLibs := cfiStaticLibs(mctx.AConfig())
+ cfiStaticLibs := cfiStaticLibs(mctx.Config())
cfiStaticLibsMutex.Lock()
*cfiStaticLibs = append(*cfiStaticLibs, c.Name())
diff --git a/cc/strip.go b/cc/strip.go
index 0bb29c1..a7c2d4e 100644
--- a/cc/strip.go
+++ b/cc/strip.go
@@ -30,7 +30,7 @@
}
func (stripper *stripper) needsStrip(ctx ModuleContext) bool {
- return !ctx.AConfig().EmbeddedInMake() && !Bool(stripper.StripProperties.Strip.None)
+ return !ctx.Config().EmbeddedInMake() && !Bool(stripper.StripProperties.Strip.None)
}
func (stripper *stripper) strip(ctx ModuleContext, in, out android.ModuleOutPath,
diff --git a/cc/tidy.go b/cc/tidy.go
index c31f5ae..6d7c957 100644
--- a/cc/tidy.go
+++ b/cc/tidy.go
@@ -58,7 +58,7 @@
}
// If not explicitly set, check the global tidy flag
- if tidy.Properties.Tidy == nil && !ctx.AConfig().ClangTidy() {
+ if tidy.Properties.Tidy == nil && !ctx.Config().ClangTidy() {
return flags
}
@@ -82,7 +82,7 @@
flags.TidyFlags = append(flags.TidyFlags, "-extra-arg-before=-D__clang_analyzer__")
tidyChecks := "-checks="
- if checks := ctx.AConfig().TidyChecks(); len(checks) > 0 {
+ if checks := ctx.Config().TidyChecks(); len(checks) > 0 {
tidyChecks += checks
} else {
tidyChecks += config.TidyChecksForDir(ctx.ModuleDir())