apex bp2build: refactor module names to be more meaningful.
Numbered module names weren't obvious.
Test: presubmits
Change-Id: Iee921e2965d1664ed1bccd934ab80f913eff6356
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go
index 233fce4..4fd6e43 100644
--- a/bp2build/apex_conversion_test.go
+++ b/bp2build/apex_conversion_test.go
@@ -277,23 +277,23 @@
ExpectedBazelTargets: []string{
MakeBazelTarget("apex", "com.android.apogee", AttrNameToString{
"native_shared_libs_32": `[
- ":native_shared_lib_1",
- ":native_shared_lib_3",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib32",
] + select({
- "//build/bazel/platforms/arch:arm": [":native_shared_lib_2"],
- "//build/bazel/platforms/arch:x86": [":native_shared_lib_2"],
+ "//build/bazel/platforms/arch:arm": [":native_shared_lib_for_first"],
+ "//build/bazel/platforms/arch:x86": [":native_shared_lib_for_first"],
"//conditions:default": [],
})`,
"native_shared_libs_64": `select({
"//build/bazel/platforms/arch:arm64": [
- ":native_shared_lib_1",
- ":native_shared_lib_4",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib64",
+ ":native_shared_lib_for_first",
],
"//build/bazel/platforms/arch:x86_64": [
- ":native_shared_lib_1",
- ":native_shared_lib_4",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib64",
+ ":native_shared_lib_for_first",
],
"//conditions:default": [],
})`,
@@ -322,27 +322,27 @@
MakeBazelTarget("apex", "com.android.apogee", AttrNameToString{
"native_shared_libs_32": `select({
"//build/bazel/platforms/arch:arm": [
- ":native_shared_lib_1",
- ":native_shared_lib_3",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib32",
+ ":native_shared_lib_for_first",
],
"//build/bazel/platforms/arch:x86": [
- ":native_shared_lib_1",
- ":native_shared_lib_3",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib32",
+ ":native_shared_lib_for_first",
],
"//conditions:default": [],
})`,
"native_shared_libs_64": `select({
"//build/bazel/platforms/arch:arm64": [
- ":native_shared_lib_1",
- ":native_shared_lib_4",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib64",
+ ":native_shared_lib_for_first",
],
"//build/bazel/platforms/arch:x86_64": [
- ":native_shared_lib_1",
- ":native_shared_lib_4",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib64",
+ ":native_shared_lib_for_first",
],
"//conditions:default": [],
})`,
@@ -370,11 +370,11 @@
ExpectedBazelTargets: []string{
MakeBazelTarget("apex", "com.android.apogee", AttrNameToString{
"native_shared_libs_32": `[
- ":native_shared_lib_1",
- ":native_shared_lib_3",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib32",
] + select({
- "//build/bazel/platforms/arch:arm": [":native_shared_lib_2"],
- "//build/bazel/platforms/arch:x86": [":native_shared_lib_2"],
+ "//build/bazel/platforms/arch:arm": [":native_shared_lib_for_first"],
+ "//build/bazel/platforms/arch:x86": [":native_shared_lib_for_first"],
"//conditions:default": [],
})`,
"file_contexts": `"//system/sepolicy/apex:com.android.apogee-file_contexts"`,
@@ -402,14 +402,14 @@
MakeBazelTarget("apex", "com.android.apogee", AttrNameToString{
"native_shared_libs_64": `select({
"//build/bazel/platforms/arch:arm64": [
- ":native_shared_lib_1",
- ":native_shared_lib_4",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib64",
+ ":native_shared_lib_for_first",
],
"//build/bazel/platforms/arch:x86_64": [
- ":native_shared_lib_1",
- ":native_shared_lib_4",
- ":native_shared_lib_2",
+ ":native_shared_lib_for_both",
+ ":native_shared_lib_for_lib64",
+ ":native_shared_lib_for_first",
],
"//conditions:default": [],
})`,
@@ -419,6 +419,56 @@
}})
}
+func createMultilibBlueprint(compile_multilib string) string {
+ return `
+cc_library {
+ name: "native_shared_lib_for_both",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library {
+ name: "native_shared_lib_for_first",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library {
+ name: "native_shared_lib_for_lib32",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_library {
+ name: "native_shared_lib_for_lib64",
+ bazel_module: { bp2build_available: false },
+}
+
+apex {
+ name: "com.android.apogee",
+ compile_multilib: "` + compile_multilib + `",
+ multilib: {
+ both: {
+ native_shared_libs: [
+ "native_shared_lib_for_both",
+ ],
+ },
+ first: {
+ native_shared_libs: [
+ "native_shared_lib_for_first",
+ ],
+ },
+ lib32: {
+ native_shared_libs: [
+ "native_shared_lib_for_lib32",
+ ],
+ },
+ lib64: {
+ native_shared_libs: [
+ "native_shared_lib_for_lib64",
+ ],
+ },
+ },
+}`
+}
+
func TestApexBundleDefaultPropertyValues(t *testing.T) {
runApexTestCase(t, Bp2buildTestCase{
Description: "apex - default property values",
@@ -474,56 +524,6 @@
}})
}
-func createMultilibBlueprint(compile_multilib string) string {
- return `
-cc_library {
- name: "native_shared_lib_1",
- bazel_module: { bp2build_available: false },
-}
-
-cc_library {
- name: "native_shared_lib_2",
- bazel_module: { bp2build_available: false },
-}
-
-cc_library {
- name: "native_shared_lib_3",
- bazel_module: { bp2build_available: false },
-}
-
-cc_library {
- name: "native_shared_lib_4",
- bazel_module: { bp2build_available: false },
-}
-
-apex {
- name: "com.android.apogee",
- compile_multilib: "` + compile_multilib + `",
- multilib: {
- both: {
- native_shared_libs: [
- "native_shared_lib_1",
- ],
- },
- first: {
- native_shared_libs: [
- "native_shared_lib_2",
- ],
- },
- lib32: {
- native_shared_libs: [
- "native_shared_lib_3",
- ],
- },
- lib64: {
- native_shared_libs: [
- "native_shared_lib_4",
- ],
- },
- },
-}`
-}
-
func TestBp2BuildOverrideApex(t *testing.T) {
runOverrideApexTestCase(t, Bp2buildTestCase{
Description: "override_apex",