-
Notifications
You must be signed in to change notification settings - Fork 18
feat: allow proto_library as rb_library#dep #292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
103669e
feat: allow proto_library as rb_library#dep
alexeagle e9dff92
add example of use
alexeagle a4ab271
refactor: use proto_lang_toolchain helper
alexeagle 4f37379
fix: support pure-message protos with no services
alexeagle b309f77
chore: bzl_library
alexeagle b912fc8
fix accidental Bazel 9 bump
alexeagle 6146211
Update providers.bzl
alexeagle a7eb37e
add CI testing of new example
alexeagle b4a4061
fix test
alexeagle b865795
fix test
alexeagle deba2f4
Update examples/proto/MODULE.bazel
alexeagle 79e40e1
chore(docs): add proto.md
alexeagle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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,2 @@ | ||
| common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc | ||
| common --repo_env="JAVA_HOME=../bazel_tools/jdk" |
This file contains hidden or 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 @@ | ||
| 3.4.1 |
Empty file.
This file contains hidden or 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,5 @@ | ||
| source "https://rubygems.org" | ||
|
|
||
| gem 'google-protobuf' | ||
| gem 'grpc' | ||
| gem 'grpc-tools' |
This file contains hidden or 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,81 @@ | ||
| GEM | ||
| remote: https://rubygems.org/ | ||
| specs: | ||
| bigdecimal (4.0.1) | ||
| google-protobuf (4.33.4) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-aarch64-linux-gnu) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-aarch64-linux-musl) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-arm64-darwin) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-x86-linux-gnu) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-x86-linux-musl) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-x86_64-darwin) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-x86_64-linux-gnu) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| google-protobuf (4.33.4-x86_64-linux-musl) | ||
| bigdecimal | ||
| rake (>= 13) | ||
| googleapis-common-protos-types (1.22.0) | ||
| google-protobuf (~> 4.26) | ||
| grpc (1.76.0) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-aarch64-linux-gnu) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-aarch64-linux-musl) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-arm64-darwin) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-x86-linux-gnu) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-x86-linux-musl) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-x86_64-darwin) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-x86_64-linux-gnu) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc (1.76.0-x86_64-linux-musl) | ||
| google-protobuf (>= 3.25, < 5.0) | ||
| googleapis-common-protos-types (~> 1.0) | ||
| grpc-tools (1.76.0) | ||
| rake (13.3.1) | ||
|
|
||
| PLATFORMS | ||
| aarch64-linux-gnu | ||
| aarch64-linux-musl | ||
| arm64-darwin | ||
| ruby | ||
| x86-linux-gnu | ||
| x86-linux-musl | ||
| x86_64-darwin | ||
| x86_64-linux-gnu | ||
| x86_64-linux-musl | ||
|
|
||
| DEPENDENCIES | ||
| google-protobuf | ||
| grpc | ||
| grpc-tools | ||
|
|
||
| BUNDLED WITH | ||
| 2.6.2 |
This file contains hidden or 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,54 @@ | ||
| bazel_dep(name = "rules_ruby") | ||
| bazel_dep(name = "protobuf", version = "3.19.6") | ||
| bazel_dep( | ||
| name = "aspect_bazel_lib", | ||
| version = "2.22.5", | ||
| # repo_name = None (we don't dep on this but need a newer version) | ||
| ) | ||
|
|
||
| local_path_override( | ||
| module_name = "rules_ruby", | ||
| path = "../..", | ||
| ) | ||
|
|
||
| ruby = use_extension("@rules_ruby//ruby:extensions.bzl", "ruby") | ||
| ruby.toolchain( | ||
| name = "ruby", | ||
| version_file = "//:.ruby-version", | ||
| ) | ||
| use_repo(ruby, "ruby", "ruby_toolchains") | ||
|
|
||
| register_toolchains("@ruby_toolchains//:all") | ||
|
|
||
| ruby.bundle_fetch( | ||
| name = "bundle", | ||
| gem_checksums = { | ||
| "bigdecimal-4.0.1": "8b07d3d065a9f921c80ceaea7c9d4ae596697295b584c296fe599dd0ad01c4a7", | ||
| "google-protobuf-4.33.4": "86921935b023ed0d872d6e84382e79016c91689be0520d614c74426778f13c16", | ||
| "google-protobuf-4.33.4-aarch64-linux-gnu": "7b091ec8a80520738a4dbff59458e2a7ed4304d7fc20fd779b3d019ff52fbead", | ||
| "google-protobuf-4.33.4-aarch64-linux-musl": "c017371e6fe8144285a3dd5d1ae2776f92892f7455bea26537f0f3072b6d894c", | ||
| "google-protobuf-4.33.4-arm64-darwin": "63bb57e3d7108986f961546a536adaa38bd9ab5b1ebc39a1741a16c6eba3e869", | ||
| "google-protobuf-4.33.4-x86-linux-gnu": "c54fab97506b79d6c7857d2caf373df5428c4f318fcffcd7acddc4ee29af383f", | ||
| "google-protobuf-4.33.4-x86-linux-musl": "6e9a67b83e70090f72b65b4386b9273f460cf4f4d6cba61f3b4817bb3b416c97", | ||
| "google-protobuf-4.33.4-x86_64-darwin": "72906abcb572b324eba760b0abdbb827ab781b8e26f718fa3f7f49485295c8d3", | ||
| "google-protobuf-4.33.4-x86_64-linux-gnu": "a8cff953d742bc804ece78bd96e82d88cf65a7d8c1910e045359e2f53074e55d", | ||
| "google-protobuf-4.33.4-x86_64-linux-musl": "265e6e5bbcc0ba1367268739e31c4cc84ff310b56e8d738d2a3245b5cccfc2e7", | ||
| "googleapis-common-protos-types-1.22.0": "f97492b77bd6da0018c860d5004f512fe7cd165554d7019a8f4df6a56fbfc4c7", | ||
| "grpc-1.76.0": "112416fa42153aee440fd1b975de4b2bf746656df071bace97c197a6b5575598", | ||
| "grpc-1.76.0-aarch64-linux-gnu": "25159422ade5690adc1cbefac0d102395378d5aadf143817611e7bd08de06eff", | ||
| "grpc-1.76.0-aarch64-linux-musl": "38ecb67c40ee550723a38d9dfdf676d8d21d81429a5144ce7b78ae896f2e8e53", | ||
| "grpc-1.76.0-arm64-darwin": "c23f30c2e6a51bb75d8f617b028453e66e09665d8bf571d99c7be1b1f9dd2b59", | ||
| "grpc-1.76.0-x86-linux-gnu": "ccd532d55c23e5e8973d86051092d87ce0754b668d4606d4666e36d5db0c6187", | ||
| "grpc-1.76.0-x86-linux-musl": "511a111389d2cbbfef153fa3a0259a535bb87ba231088feb775c9098e19eb7c3", | ||
| "grpc-1.76.0-x86_64-darwin": "60a70eb9c0660d6ea2d79aad26c9aac696b34c3ece36200f292f669d16283bec", | ||
| "grpc-1.76.0-x86_64-linux-gnu": "1561c852903617acae0a9ef9011bcf313054ba65c5528519b002a9f6b4d5c024", | ||
| "grpc-1.76.0-x86_64-linux-musl": "b942a6ae0828e0e696ce26d8b797167314ae7633810c41dd09b45c2176f966cd", | ||
| "grpc-tools-1.76.0": "1b943edf89fd5d125c3476d657b4d89ac85adc6144c5e00a10ed750631f1228e", | ||
| "rake-13.3.1": "8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c", | ||
| }, | ||
| gemfile = "//:Gemfile", | ||
| gemfile_lock = "//:Gemfile.lock", | ||
| ) | ||
| use_repo(ruby, "bundle") | ||
|
|
||
| register_toolchains("//tools/toolchains:all") |
This file contains hidden or 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,11 @@ | ||
| load("@rules_ruby//ruby:defs.bzl", "rb_binary") | ||
|
|
||
| rb_binary( | ||
| name = "app", | ||
| srcs = ["hello.rb"], | ||
| main = "hello.rb", | ||
| deps = [ | ||
| "//proto:foo_proto", | ||
| "@bundle", | ||
| ], | ||
| ) |
This file contains hidden or 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,22 @@ | ||
| # TODO: is there a ruby runfiles helper? | ||
| runfiles_dir = ENV["RUNFILES_DIR"] | ||
| if runfiles_dir | ||
| main_root = File.join(runfiles_dir, "_main") | ||
| $LOAD_PATH.unshift(main_root) if Dir.exist?(main_root) && !$LOAD_PATH.include?(main_root) | ||
| end | ||
|
|
||
| require "grpc" | ||
| require "proto/foo_pb" | ||
| require "proto/foo_services_pb" | ||
|
|
||
| class FooServer < Foo::FooService::Service | ||
| def get_foo(_req, _call) | ||
| Foo::GetFooResponse.new(name: "Hello from Bazel + Ruby gRPC server!") | ||
| end | ||
| end | ||
|
|
||
| server = GRPC::RpcServer.new | ||
| server.add_http2_port("0.0.0.0:50051", :this_port_is_insecure) | ||
| server.handle(FooServer.new) | ||
| puts "gRPC server listening on 0.0.0.0:50051" | ||
| server.run_till_terminated |
This file contains hidden or 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,8 @@ | ||
| load("@protobuf//bazel:proto_library.bzl", "proto_library") | ||
|
|
||
| proto_library( | ||
| name = "foo_proto", | ||
| srcs = ["foo.proto"], | ||
| visibility = ["//visibility:public"], | ||
| deps = ["@protobuf//:empty_proto"], | ||
| ) |
This file contains hidden or 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,16 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package foo; | ||
| import "google/protobuf/empty.proto"; | ||
|
|
||
| service FooService { | ||
| rpc GetFoo(GetFooRequest) returns (GetFooResponse); | ||
| } | ||
|
|
||
| message GetFooRequest { | ||
| google.protobuf.Empty empty = 1; | ||
| } | ||
|
|
||
| message GetFooResponse { | ||
| string name = 1; | ||
| } |
This file contains hidden or 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,9 @@ | ||
| load("@rules_ruby//ruby:defs.bzl", "rb_binary") | ||
|
|
||
| package(default_visibility = ["//visibility:public"]) | ||
|
|
||
| rb_binary( | ||
| name = "grpc_tools_ruby_protoc_plugin", | ||
| main = "@bundle//bin:grpc_tools_ruby_protoc_plugin", | ||
| deps = ["@bundle"], | ||
| ) |
This file contains hidden or 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,6 @@ | ||
| load("@rules_ruby//ruby:proto.bzl", "rb_grpc_protoc_plugin_toolchain") | ||
|
|
||
| rb_grpc_protoc_plugin_toolchain( | ||
| name = "grpc_protoc_plugin", | ||
| grpc_plugin = "//tools:grpc_tools_ruby_protoc_plugin", | ||
| ) |
This file contains hidden or 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 @@ | ||
| ../../.bazelversion |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,13 +1,18 @@ | ||
| { | ||
| "$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
| "extends": [ | ||
| "config:recommended" | ||
| ":dependencyDashboard", | ||
| ":enablePreCommit", | ||
| ":semanticPrefixFixDepsChoreOthers", | ||
| "group:monorepos", | ||
| "group:recommended", | ||
| "replacements:all", | ||
| "workarounds:all" | ||
| ], | ||
| "ignoreDeps": [ | ||
| "bazel_features", | ||
| "bazel_skylib", | ||
| "platforms", | ||
| "rules_cc", | ||
| "rules_java" | ||
| "packageRules": [ | ||
| { | ||
| "matchFiles": ["MODULE.bazel"], | ||
| "enabled": false | ||
| } | ||
| ] | ||
| } |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.