tree: a63d587ad621bbc05a9b5dceef8ab4d7dd027e7f
  1. example/
  2. BUILD.bazel
  3. defs.bzl
  4. Gemfile
  5. Gemfile.lock
  6. README.md
  7. repositories.bzl
  8. ruby_grpc_compile.bzl
  9. ruby_grpc_library.bzl
  10. ruby_proto_compile.bzl
  11. ruby_proto_library.bzl
ruby/README.md

Ruby rules

Rules for generating Ruby protobuf and gRPC .rb files and libraries using standard Protocol Buffers and gRPC. Libraries are created with ruby_library from rules_ruby. Note, the Ruby library rules presently cannot set the includes attribute correctly, requiring users to set this manually. See https://github.com/yugui/rules_ruby/pull/8

RuleDescription
ruby_proto_compileGenerates Ruby protobuf .rb artifacts
ruby_grpc_compileGenerates Ruby protobuf+gRPC .rb artifacts
ruby_proto_libraryGenerates a Ruby protobuf library using ruby_library from rules_ruby
ruby_grpc_libraryGenerates a Ruby protobuf+gRPC library using ruby_library from rules_ruby

ruby_proto_compile

Generates Ruby protobuf .rb artifacts

WORKSPACE

load("@rules_proto_grpc//ruby:repositories.bzl", rules_proto_grpc_ruby_repos="ruby_repos")

rules_proto_grpc_ruby_repos()

BUILD.bazel

load("@rules_proto_grpc//ruby:defs.bzl", "ruby_proto_compile")

ruby_proto_compile(
    name = "person_ruby_proto",
    deps = ["@rules_proto_grpc//example/proto:person_proto"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc

ruby_grpc_compile

Generates Ruby protobuf+gRPC .rb artifacts

WORKSPACE

load("@rules_proto_grpc//ruby:repositories.bzl", rules_proto_grpc_ruby_repos="ruby_repos")

rules_proto_grpc_ruby_repos()

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

BUILD.bazel

load("@rules_proto_grpc//ruby:defs.bzl", "ruby_grpc_compile")

ruby_grpc_compile(
    name = "greeter_ruby_grpc",
    deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc

ruby_proto_library

Generates a Ruby protobuf library using ruby_library from rules_ruby

WORKSPACE

load("@rules_proto_grpc//ruby:repositories.bzl", rules_proto_grpc_ruby_repos="ruby_repos")

rules_proto_grpc_ruby_repos()

load("@com_github_yugui_rules_ruby//ruby:def.bzl", "ruby_register_toolchains")

ruby_register_toolchains()

load("@com_github_yugui_rules_ruby//ruby/private:bundle.bzl", "bundle_install")

bundle_install(
    name = "rules_proto_grpc_gems",
    gemfile = "@rules_proto_grpc//ruby:Gemfile",
    gemfile_lock = "@rules_proto_grpc//ruby:Gemfile.lock",
)

BUILD.bazel

load("@rules_proto_grpc//ruby:defs.bzl", "ruby_proto_library")

ruby_proto_library(
    name = "person_ruby_library",
    deps = ["@rules_proto_grpc//example/proto:person_proto"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc

ruby_grpc_library

Generates a Ruby protobuf+gRPC library using ruby_library from rules_ruby

WORKSPACE

load("@rules_proto_grpc//ruby:repositories.bzl", rules_proto_grpc_ruby_repos="ruby_repos")

rules_proto_grpc_ruby_repos()

load("@com_github_yugui_rules_ruby//ruby:def.bzl", "ruby_register_toolchains")

ruby_register_toolchains()

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")

grpc_deps()

load("@com_github_yugui_rules_ruby//ruby/private:bundle.bzl", "bundle_install")

bundle_install(
    name = "rules_proto_grpc_gems",
    gemfile = "@rules_proto_grpc//ruby:Gemfile",
    gemfile_lock = "@rules_proto_grpc//ruby:Gemfile.lock",
)

BUILD.bazel

load("@rules_proto_grpc//ruby:defs.bzl", "ruby_grpc_library")

ruby_grpc_library(
    name = "greeter_ruby_library",
    deps = ["@rules_proto_grpc//example/proto:greeter_grpc"],
)

Attributes

NameTypeMandatoryDefaultDescription
depslist<ProtoInfo>true[]List of labels that provide a ProtoInfo (such as native.proto_library)
verboseintfalse0The verbosity level. Supported values and results are 1: show command, 2: show command and sandbox after running protoc, 3: show command and sandbox before and after running protoc, 4. show env, command, expected outputs and sandbox before and after running protoc