-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into pcj/bzlmod
- Loading branch information
Showing
12 changed files
with
362 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,179 @@ | ||
{ | ||
"__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL", | ||
"__INPUT_ARTIFACTS_HASH": 799888365, | ||
"__RESOLVED_ARTIFACTS_HASH": 669377701, | ||
"artifacts": { | ||
"com.google.protobuf:protobuf-java": { | ||
"shasums": { | ||
"jar": "6a9a2dff91dcf71f85be71ae971f6164b5a631dcd34bff08f0618535ca44ad02", | ||
"sources": "98118edf28c74f173b25d8fce03f86ff95d61009df0c66324333573ec842f5d3" | ||
}, | ||
"version": "3.19.6" | ||
}, | ||
"com.thesamet.scalapb.zio-grpc:zio-grpc-codegen_2.12": { | ||
"shasums": { | ||
"jar": "0a47494a502470e5a7e13a55a2a91b020ef3cef7642932ae0332a9d53fed2bd4", | ||
"sources": "a2ea65c99beb8375f16f79a57b8f69cf396245d228f43f72d8a3b8fedc494e95" | ||
}, | ||
"version": "0.6.0" | ||
}, | ||
"com.thesamet.scalapb:compilerplugin_2.12": { | ||
"shasums": { | ||
"jar": "7fae6c1e7301fba88cef19551027dee077208799130c8f8bbfe3e8addf0b5aa9", | ||
"sources": "1c0ae73755353a67f3bd5e50496243c1edabeadbdff895e56234e9e0d601b8af" | ||
}, | ||
"version": "0.11.13" | ||
}, | ||
"com.thesamet.scalapb:protoc-bridge_2.12": { | ||
"shasums": { | ||
"jar": "5bbecd8ede37b266740ea523d65ebec27cdfbded40850013667ea9ed23be76d1", | ||
"sources": "c2287667773b171051065ceb76adfbe9f6dc1f4e4fff03e0f0b288d659b7a47c" | ||
}, | ||
"version": "0.9.6" | ||
}, | ||
"com.thesamet.scalapb:protoc-gen_2.12": { | ||
"shasums": { | ||
"jar": "9483c434afe0bdb9e68da0a4a9b76f76a350ef4f6f397bda23f8fa6061153727", | ||
"sources": "da917be8e7ba6c8eccdb5b155c9c515fbf2ef9e295b30934c27e2cf6519ab8b5" | ||
}, | ||
"version": "0.9.6" | ||
}, | ||
"dev.dirs:directories": { | ||
"shasums": { | ||
"jar": "6d18fe25aa30b7e08b908cd21151d8f96e22965c640acd7751add9bbfe6137d4", | ||
"sources": "192050e3a2a0eba7f22745765aaaf567ce6d515fe6a992688b4e262e9f14947b" | ||
}, | ||
"version": "26" | ||
}, | ||
"org.scala-lang.modules:scala-collection-compat_2.12": { | ||
"shasums": { | ||
"jar": "873344f3788c84b6314afd20334b18a0821109a3635ecc71dac3598325e030ac", | ||
"sources": "70682c87d4b7c3fd21f1f7a2c3a09fce812bab6d5aad2fbc5a68f1aa3f48e0dd" | ||
}, | ||
"version": "2.9.0" | ||
}, | ||
"org.scala-lang:scala-library": { | ||
"shasums": { | ||
"jar": "e51e6636c003359e106bea4ad99def70e613c290190c8c84f10f9560dd5b00ae", | ||
"sources": "a34db9ab4b38c57f998e8f671b33762e2d6c3e39b8abf6fb8660a417447fa449" | ||
}, | ||
"version": "2.12.18" | ||
} | ||
}, | ||
"dependencies": { | ||
"com.thesamet.scalapb.zio-grpc:zio-grpc-codegen_2.12": [ | ||
"com.thesamet.scalapb:compilerplugin_2.12", | ||
"org.scala-lang:scala-library" | ||
], | ||
"com.thesamet.scalapb:compilerplugin_2.12": [ | ||
"com.google.protobuf:protobuf-java", | ||
"com.thesamet.scalapb:protoc-gen_2.12", | ||
"org.scala-lang.modules:scala-collection-compat_2.12", | ||
"org.scala-lang:scala-library" | ||
], | ||
"com.thesamet.scalapb:protoc-bridge_2.12": [ | ||
"dev.dirs:directories", | ||
"org.scala-lang:scala-library" | ||
], | ||
"com.thesamet.scalapb:protoc-gen_2.12": [ | ||
"com.thesamet.scalapb:protoc-bridge_2.12", | ||
"org.scala-lang:scala-library" | ||
], | ||
"org.scala-lang.modules:scala-collection-compat_2.12": [ | ||
"org.scala-lang:scala-library" | ||
] | ||
}, | ||
"packages": { | ||
"com.google.protobuf:protobuf-java": [ | ||
"com.google.protobuf", | ||
"com.google.protobuf.compiler" | ||
], | ||
"com.thesamet.scalapb.zio-grpc:zio-grpc-codegen_2.12": [ | ||
"scalapb.zio_grpc" | ||
], | ||
"com.thesamet.scalapb:compilerplugin_2.12": [ | ||
"scalapb", | ||
"scalapb.compiler", | ||
"scalapb.internal", | ||
"scalapb.options", | ||
"scalapb.options.compiler" | ||
], | ||
"com.thesamet.scalapb:protoc-bridge_2.12": [ | ||
"protocbridge", | ||
"protocbridge.codegen", | ||
"protocbridge.frontend" | ||
], | ||
"com.thesamet.scalapb:protoc-gen_2.12": [ | ||
"protocgen" | ||
], | ||
"dev.dirs:directories": [ | ||
"dev.dirs" | ||
], | ||
"org.scala-lang.modules:scala-collection-compat_2.12": [ | ||
"scala.annotation", | ||
"scala.collection.compat", | ||
"scala.collection.compat.immutable", | ||
"scala.jdk", | ||
"scala.jdk.javaapi", | ||
"scala.util", | ||
"scala.util.control.compat" | ||
], | ||
"org.scala-lang:scala-library": [ | ||
"scala", | ||
"scala.annotation", | ||
"scala.annotation.meta", | ||
"scala.annotation.unchecked", | ||
"scala.beans", | ||
"scala.collection", | ||
"scala.collection.concurrent", | ||
"scala.collection.convert", | ||
"scala.collection.generic", | ||
"scala.collection.immutable", | ||
"scala.collection.mutable", | ||
"scala.collection.parallel", | ||
"scala.collection.parallel.immutable", | ||
"scala.collection.parallel.mutable", | ||
"scala.collection.script", | ||
"scala.compat", | ||
"scala.concurrent", | ||
"scala.concurrent.duration", | ||
"scala.concurrent.forkjoin", | ||
"scala.concurrent.impl", | ||
"scala.io", | ||
"scala.math", | ||
"scala.ref", | ||
"scala.reflect", | ||
"scala.reflect.macros.internal", | ||
"scala.runtime", | ||
"scala.runtime.java8", | ||
"scala.sys", | ||
"scala.sys.process", | ||
"scala.text", | ||
"scala.util", | ||
"scala.util.control", | ||
"scala.util.hashing", | ||
"scala.util.matching" | ||
] | ||
}, | ||
"repositories": { | ||
"https://repo1.maven.org/maven2/": [ | ||
"com.google.protobuf:protobuf-java", | ||
"com.google.protobuf:protobuf-java:jar:sources", | ||
"com.thesamet.scalapb.zio-grpc:zio-grpc-codegen_2.12", | ||
"com.thesamet.scalapb.zio-grpc:zio-grpc-codegen_2.12:jar:sources", | ||
"com.thesamet.scalapb:compilerplugin_2.12", | ||
"com.thesamet.scalapb:compilerplugin_2.12:jar:sources", | ||
"com.thesamet.scalapb:protoc-bridge_2.12", | ||
"com.thesamet.scalapb:protoc-bridge_2.12:jar:sources", | ||
"com.thesamet.scalapb:protoc-gen_2.12", | ||
"com.thesamet.scalapb:protoc-gen_2.12:jar:sources", | ||
"dev.dirs:directories", | ||
"dev.dirs:directories:jar:sources", | ||
"org.scala-lang.modules:scala-collection-compat_2.12", | ||
"org.scala-lang.modules:scala-collection-compat_2.12:jar:sources", | ||
"org.scala-lang:scala-library", | ||
"org.scala-lang:scala-library:jar:sources" | ||
] | ||
}, | ||
"version": "2" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "zio_grpc", | ||
srcs = ["protoc_gen_zio_grpc.go"], | ||
importpath = "github.com/stackb/rules_proto/pkg/plugin/scalapb/zio_grpc", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//pkg/protoc", | ||
"@bazel_gazelle//label:go_default_library", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "zio_grpc_test", | ||
srcs = ["protoc_gen_zio_grpc_test.go"], | ||
deps = [ | ||
":zio_grpc", | ||
"//pkg/plugintest", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "all_files", | ||
testonly = True, | ||
srcs = [ | ||
"BUILD.bazel", | ||
] + glob(["*.go"]), | ||
visibility = ["//pkg:__pkg__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package zio_grpc | ||
|
||
import ( | ||
"path" | ||
|
||
"github.com/bazelbuild/bazel-gazelle/label" | ||
"github.com/stackb/rules_proto/pkg/protoc" | ||
) | ||
|
||
const ZioGrpcPluginName = "scalapb:zio-grpc:protoc-gen-zio-grpc" | ||
|
||
func init() { | ||
protoc.Plugins().MustRegisterPlugin(&ProtocGenZioGrpcPlugin{}) | ||
} | ||
|
||
// ProtocGenZioGrpcPlugin implements Plugin for the zio-grpc plugin. | ||
type ProtocGenZioGrpcPlugin struct{} | ||
|
||
// Name implements part of the Plugin interface. | ||
func (p *ProtocGenZioGrpcPlugin) Name() string { | ||
return ZioGrpcPluginName | ||
} | ||
|
||
// Configure implements part of the Plugin interface. | ||
func (p *ProtocGenZioGrpcPlugin) Configure(ctx *protoc.PluginContext) *protoc.PluginConfiguration { | ||
if !protoc.HasServices(ctx.ProtoLibrary.Files()...) { | ||
return nil | ||
} | ||
|
||
srcjar := ctx.ProtoLibrary.BaseName() + "_zio_grpc.srcjar" | ||
if ctx.Rel != "" { | ||
srcjar = path.Join(ctx.Rel, srcjar) | ||
} | ||
|
||
return &protoc.PluginConfiguration{ | ||
Label: label.New("build_stack_rules_proto", "plugin/scalapb/zio-grpc", "protoc-gen-zio-grpc"), | ||
Outputs: []string{srcjar}, | ||
Options: ctx.PluginConfig.GetOptions(), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package zio_grpc_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stackb/rules_proto/pkg/plugin/scalapb/zio_grpc" | ||
"github.com/stackb/rules_proto/pkg/plugintest" | ||
) | ||
|
||
func TestProtoGenZioGrpcPlugin(t *testing.T) { | ||
plugintest.Cases(t, &zio_grpc.ProtocGenZioGrpcPlugin{}, map[string]plugintest.Case{ | ||
"empty file": { | ||
Input: "", | ||
Directives: plugintest.WithDirectives( | ||
"proto_plugin", "zio implementation scalapb:zio-grpc:protoc-gen-zio-grpc", | ||
), | ||
PluginName: "zio", | ||
SkipIntegration: true, | ||
}, | ||
"only messages, no srcjar produced": { | ||
Input: "package pkg;\n\nmessage M{}", | ||
Directives: plugintest.WithDirectives( | ||
"proto_plugin", "zio implementation scalapb:zio-grpc:protoc-gen-zio-grpc", | ||
), | ||
PluginName: "zio", | ||
SkipIntegration: true, | ||
}, | ||
"with service": { | ||
Input: "package pkg;\n\nservice S{}", | ||
Directives: plugintest.WithDirectives( | ||
"proto_plugin", "zio implementation scalapb:zio-grpc:protoc-gen-zio-grpc", | ||
), | ||
PluginName: "zio", | ||
Configuration: plugintest.WithConfiguration( | ||
plugintest.WithLabel(t, "@build_stack_rules_proto//plugin/scalapb/zio-grpc:protoc-gen-zio-grpc"), | ||
plugintest.WithOutputs("test_zio_grpc.srcjar"), | ||
), | ||
SkipIntegration: true, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.