summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2023-04-19 13:36:08 -0700
committer Cole Faust <colefaust@google.com> 2023-04-22 01:18:03 +0000
commit2322aa5a791a9d25abfc56954ffa677c9c580455 (patch)
treebd7ce21d4e4f2e08860c398bf41a32eb6505ee0d
parentb80a870c0da49b4e164344b6254ddddb20d99fbc (diff)
Remove art defaults modules types
libart_cc_defaults and libart_static_cc_defaults can be simply removed, because they only have effects if their target use the `codegen` property, which they don't. art_debug_defaults can be replaced with a soong config variable-based module type. The other art module types will probably be kept and converted to bazel macros, but the defaults ones are tricker because we run the defaults mutator before bp2build is run. Bp2build can convert the art module types to bazel, but it sees the cc modules that the art modules make after the art modules have affected their properties. So they essentially "bake in" the art module changes into the generated BUILD file. This causes the generated BUILD files to be different depending on which product was lunched. We don't want those differences because it means we can't check in the generated BUILD files. Bug: 247785938 Test: Verified ninja files don't change before/after this cl. (they actually do, but only in comments and the module types that are passed to the licensing generator) Also tested a build with ART_DEBUG_OPT_FLAG=-O0 Change-Id: I7a28eb6455f05b3b846586270b32c6b8e1be200c
-rw-r--r--build/Android.bp9
-rw-r--r--build/SoongConfig.bp8
-rw-r--r--build/art.go48
-rw-r--r--runtime/Android.bp6
4 files changed, 20 insertions, 51 deletions
diff --git a/build/Android.bp b/build/Android.bp
index 77f7313fc4..4569b5523f 100644
--- a/build/Android.bp
+++ b/build/Android.bp
@@ -74,6 +74,7 @@ art_clang_tidy_disabled = [
soong_config_module_type_import {
from: "art/build/SoongConfig.bp",
module_types: [
+ "art_debug_defaults",
"art_module_art_global_defaults",
"art_module_cc_defaults",
"art_module_java_defaults",
@@ -317,6 +318,14 @@ art_debug_defaults {
cflags: ["-Wno-frame-larger-than="],
},
},
+ soong_config_variables: {
+ art_debug_opt_flag: {
+ cflags: ["%s"],
+ conditions_default: {
+ cflags: ["-O2"],
+ },
+ },
+ },
}
// A version of conscrypt only for enabling the "-hostdex" version to test ART on host.
diff --git a/build/SoongConfig.bp b/build/SoongConfig.bp
index a37721dedf..0a7e154a57 100644
--- a/build/SoongConfig.bp
+++ b/build/SoongConfig.bp
@@ -93,3 +93,11 @@ soong_config_module_type {
bool_variables: ["source_build"],
properties: ["enabled"],
}
+
+soong_config_module_type {
+ name: "art_debug_defaults",
+ module_type: "cc_defaults",
+ config_namespace: "art_module",
+ value_variables: ["art_debug_opt_flag"],
+ properties: ["cflags"],
+}
diff --git a/build/art.go b/build/art.go
index dd2106ea88..0e5c055d26 100644
--- a/build/art.go
+++ b/build/art.go
@@ -121,15 +121,6 @@ func globalFlags(ctx android.LoadHookContext) ([]string, []string) {
return cflags, asflags
}
-func debugFlags(ctx android.LoadHookContext) []string {
- var cflags []string
-
- opt := ctx.Config().GetenvWithDefault("ART_DEBUG_OPT_FLAG", "-O2")
- cflags = append(cflags, opt)
-
- return cflags
-}
-
func deviceFlags(ctx android.LoadHookContext) []string {
var cflags []string
deviceFrameSizeLimit := 1736
@@ -236,16 +227,6 @@ func addImplicitFlags(ctx android.LoadHookContext) {
ctx.AppendProperties(p)
}
-func debugDefaults(ctx android.LoadHookContext) {
- type props struct {
- Cflags []string
- }
-
- p := &props{}
- p.Cflags = debugFlags(ctx)
- ctx.AppendProperties(p)
-}
-
func customLinker(ctx android.LoadHookContext) {
linker := ctx.Config().Getenv("CUSTOM_TARGET_LINKER")
type props struct {
@@ -348,10 +329,7 @@ func init() {
"art_cc_test",
"art_cc_test_library",
"art_cc_defaults",
- "libart_cc_defaults",
- "libart_static_cc_defaults",
"art_global_defaults",
- "art_debug_defaults",
"art_apex_test_host",
}
android.AddNeverAllowRules(
@@ -365,10 +343,7 @@ func init() {
android.RegisterModuleType("art_cc_test", artTest)
android.RegisterModuleType("art_cc_test_library", artTestLibrary)
android.RegisterModuleType("art_cc_defaults", artDefaultsFactory)
- android.RegisterModuleType("libart_cc_defaults", libartDefaultsFactory)
- android.RegisterModuleType("libart_static_cc_defaults", libartStaticDefaultsFactory)
android.RegisterModuleType("art_global_defaults", artGlobalDefaultsFactory)
- android.RegisterModuleType("art_debug_defaults", artDebugDefaultsFactory)
// TODO: This makes the module disable itself for host if HOST_PREFER_32_BIT is
// set. We need this because the multilib types of binaries listed in the apex
@@ -409,13 +384,6 @@ func artGlobalDefaultsFactory() android.Module {
return module
}
-func artDebugDefaultsFactory() android.Module {
- module := artDefaultsFactory()
- android.AddLoadHook(module, debugDefaults)
-
- return module
-}
-
func artDefaultsFactory() android.Module {
c := &codegenProperties{}
module := cc.DefaultsFactory(c)
@@ -424,22 +392,6 @@ func artDefaultsFactory() android.Module {
return module
}
-func libartDefaultsFactory() android.Module {
- c := &codegenProperties{}
- module := cc.DefaultsFactory(c)
- android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c, staticAndSharedLibrary) })
-
- return module
-}
-
-func libartStaticDefaultsFactory() android.Module {
- c := &codegenProperties{}
- module := cc.DefaultsFactory(c)
- android.AddLoadHook(module, func(ctx android.LoadHookContext) { codegen(ctx, c, staticLibrary) })
-
- return module
-}
-
func artLibrary() android.Module {
module := cc.LibraryFactory()
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 1c4b8714e1..f02f530f75 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -34,7 +34,7 @@ JIT_DEBUG_REGISTER_CODE_LDFLAGS = [
// These are defaults for native shared libaries that are expected to be
// in stack traces often.
-libart_cc_defaults {
+cc_defaults {
name: "libart_nativeunwind_defaults",
target: {
host: {
@@ -109,7 +109,7 @@ cc_library_headers {
],
}
-libart_cc_defaults {
+cc_defaults {
name: "libart_defaults",
defaults: ["art_defaults"],
host_supported: true,
@@ -535,7 +535,7 @@ libart_cc_defaults {
],
}
-libart_static_cc_defaults {
+cc_defaults {
name: "libart_static_base_defaults",
whole_static_libs: [
"libartpalette",