Convert libprotobuf to Bazel
Since this is a one-off just for building libprotobuf that will be removed when we handle cargo output more generically (b/297364081), I didn't write a unit test for this CL. Test: b build //external/rust/crates/protobuf:libprotobuf Bug: 295925256 Change-Id: I00cf44d54be27a09c184a96c13b250a2e54e2d10
This commit is contained in:
@@ -16,6 +16,36 @@ func registerRustLibraryModuleTypes(ctx android.RegistrationContext) {
|
||||
ctx.RegisterModuleType("rust_library_host", rust.RustLibraryHostFactory)
|
||||
}
|
||||
|
||||
func TestLibProtobuf(t *testing.T) {
|
||||
runRustLibraryTestCase(t, Bp2buildTestCase{
|
||||
Dir: "external/rust/crates/foo",
|
||||
Blueprint: "",
|
||||
Filesystem: map[string]string{
|
||||
"external/rust/crates/foo/src/lib.rs": "",
|
||||
"external/rust/crates/foo/Android.bp": `
|
||||
rust_library_host {
|
||||
name: "libprotobuf",
|
||||
crate_name: "protobuf",
|
||||
srcs: ["src/lib.rs"],
|
||||
bazel_module: { bp2build_available: true },
|
||||
}
|
||||
`,
|
||||
},
|
||||
ExpectedBazelTargets: []string{
|
||||
// TODO(b/290790800): Remove the restriction when rust toolchain for android is implemented
|
||||
makeBazelTargetHostOrDevice("rust_library", "libprotobuf", AttrNameToString{
|
||||
"crate_name": `"protobuf"`,
|
||||
"srcs": `["src/lib.rs"]`,
|
||||
"deps": `[":libprotobuf_build_script"]`,
|
||||
}, android.HostSupported),
|
||||
makeBazelTargetHostOrDevice("cargo_build_script", "libprotobuf_build_script", AttrNameToString{
|
||||
"srcs": `["build.rs"]`,
|
||||
}, android.HostSupported),
|
||||
},
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func TestRustLibrary(t *testing.T) {
|
||||
expectedAttrs := AttrNameToString{
|
||||
"crate_name": `"foo"`,
|
||||
|
Reference in New Issue
Block a user