From f4d593dbb97cfd9afa7f83e551fb2d261424e41c Mon Sep 17 00:00:00 2001 From: Andy Scott Date: Sun, 18 Aug 2019 13:58:18 -0700 Subject: [PATCH] rename proto rule while maintaining backwards compat --- docs/scalapb_proto_library.md | 12 ++++++------ scala_proto/scala_proto.bzl | 10 +++++++--- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/scalapb_proto_library.md b/docs/scalapb_proto_library.md index 1278806c6..f0c98a14c 100644 --- a/docs/scalapb_proto_library.md +++ b/docs/scalapb_proto_library.md @@ -1,4 +1,4 @@ -# scalapb_proto_library +# scala_proto_library To use this rule, you'll first need to add the following to your `WORKSPACE` file, which adds a few dependencies needed for ScalaPB: @@ -8,17 +8,17 @@ load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_reposito scala_proto_repositories(scala_version = "2.12.8") # or whatever scala_version you're on ``` -Then you can import `scalapb_proto_library` in any `BUILD` file like this: +Then you can import `scala_proto_library` in any `BUILD` file like this: ```python -load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scalapb_proto_library") -scalapb_proto_library( +load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_library") +scala_proto_library( name = "my_scala_proto_lib", deps = [":my_target"], ) ``` -`scalapb_proto_library` generates a Scala library of Scala proto bindings +`scala_proto_library` generates a Scala library of Scala proto bindings generated by the [ScalaPB compiler](https://github.com/scalapb/ScalaPB). ## Attributes @@ -65,4 +65,4 @@ toolchain( | extra_generator_dependencies | `List of labels, optional`
| grpc_deps | `List of labels, optional (has default)`
gRPC dependencies. A sensible default is provided. | implicit_compile_deps | `List of labels, optional (has default)`
ScalaPB dependencies. A sensible default is provided. -| scalac | `Label, optional (has default)`
Target for scalac. A sensible default is provided. \ No newline at end of file +| scalac | `Label, optional (has default)`
Target for scalac. A sensible default is provided. diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index 0e3a69199..8f0d554f8 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -38,7 +38,7 @@ def scala_proto_repositories( -def _scalapb_proto_library_impl(ctx): +def _scala_proto_library_impl(ctx): aspect_info = merge_scalapb_aspect_info( [dep[ScalaPBAspectInfo] for dep in ctx.attr.deps], ) @@ -50,10 +50,14 @@ def _scalapb_proto_library_impl(ctx): DefaultInfo(files = aspect_info.output_files), ] -scalapb_proto_library = rule( - implementation = _scalapb_proto_library_impl, +scala_proto_library = rule( + implementation = _scala_proto_library_impl, attrs = { "deps": attr.label_list(aspects = [scalapb_aspect]), }, provides = [DefaultInfo, ScalaPBInfo, JavaInfo], ) + + +def scalapb_proto_library(**kwargs): + scala_proto_library(**kwargs)