Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 3.08 KB

scala_proto.md

File metadata and controls

79 lines (53 loc) · 3.08 KB

scala_proto_library

load("@//rules:scala_proto.bzl", "scala_proto_library")

scala_proto_library(name, deps, grpc)

Generates Scala code from proto sources. The output is a .srcjar that can be passed into other rules for compilation.

See example use in /tests/proto/BUILD

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
deps The proto_library targets you wish to generate Scala from List of labels optional []
grpc - Boolean optional False

scala_proto_toolchain

load("@//rules:scala_proto.bzl", "scala_proto_toolchain")

scala_proto_toolchain(name, compiler, compiler_supports_workers)

Specifies a toolchain of the @rules_scala_annex//rules/scala_proto:compiler_toolchain_type toolchain type.

This rule should be used with an accompanying toolchain that binds it and specifies constraints (See the official documentation for more info on Bazel Toolchains)

For example:

scala_proto_toolchain(
    name = "scalapb_toolchain_example",
    compiler = ":worker",
    compiler_supports_workers = True,
    visibility = ["//visibility:public"],
)

toolchain(
    name = "scalapb_toolchain_example_linux",
    toolchain = ":scalapb_toolchain_example",
    toolchain_type = "@rules_scala_annex//rules/scala_proto:compiler_toolchain_type",
    exec_compatible_with = [
        "@bazel_tools//platforms:linux",
        "@bazel_tools//platforms:x86_64",
    ],
    target_compatible_with = [
        "@bazel_tools//platforms:linux",
        "@bazel_tools//platforms:x86_64",
    ],
    visibility = ["//visibility:public"],
)

ATTRIBUTES

Name Description Type Mandatory Default
name A unique name for this target. Name required
compiler The compiler to use to generate Scala form proto sources Label optional None
compiler_supports_workers - Boolean optional False