Skip to content
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

rename scalapb_proto_library rule while maintaining backwards compat #821

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions docs/scalapb_proto_library.md
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -65,4 +65,4 @@ toolchain(
| extra_generator_dependencies | `List of labels, optional` <br>
| grpc_deps | `List of labels, optional (has default)` <br> gRPC dependencies. A sensible default is provided.
| implicit_compile_deps | `List of labels, optional (has default)` <br> ScalaPB dependencies. A sensible default is provided.
| scalac | `Label, optional (has default)` <br> Target for scalac. A sensible default is provided.
| scalac | `Label, optional (has default)` <br> Target for scalac. A sensible default is provided.
10 changes: 7 additions & 3 deletions scala_proto/scala_proto.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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],
)
Expand All @@ -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)