Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Latest commit

 

History

History
123 lines (99 loc) · 3.27 KB

scala_proto.md

File metadata and controls

123 lines (99 loc) · 3.27 KB

scala_proto_library

scala_proto_library(name, deps)

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 Name; required

A unique name for this target.

deps List of labels; optional

The proto_library targets you wish to generate Scala from

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 Name; required

A unique name for this target.

compiler Label; optional

The compiler to use to generate Scala form proto sources

compiler_supports_workers Boolean; optional