Merge "rust_proto: use protobuf crate version 2.x" am: 10361f5177

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2501838

Change-Id: I58be6dec80a125f8b4ff3df669255953aa13128f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-03-31 11:02:38 +00:00
committed by Automerger Merge Worker
3 changed files with 6 additions and 6 deletions

View File

@@ -73,7 +73,7 @@ func (proto *protobufDecorator) GenerateSource(ctx ModuleContext, deps PathDeps)
outDir := android.PathForModuleOut(ctx)
protoFiles := android.PathsForModuleSrc(ctx, proto.Properties.Protos)
grpcFiles := android.PathsForModuleSrc(ctx, proto.Properties.Grpc_protos)
protoPluginPath := ctx.Config().HostToolPath(ctx, "protoc-gen-rust")
protoPluginPath := ctx.Config().HostToolPath(ctx, "protoc-gen-rust-deprecated")
commonProtoFlags = append(commonProtoFlags, defaultProtobufFlags...)
commonProtoFlags = append(commonProtoFlags, proto.Properties.Proto_flags...)
@@ -206,7 +206,7 @@ func (proto *protobufDecorator) SourceProviderProps() []interface{} {
func (proto *protobufDecorator) SourceProviderDeps(ctx DepsContext, deps Deps) Deps {
deps = proto.BaseSourceProvider.SourceProviderDeps(ctx, deps)
deps.Rustlibs = append(deps.Rustlibs, "libprotobuf")
deps.Rustlibs = append(deps.Rustlibs, "libprotobuf_deprecated")
deps.HeaderLibs = append(deps.SharedLibs, proto.Properties.Header_libs...)
if len(proto.Properties.Grpc_protos) > 0 {

View File

@@ -42,14 +42,14 @@ func TestRustProtobuf(t *testing.T) {
`)
// Check that libprotobuf is added as a dependency.
librust_proto := ctx.ModuleForTests("librust_proto", "android_arm64_armv8-a_dylib").Module().(*Module)
if !android.InList("libprotobuf", librust_proto.Properties.AndroidMkDylibs) {
t.Errorf("libprotobuf dependency missing for rust_protobuf (dependency missing from AndroidMkDylibs)")
if !android.InList("libprotobuf_deprecated", librust_proto.Properties.AndroidMkDylibs) {
t.Errorf("libprotobuf_deprecated dependency missing for rust_protobuf (dependency missing from AndroidMkDylibs)")
}
// Make sure the correct plugin is being used.
librust_proto_out := ctx.ModuleForTests("librust_proto", "android_arm64_armv8-a_source").Output("buf.rs")
cmd := librust_proto_out.RuleParams.Command
if w := "protoc-gen-rust"; !strings.Contains(cmd, w) {
if w := "protoc-gen-rust-deprecated"; !strings.Contains(cmd, w) {
t.Errorf("expected %q in %q", w, cmd)
}

View File

@@ -127,7 +127,7 @@ func GatherRequiredDepsForTest() string {
min_sdk_version: "29",
}
rust_library {
name: "libprotobuf",
name: "libprotobuf_deprecated",
crate_name: "protobuf",
srcs: ["foo.rs"],
host_supported: true,