Merge "rust_proto: use protobuf crate version 2.x"
This commit is contained in:
@@ -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 {
|
||||
|
@@ -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)
|
||||
}
|
||||
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user