Skip to content

Create scala_proto_library rule using scalaPB #281

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

Merged
merged 12 commits into from
Sep 30, 2017
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
2 changes: 1 addition & 1 deletion .bazelrc.travis
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ build --verbose_failures
# runs stuff in a container, and since Travis already runs its script
# in a container (unless you require sudo in your .travis.yml) this
# fails to run tests.
build --spawn_strategy=standalone --genrule_strategy=standalone
build --spawn_strategy=standalone --genrule_strategy=standalone --strategy=Scalac=worker --strategy=ScroogeRule=worker --worker_max_instances=3
test --test_strategy=standalone

# Below this line, .travis.yml will cat the default bazelrc.
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
# we want to test the most recent few releases
- V=0.5.3
- V=0.5.4
- V=0.6.0rc2
- V=0.6.0

before_install:
- |
Expand Down
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,71 @@ thrift_library(name, srcs, deps, absolute_prefix, absolute_prefixes)
</tbody>
</table>

## scalapb_proto_library

```python
load("//scala_proto:scala_proto.bzl", "scalapb_proto_library")
scalapb_proto_library(name, deps, with_grpc, with_java, with_flat_package, with_single_line_to_string)
```

`scalapb_proto_library` generates a scala library of scala proto bindings
generated by the [ScalaPB compiler](https://github.com/scalapb/ScalaPB).

<table class="table table-condensed table-bordered table-params">
<colgroup>
<col class="col-param" />
<col class="param-description" />
</colgroup>
<thead>
<tr>
<th colspan="2">Attributes</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>name</code></td>
<td>
<p><code>Name, required</code></p>
<p>A unique name for this target</p>
</td>
<tr>
<td><code>deps</code></td>
<td>
<p><code>List of labels, required</code></p>
<p>List of proto dependencies that this target depends on. Must be of type <code>proto_library</code></p>
</td>
</tr>
<tr>
<td><code>with_grpc</code></td>
<td>
<p><code>boolean; optional (default False)</code></p>
<p>Enables generation of grpc service bindings for services defined in <code>deps</code></p>
</td>
</tr>
<tr>
<td><code>with_java</code></td>
<td>
<p><code>boolean; optional (default False)</code></p>
<p>Enables generation of converters to and from java protobuf bindings</p>
</td>
</tr>
<tr>
<td><code>with_flat_package</code></td>
<td>
<p><code>boolean; optional (default False)</code></p>
<p>When true, ScalaPB will not append the protofile base name to the package name</p>
</td>
</tr>
<tr>
<td><code>with_single_line_to_string</code></td>
<td>
<p><code>boolean; optional (default False)</code></p>
<p>Enables generation of <code>toString()</code> methods that use the single line format</p>
</td>
</tr>
</tbody>
</table>

## Building from source
Test & Build:
```
Expand Down
17 changes: 17 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ tut_repositories()
load("//jmh:jmh.bzl", "jmh_repositories")
jmh_repositories()

load("//scala_proto:scala_proto.bzl", "scala_proto_repositories")
scala_proto_repositories()

load("//specs2:specs2_junit.bzl","specs2_junit_repositories")
specs2_junit_repositories()

Expand Down Expand Up @@ -50,3 +53,17 @@ maven_jar(
artifact = "org.apache.commons:commons-lang3:3.5",
sha1 = "6c6c702c89bfff3cd9e80b04d668c5e190d588c6"
)

http_archive(
name = "com_google_protobuf",
urls = ["https://github.com/google/protobuf/archive/b4b0e304be5a68de3d0ee1af9b286f958750f5e4.zip"],
strip_prefix = "protobuf-b4b0e304be5a68de3d0ee1af9b286f958750f5e4",
sha256 = "ff771a662fb6bd4d3cc209bcccedef3e93980a49f71df1e987f6afa3bcdcba3a",
)

http_archive(
name = "com_google_protobuf_java",
urls = ["https://github.com/google/protobuf/archive/b4b0e304be5a68de3d0ee1af9b286f958750f5e4.zip"],
strip_prefix = "protobuf-b4b0e304be5a68de3d0ee1af9b286f958750f5e4",
sha256 = "ff771a662fb6bd4d3cc209bcccedef3e93980a49f71df1e987f6afa3bcdcba3a",
)
Empty file added scala_proto/BUILD
Empty file.
Loading