Skip to content

Commit

Permalink
Merge branch 'stackb:master' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sacsar authored Jan 8, 2023
2 parents 16edc8f + 4ad9deb commit 4132c9e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto.go
Original file line number Diff line number Diff line change
Expand Up @@ -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] {
Expand Down
16 changes: 8 additions & 8 deletions pkg/plugin/stephenh/ts-proto/protoc-gen-ts-proto_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func TestProtocGenTsProtoPlugin(t *testing.T) {
),
SkipIntegration: true,
},
"includes only relevant M= options": {
"includes only relevant M options": {
Input: `
syntax = "proto3";
Expand All @@ -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,
Expand Down

0 comments on commit 4132c9e

Please sign in to comment.