Refactor some tests to not use bp2build_avail
Bug: 301312260
Test: presubmits
Change-Id: I67ca45f17d11e9b893fae5f6c6df1239ae4220b6
diff --git a/bp2build/apex_conversion_test.go b/bp2build/apex_conversion_test.go
index 2a58d01..60de28c 100644
--- a/bp2build/apex_conversion_test.go
+++ b/bp2build/apex_conversion_test.go
@@ -818,7 +818,7 @@
Description: "override_apex - manifest of base apex is empty, base apex and override_apex is in different Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
- StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"//a/b:com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@@ -828,7 +828,6 @@
"a/b/Android.bp": `
apex {
name: "com.android.apogee",
- bazel_module: { bp2build_available: false },
}
`,
},
@@ -852,7 +851,7 @@
Description: "override_apex - manifest of base apex is set, base apex and override_apex is in different Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
- StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"//a/b:com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@@ -863,7 +862,6 @@
apex {
name: "com.android.apogee",
manifest: "apogee_manifest.json",
- bazel_module: { bp2build_available: false },
}
`,
},
@@ -887,7 +885,7 @@
Description: "override_apex - manifest of base apex is empty, base apex and override_apex is in same Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
- StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@@ -898,7 +896,6 @@
Blueprint: `
apex {
name: "com.android.apogee",
- bazel_module: { bp2build_available: false },
}
override_apex {
@@ -920,7 +917,7 @@
Description: "override_apex - manifest of base apex is set, base apex and override_apex is in same Android.bp",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
- StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@@ -932,7 +929,6 @@
apex {
name: "com.android.apogee",
manifest: "apogee_manifest.json",
- bazel_module: { bp2build_available: false },
}
override_apex {
@@ -954,7 +950,7 @@
Description: "override_apex - override package name",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
- StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@@ -965,7 +961,6 @@
Blueprint: `
apex {
name: "com.android.apogee",
- bazel_module: { bp2build_available: false },
}
override_apex {
@@ -1109,7 +1104,7 @@
Description: "override_apex - logging_parent - no override",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
- StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@@ -1120,7 +1115,6 @@
Blueprint: `
apex {
name: "com.android.apogee",
- bazel_module: { bp2build_available: false },
logging_parent: "foo.bar.baz",
}
@@ -1144,7 +1138,7 @@
Description: "override_apex - logging_parent - override",
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
- StubbedBuildDefinitions: []string{"//system/sepolicy/apex:com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"com.android.apogee", "//system/sepolicy/apex:com.android.apogee-file_contexts"},
Filesystem: map[string]string{
"system/sepolicy/apex/Android.bp": `
filegroup {
@@ -1155,7 +1149,6 @@
Blueprint: `
apex {
name: "com.android.apogee",
- bazel_module: { bp2build_available: false },
logging_parent: "foo.bar.baz",
}
@@ -1398,7 +1391,7 @@
ModuleTypeUnderTest: "override_apex",
ModuleTypeUnderTestFactory: apex.OverrideApexFactory,
Filesystem: map[string]string{},
- StubbedBuildDefinitions: []string{"com.android.apogee.certificate", "com.android.apogee", "com.android.apogee-file_contexts"},
+ StubbedBuildDefinitions: []string{"com.android.apogee", "com.android.apogee.certificate", "com.android.apogee", "com.android.apogee-file_contexts"},
Blueprint: `
android_app_certificate {
name: "com.android.apogee.certificate",
@@ -1417,7 +1410,6 @@
manifest: "apogee_manifest.json",
file_contexts: ":com.android.apogee-file_contexts",
certificate: ":com.android.apogee.certificate",
- bazel_module: { bp2build_available: false },
}
override_apex {
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index ec603c2..2cbcfc1 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -1857,7 +1857,6 @@
Blueprint: soongCcLibraryPreamble + `
cc_library {
name: "libc_musl",
- bazel_module: { bp2build_available: false },
}
cc_library {
@@ -1912,10 +1911,10 @@
Description: "cc_library system_shared_lib empty for linux_musl variant",
ModuleTypeUnderTest: "cc_library",
ModuleTypeUnderTestFactory: cc.LibraryFactory,
+ StubbedBuildDefinitions: []string{"libc_musl"},
Blueprint: soongCcLibraryPreamble + `
cc_library {
name: "libc_musl",
- bazel_module: { bp2build_available: false },
}
cc_library {
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 6f600da..5153224 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -1595,6 +1595,7 @@
Description: "cc_library_shared stubs",
ModuleTypeUnderTest: "cc_library_shared",
ModuleTypeUnderTestFactory: cc.LibrarySharedFactory,
+ StubbedBuildDefinitions: []string{"libNoStubs", "libHasApexStubs", "libHasApexAndNdkStubs"},
Blueprint: soongCcLibrarySharedPreamble + `
cc_library_shared {
name: "libUsesSdk",
@@ -1607,22 +1608,21 @@
}
cc_library_shared {
name: "libNoStubs",
- bazel_module: { bp2build_available: false },
}
cc_library_shared {
name: "libHasApexStubs",
stubs: { symbol_file: "a.map.txt", versions: ["28", "29", "current"] },
- bazel_module: { bp2build_available: false },
apex_available: ["apex_a"],
}
cc_library_shared {
name: "libHasApexAndNdkStubs",
stubs: { symbol_file: "b.map.txt", versions: ["28", "29", "current"] },
- bazel_module: { bp2build_available: false },
apex_available: ["apex_b"],
}
ndk_library {
name: "libHasApexAndNdkStubs",
+ // TODO: b/301321658 - Stub this once existing-build-file handling can deal with
+ // modules that generate targets of a different name.
bazel_module: { bp2build_available: false },
}
`,
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index 0587aae..7b97b39 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -1398,11 +1398,11 @@
func TestStaticLibrary_SystemSharedLibsMuslEmpty(t *testing.T) {
runCcLibraryStaticTestCase(t, Bp2buildTestCase{
- Description: "cc_library_static system_shared_lib empty for musl variant",
+ Description: "cc_library_static system_shared_lib empty for musl variant",
+ StubbedBuildDefinitions: []string{"libc_musl"},
Blueprint: soongCcLibraryStaticPreamble + `
cc_library {
name: "libc_musl",
- bazel_module: { bp2build_available: false },
}
cc_library_static {
@@ -1425,11 +1425,11 @@
func TestStaticLibrary_SystemSharedLibsLinuxMuslEmpty(t *testing.T) {
runCcLibraryStaticTestCase(t, Bp2buildTestCase{
- Description: "cc_library_static system_shared_lib empty for linux_musl variant",
+ Description: "cc_library_static system_shared_lib empty for linux_musl variant",
+ StubbedBuildDefinitions: []string{"libc_musl"},
Blueprint: soongCcLibraryStaticPreamble + `
cc_library {
name: "libc_musl",
- bazel_module: { bp2build_available: false },
}
cc_library_static {
diff --git a/bp2build/java_plugin_conversion_test.go b/bp2build/java_plugin_conversion_test.go
index b284112..dcc17b5 100644
--- a/bp2build/java_plugin_conversion_test.go
+++ b/bp2build/java_plugin_conversion_test.go
@@ -86,13 +86,11 @@
java_library {
name: "java-lib-1",
srcs: ["b.java"],
- bazel_module: { bp2build_available: false },
}
java_library {
name: "java-lib-2",
srcs: ["c.java"],
- bazel_module: { bp2build_available: false },
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("java_plugin", "java-plug-1", AttrNameToString{
diff --git a/bp2build/java_proto_conversion_test.go b/bp2build/java_proto_conversion_test.go
index b254710..3d55eb2 100644
--- a/bp2build/java_proto_conversion_test.go
+++ b/bp2build/java_proto_conversion_test.go
@@ -140,7 +140,8 @@
func TestJavaLibsAndOnlyProtoSrcs(t *testing.T) {
runJavaProtoTestCase(t, Bp2buildTestCase{
- Description: "java_library that has only proto srcs",
+ Description: "java_library that has only proto srcs",
+ StubbedBuildDefinitions: []string{"java-lib"},
Blueprint: `java_library_static {
name: "java-protos",
srcs: ["a.proto"],
@@ -151,7 +152,6 @@
java_library_static {
name: "java-lib",
- bazel_module: { bp2build_available: false },
}
`,
ExpectedBazelTargets: []string{
diff --git a/bp2build/java_test_host_conversion_test.go b/bp2build/java_test_host_conversion_test.go
index f41345e..95c239d 100644
--- a/bp2build/java_test_host_conversion_test.go
+++ b/bp2build/java_test_host_conversion_test.go
@@ -32,8 +32,9 @@
func TestJavaTestHostGeneral(t *testing.T) {
runJavaTestHostTestCase(t, Bp2buildTestCase{
- Description: "java_test_host general",
- Filesystem: map[string]string{},
+ Description: "java_test_host general",
+ Filesystem: map[string]string{},
+ StubbedBuildDefinitions: []string{"lib_a", "lib_b"},
Blueprint: `
java_test_host {
name: "java_test_host-1",
@@ -47,12 +48,10 @@
java_library {
name: "lib_a",
- bazel_module: { bp2build_available: false },
}
java_library {
name: "static_libs_a",
- bazel_module: { bp2build_available: false },
}
`,
ExpectedBazelTargets: []string{