Bp2build support for runtime_libs
Bug: 213201180
Test: Updated the minimal apex in the build/bazel cl to include runtime_libs so the apex diff test will test it
Change-Id: I10add1895cfa122a370d24196a33ec2dcfafccfc
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index 95869dd..1f69b5a 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -543,3 +543,41 @@
},
})
}
+
+func TestCcBinaryRuntimeLibs(t *testing.T) {
+ runCcBinaryTests(t, ccBinaryBp2buildTestCase{
+ description: "cc_binary with runtime libs",
+ blueprint: `
+cc_library {
+ name: "bar",
+ srcs: ["b.cc"],
+}
+
+{rule_name} {
+ name: "foo",
+ srcs: ["a.cc"],
+ runtime_libs: ["bar"],
+}
+`,
+ targets: []testBazelTarget{
+ {"cc_library_static", "bar_bp2build_cc_library_static", AttrNameToString{
+ "local_includes": `["."]`,
+ "srcs": `["b.cc"]`,
+ "target_compatible_with": `["//build/bazel/platforms/os:android"]`,
+ },
+ },
+ {"cc_library_shared", "bar", AttrNameToString{
+ "local_includes": `["."]`,
+ "srcs": `["b.cc"]`,
+ "target_compatible_with": `["//build/bazel/platforms/os:android"]`,
+ },
+ },
+ {"cc_binary", "foo", AttrNameToString{
+ "local_includes": `["."]`,
+ "srcs": `["a.cc"]`,
+ "runtime_deps": `[":bar"]`,
+ },
+ },
+ },
+ })
+}
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 6c56d41..f6d5067 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -2514,3 +2514,29 @@
})...),
})
}
+
+func TestCCLibraryRuntimeDeps(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Blueprint: `cc_library_shared {
+ name: "bar",
+}
+
+cc_library {
+ name: "foo",
+ runtime_libs: ["foo"],
+}`,
+ ExpectedBazelTargets: []string{
+ makeBazelTarget("cc_library_shared", "bar", AttrNameToString{
+ "local_includes": `["."]`,
+ }),
+ makeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
+ "runtime_deps": `[":foo"]`,
+ "local_includes": `["."]`,
+ }),
+ makeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "runtime_deps": `[":foo"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 6a47862..de57e5a 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -624,3 +624,25 @@
},
})
}
+
+func TestCCLibrarySharedRuntimeDeps(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Blueprint: `cc_library_shared {
+ name: "bar",
+}
+
+cc_library_shared {
+ name: "foo",
+ runtime_libs: ["foo"],
+}`,
+ ExpectedBazelTargets: []string{
+ makeBazelTarget("cc_library_shared", "bar", AttrNameToString{
+ "local_includes": `["."]`,
+ }),
+ makeBazelTarget("cc_library_shared", "foo", AttrNameToString{
+ "runtime_deps": `[":foo"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index ddb7bf9..1c160ec 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -15,12 +15,12 @@
package bp2build
import (
+ "fmt"
+ "testing"
+
"android/soong/android"
"android/soong/cc"
"android/soong/genrule"
- "fmt"
-
- "testing"
)
const (
@@ -1559,3 +1559,25 @@
})
}
}
+
+func TestCCLibraryStaticRuntimeDeps(t *testing.T) {
+ runCcLibrarySharedTestCase(t, Bp2buildTestCase{
+ Blueprint: `cc_library_shared {
+ name: "bar",
+}
+
+cc_library_static {
+ name: "foo",
+ runtime_libs: ["foo"],
+}`,
+ ExpectedBazelTargets: []string{
+ makeBazelTarget("cc_library_shared", "bar", AttrNameToString{
+ "local_includes": `["."]`,
+ }),
+ makeBazelTarget("cc_library_static", "foo", AttrNameToString{
+ "runtime_deps": `[":foo"]`,
+ "local_includes": `["."]`,
+ }),
+ },
+ })
+}