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
This commit is contained in:
@@ -182,7 +182,7 @@ func (binary *binaryDecorator) linkerInit(ctx BaseModuleContext) {
|
||||
|
||||
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 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags
|
||||
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")
|
||||
|
6
cc/cc.go
6
cc/cc.go
@@ -945,7 +945,7 @@ func (c *Module) clang(ctx BaseModuleContext) bool {
|
||||
clang = true
|
||||
}
|
||||
|
||||
if ctx.Device() && ctx.AConfig().DeviceUsesClang() {
|
||||
if ctx.Device() && ctx.Config().DeviceUsesClang() {
|
||||
clang = true
|
||||
}
|
||||
}
|
||||
@@ -1441,10 +1441,10 @@ func vendorMutator(mctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
|
||||
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
|
||||
|
@@ -218,7 +218,7 @@ func warningsAreAllowed(subdir string) bool {
|
||||
}
|
||||
|
||||
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 @@ func (compiler *baseCompiler) compilerFlags(ctx ModuleContext, flags Flags, deps
|
||||
fmt.Sprintf("${config.%sGlobalCflags}", hod))
|
||||
}
|
||||
|
||||
if Bool(ctx.AConfig().ProductVariables.Brillo) {
|
||||
if Bool(ctx.Config().ProductVariables.Brillo) {
|
||||
flags.GlobalFlags = append(flags.GlobalFlags, "-D__BRILLO__")
|
||||
}
|
||||
|
||||
|
@@ -117,7 +117,7 @@ func normalizeNdkApiLevel(ctx android.BaseContext, apiLevel string,
|
||||
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 shouldUseVersionScript(stub *stubDecorator) (bool, error) {
|
||||
}
|
||||
|
||||
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 @@ func generateStubApiVariants(mctx android.BottomUpMutatorContext, c *stubDecorat
|
||||
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...)
|
||||
|
@@ -181,7 +181,7 @@ func (pgo *pgo) begin(ctx BaseModuleContext) {
|
||||
//
|
||||
// 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 @@ func (pgo *pgo) flags(ctx ModuleContext, flags Flags) Flags {
|
||||
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)
|
||||
}
|
||||
|
||||
|
@@ -53,7 +53,7 @@ func (p *relocationPacker) packingInit(ctx BaseModuleContext) {
|
||||
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) packingInit(ctx BaseModuleContext) {
|
||||
}
|
||||
|
||||
func (p *relocationPacker) needsPacking(ctx ModuleContext) bool {
|
||||
if ctx.AConfig().EmbeddedInMake() {
|
||||
if ctx.Config().EmbeddedInMake() {
|
||||
return false
|
||||
}
|
||||
return p.Properties.PackingRelocations
|
||||
|
@@ -151,12 +151,12 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
||||
|
||||
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 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
||||
}
|
||||
|
||||
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 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
||||
}
|
||||
|
||||
// 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 @@ func sanitizerMutator(t sanitizerType) func(android.BottomUpMutatorContext) {
|
||||
modules[1].(*Module).Properties.HideFromMake = true
|
||||
}
|
||||
} else {
|
||||
cfiStaticLibs := cfiStaticLibs(mctx.AConfig())
|
||||
cfiStaticLibs := cfiStaticLibs(mctx.Config())
|
||||
|
||||
cfiStaticLibsMutex.Lock()
|
||||
*cfiStaticLibs = append(*cfiStaticLibs, c.Name())
|
||||
|
@@ -30,7 +30,7 @@ type stripper struct {
|
||||
}
|
||||
|
||||
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,
|
||||
|
@@ -58,7 +58,7 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
|
||||
}
|
||||
|
||||
// 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 @@ func (tidy *tidyFeature) flags(ctx ModuleContext, flags Flags) Flags {
|
||||
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())
|
||||
|
Reference in New Issue
Block a user