From 7a1558e973539b4d61b6bc57a75a5d9d65f173b3 Mon Sep 17 00:00:00 2001 From: Paul Johnston Date: Thu, 22 Dec 2022 09:41:15 -0700 Subject: [PATCH] Update M option syntax for ts-proto 1.136.1 --- .../stephenh/ts-proto/protoc-gen-ts-proto.go | 6 +++--- .../ts-proto/protoc-gen-ts-proto_test.go | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto.go b/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto.go index b3baf4958..fbaa852b0 100644 --- a/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto.go +++ b/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto.go @@ -35,10 +35,10 @@ func (p *ProtocGenTsProto) Configure(ctx *protoc.PluginContext) *protoc.PluginCo var emitImportedFiles bool var options []string for _, option := range ctx.PluginConfig.GetOptions() { - // options may be configured to include many "M=" options, but only + // options may be configured to include many "M" options, but only // include the relevant ones to avoid BUILD file clutter. - if strings.HasPrefix(option, "M=") { - keyVal := option[len("M="):] + if strings.HasPrefix(option, "M") { + keyVal := option[len("M"):] parts := strings.SplitN(keyVal, "=", 2) filename := parts[0] if !imports[filename] { diff --git a/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto_test.go b/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto_test.go index b1ce5d964..5a73ee574 100644 --- a/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto_test.go +++ b/pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto_test.go @@ -34,7 +34,7 @@ func TestProtocGenTsProtoPlugin(t *testing.T) { ), SkipIntegration: true, }, - "includes only relevant M= options": { + "includes only relevant M options": { Input: ` syntax = "proto3"; @@ -47,19 +47,19 @@ message M {} `, Directives: plugintest.WithDirectives( "proto_plugin", "protoc-gen-ts-proto implementation stephenh:ts-proto:protoc-gen-ts-proto", - "proto_plugin", "protoc-gen-ts-proto option M=google/protobuf/empty.proto=./external/protobufapis/google/protobuf/empty", - "proto_plugin", "protoc-gen-ts-proto option M=google/protobuf/timestamp.proto=./external/protobufapis/google/protobuf/timestamp", - "proto_plugin", "protoc-gen-ts-proto option M=google/protobuf/duration.proto=./external/protobufapis/google/protobuf/duration", - "proto_plugin", "protoc-gen-ts-proto option M=google/type/timeofday.proto=./external/googleapis/google/type/timeofday", - "proto_plugin", "protoc-gen-ts-proto option M=google/type/datetime.proto=./external/googleapis/google/type/datetime", + "proto_plugin", "protoc-gen-ts-proto option Mgoogle/protobuf/empty.proto=./external/protobufapis/google/protobuf/empty", + "proto_plugin", "protoc-gen-ts-proto option Mgoogle/protobuf/timestamp.proto=./external/protobufapis/google/protobuf/timestamp", + "proto_plugin", "protoc-gen-ts-proto option Mgoogle/protobuf/duration.proto=./external/protobufapis/google/protobuf/duration", + "proto_plugin", "protoc-gen-ts-proto option Mgoogle/type/timeofday.proto=./external/googleapis/google/type/timeofday", + "proto_plugin", "protoc-gen-ts-proto option Mgoogle/type/datetime.proto=./external/googleapis/google/type/datetime", ), PluginName: "protoc-gen-ts-proto", Configuration: plugintest.WithConfiguration( plugintest.WithLabel(t, "@build_stack_rules_proto//plugin/stephenh/ts-proto:protoc-gen-ts-proto"), plugintest.WithOutputs("test.ts"), plugintest.WithOptions( - "M=google/protobuf/duration.proto=./external/protobufapis/google/protobuf/duration", - "M=google/type/datetime.proto=./external/googleapis/google/type/datetime", + "Mgoogle/protobuf/duration.proto=./external/protobufapis/google/protobuf/duration", + "Mgoogle/type/datetime.proto=./external/googleapis/google/type/datetime", ), ), SkipIntegration: true,