Skip to content

Commit af1ecbf

Browse files
authored
Merge pull request #106 from rules-proto-grpc/dev
3.0.0 release
2 parents 703b53e + ceaaae3 commit af1ecbf

File tree

653 files changed

+11242
-11437
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

653 files changed

+11242
-11437
lines changed

.bazelci/presubmit.yml

Lines changed: 391 additions & 589 deletions
Large diffs are not rendered by default.

.bazelrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

.github/labeler.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
dependencies: ['repositories.bzl', '*/repositories.bzl', 'third_party/**/*']
22
documentation: ['docs/**/*']
33
lang-android: ['android/**/*', 'example/android/**/*', 'tools/rulegen/android.go']
4-
lang-closure: ['closure/**/*', 'example/closure/**/*', 'tools/rulegen/closure.go']
4+
lang-c: ['c/**/*', 'example/c/**/*', 'tools/rulegen/c.go']
55
lang-cpp: ['cpp/**/*', 'example/cpp/**/*', 'tools/rulegen/cpp.go']
66
lang-csharp: ['csharp/**/*', 'example/csharp/**/*', 'tools/rulegen/csharp.go']
77
lang-d: ['d/**/*', 'example/d/**/*', 'tools/rulegen/d.go']
88
lang-go: ['go/**/*', 'example/go/**/*', 'tools/rulegen/go.go']
99
lang-grpc-gateway: ['grpc-gateway/**/*', 'example/grpc-gateway/**/*', 'tools/rulegen/grpc_gateway.go']
10-
lang-grpc-web: ['grpc-web/**/*', 'example/grpc-web/**/*', 'tools/rulegen/grpc_web.go']
1110
lang-java: ['java/**/*', 'example/java/**/*', 'tools/rulegen/java.go']
12-
lang-nodejs: ['nodejs/**/*', 'example/nodejs/**/*', 'tools/rulegen/nodejs.go', 'js/**/*', 'example/js/**/*', 'tools/rulegen/js.go']
11+
lang-js: ['js/**/*', 'example/js/**/*', 'tools/rulegen/js.go', 'tools/rulegen/grpc-web.go']
1312
lang-objc: ['objc/**/*', 'example/objc/**/*', 'tools/rulegen/objc.go']
1413
lang-php: ['php/**/*', 'example/php/**/*', 'tools/rulegen/php.go']
1514
lang-python: ['python/**/*', 'example/python/**/*', 'tools/rulegen/python.go']

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ jobs:
2525
"${GITHUB_WORKSPACE}/bin/bazel" run --run_under="cd $PWD && " //tools/rulegen -- --ref=`git describe --abbrev=0 --tags`
2626
rm available_tests.txt
2727
git checkout -- README.md
28+
make buildifier
2829
git diff
2930
git diff-files --quiet

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ available_tests.txt
66
.ipynb_checkpoints
77
csharp/nuget/nuget2config.json
88
ruby/.bundle
9-
nodejs/requirements/yarn-error.log
9+
js/requirements/yarn-error.log

CHANGELOG.md

Lines changed: 167 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,169 @@
11
# Changelog
22

3-
## Unreleased
3+
## 3.0.0
4+
5+
This update brings some major improvements to rules_proto_grpc and solves many of the longstanding issues that have been
6+
present. However, in doing so there have been some changes that make a major version increment necessary and may require
7+
updates to your build files. The updates for each language are explained below and should you have any issues, please
8+
open a new [issue](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/new) or
9+
[discussion](https://github.com/rules-proto-grpc/rules_proto_grpc/discussions/new).
10+
11+
The most substantial change is that compilation of .proto files into language specific files is no longer transitive.
12+
This means that only the direct dependencies of a `lang_proto_library` will be present within the generated library,
13+
rather than every transitive proto message. The justification for this is below, but if you're just interested in the
14+
changes, you can skip down to the next heading.
15+
16+
In previous versions of rules_proto_grpc, the compilation aspect would compile and aggregate all dependent .proto files
17+
from any top level target. In hindsight, this was not the correct behaviour and led to many bugs, since you may end up
18+
creating a library that contains compiled proto files from a third party, where you should instead be depending on a
19+
proper library for that third party's protos.
20+
21+
Even in a single repo, this may have meant multiple copies of a single compiled proto file being present in a target, if
22+
it is depended on via multiple routes. For some languages, such as C++, this breaks the 'one definition rule' and
23+
produces compilation failures or runtime bugs. For other languages, such as Python, this just meant unnecessary
24+
duplicate files in the output binaries.
25+
26+
Therefore, in this release of rules_proto_grpc, there is now a recommedned option to bundle only the direct proto
27+
dependencies into the libraries, without including the compiled transitive proto files. This is done by replacing the
28+
`deps` attr on `lang_{proto|grpc}_{compile|library}` with the `protos` attr. Since this would be a substantial breaking
29+
change to drop at once on a large project, the new behaviour is opt-in in 3.0.0 and the old method continues to work
30+
throughout the 3.x.x release cycle. Rules using the previous deps attr will have a warning written to console to signify
31+
that your library may be bundling more than expect and should switch attr.
32+
33+
As an additional benefit of this change, we can now support passing arbitrary per-target rules to protoc through the new
34+
`options` attr of the rules, which was a much sought after change that was impossible in the aspect based compilation.
35+
36+
### Switching to non-transitive compilation
37+
38+
In short, replace `deps` with `protos` on your targets:
39+
40+
```starlark
41+
# Old
42+
python_grpc_library(
43+
name = "routeguide",
44+
deps = ["//example/proto:routeguide_proto"],
45+
)
46+
47+
# New
48+
python_grpc_library(
49+
name = "routeguide",
50+
protos = ["//example/proto:routeguide_proto"],
51+
)
52+
```
53+
54+
In applying the above change, you may discover that you were inheriting dependencies transitively and that your builds
55+
now fail. In such cases, you should add a `lang_{proto|grpc}_{compile|library}` target for those proto files and
56+
depend on it explicitly from the relevant top level binaries/libraries.
57+
58+
### General Changes
59+
- Updated protobuf to 3.15.1
60+
- Updated gRPC to 1.35.0
61+
- All rules have new per-target `options` and `extra_protoc_args` attributes to control options to protoc
62+
[#54](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/54)
63+
[#68](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/68)
64+
[#105](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/105)
65+
- Updated `rules_proto` to latest head
66+
- `aspect.bzl` and `plugin.bzl` have merged to a single top level `defs.bzl`
67+
- The minimum supported Bazel version is 3.0.0. Some language specific rules may require 4.0.0
468

69+
### Android
70+
- **WORKSPACE update needed**: The WORKSPACE imports necessary for Android rules have been updated due to upstream
71+
changes in `grpc-java`. Please see the examples for the latest WORKSPACE template for the Android rules
72+
73+
### C
74+
- Added experimental rules for C using upb [#20](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/20)
75+
76+
### C++
77+
- Non-transitive mode resolves issue where the same proto may be defined more than once
78+
[#25](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/25)
79+
- Header and source files are now correctly passed to the underlying `cc_library` rule
80+
[#40](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/40)
81+
82+
### Closure
83+
- Closure rules have been removed. In practice these have been superceded by the Javascript rules, but if you are an
84+
active user of these rules please open a discussion.
85+
86+
### C#
87+
- Updated `rules_dotnet` to 0.0.7. Note that the new versions of `rules_dotnet` drop support for .Net Framework and
88+
Mono and require use of alternate platforms. Please see the examples for the latest WORKSPACE template for the
89+
C# rules
90+
- Updated `Grpc` to 2.35.0
91+
92+
### D
93+
- Updated `rules_d` to latest
94+
95+
### Go
96+
- Updated `rules_go` to 0.25.1
97+
- **WORKSPACE update needed**: It is now necessary to specify `version` to `go_register_toolchains`
98+
- The plugin used for compiling .proto files for Go has switched to the new google.golang.org/protobuf
99+
[#85](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/85)
100+
- Updated `gazelle` to 0.22.3
101+
- Updated `org_golang_x_net` to v0.0.0-20210129194117-4acb7895a057
102+
- Updated `org_golang_x_text` to 0.3.5
103+
- Well-known types are now depended on by default
104+
- Removed support for GoGo rules
105+
106+
### grpc-gateway
107+
- Updated `grpc-gateway` to 2.2.0
108+
- The `gateway_swagger_compile` rule has been replaced with `gateway_openapiv2_compile`
109+
[#93](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/93)
110+
- The grpc-gateway rules have move to repo top level, meaning they are no longer under the `github.com/...` prefix. To
111+
Update your use of these rules find and replace `@rules_proto_grpc//github.com/grpc-ecosystem/grpc-gateway` with
112+
`@rules_proto_grpc//grpc-gateway`
113+
114+
### gRPC-Web
115+
- The gRPC-Web rules have moved into `//js`
116+
- Text mode generation is now supported [#59](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/59)
117+
118+
### Java
119+
- **WORKSPACE update needed**: The WORKSPACE imports necessary for Java rules have been updated due to upstream
120+
changes in `grpc-java`. Please see the examples for the latest WORKSPACE template for the Java rules
121+
122+
### NodeJS/JavaScript
123+
- The JavaScript rules have moved from `@rules_proto_grpc//nodejs` to `@rules_proto_grpc//js`, but the old rules are
124+
still aliased to ease transition
125+
- Updated `rules_nodejs` to 3.1.0
126+
- Updated `@grpc/grpc-js` to 1.2.6
127+
- Added typescript generation to JS rules
128+
129+
### Objective-C
5130
- Added `copt` argument pass-through for Obj-C library rules.
6-
- Added `CHANGELOG.md`
131+
- Header and source files are now correctly passed to the underlying `cc_library` rule
132+
[#40](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/40)
133+
134+
### Python
135+
- Updated `rules_python` to latest
136+
- **WORKSPACE update needed**: `py_repositories` from `rules_python` is no longer required
137+
138+
### Ruby
139+
- The Ruby rules have migrated from `yugui/rules_ruby` to `bazelruby/rules_ruby`
140+
- Changes `rules_proto_grpc_gems` to `rules_proto_grpc_bundle`
141+
- **WORKSPACE update needed**: The above changes requiresupdates to your WORKSPACE, please see the examples for the
142+
latest WORKSPACE template for the Ruby rules
143+
- **Open issue**: The `grpc` gem may not be loadable in generated Ruby libraries, please see
144+
[this issue](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/65).
145+
146+
### Rust
147+
- **WORKSPACE update needed**: The upstream repo `io_bazel_rules_rust` has been renamed to `rules_rust`. The
148+
`rust_workspace` rule is also no longer required
149+
- Updated `rules_rust` to latest
150+
- Updated `grpcio` to 0.7.1
151+
- Updated `protobuf` to 2.20.0
152+
153+
### Scala
154+
- Update `rules_scala` to latest [#108](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/108)
155+
- **WORKSPACE update needed**: The `scala_config` rule from `rules_scala` is now required in your WORKSPACE
156+
157+
### Swift
158+
- Updated `rules_swift` to 0.18.0
159+
- Updated `grpc-swift` to 1.0.0
160+
- Visibility of generated types is now configurable with `options`
161+
[#111](https://github.com/rules-proto-grpc/rules_proto_grpc/issues/111)
162+
163+
### Thanks
164+
Thanks to everyone who has contributed issues and patches for this release.
7165

166+
---
8167

9168
## 2.0.0
10169

@@ -82,6 +241,7 @@
82241
- Updated `grpc-swift` to 0.11.0
83242
- Moved the Swift library rules to be internal to this repo
84243

244+
---
85245

86246
## 1.0.2
87247

@@ -91,6 +251,7 @@
91251
- Replaced Maven HTTP URLs with HTTPS URLs
92252
- Updated grpc-java, rules_closure and rules_scala to include Maven HTTPS fix
93253

254+
---
94255

95256
## 1.0.1
96257

@@ -99,6 +260,7 @@
99260
- Fix support for plugins that use `output_directory` and produce no output files: #39
100261
- Misc typo fixes and tidying
101262

263+
---
102264

103265
## 1.0.0
104266

@@ -135,6 +297,7 @@
135297
- Scala gRPC rules are currently not working fully. Due to delays in publishing support for Bazel 1.0, this support has been pushed back to 1.1.0
136298
- The required WORKSPACE rules has been updated for all Scala rules, please check the documentation for the current recommended set
137299

300+
---
138301

139302
## 0.2.0
140303

@@ -146,7 +309,8 @@
146309
- The naming of the Ruby gems workspace has changed to remove the 'routeguide' prefix
147310
- Ruby client/server is now included in the non-manual test matrix
148311

312+
---
149313

150-
# 0.1.0
314+
## 0.1.0
151315

152316
Initial release of `rules_proto_grpc`. For changes from predecessor `rules_proto`, please see [MIGRATION.md](https://github.com/rules-proto-grpc/rules_proto_grpc/blob/master/docs/MIGRATION.md)

Makefile

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,34 @@ rulegen:
66
rm available_tests.txt; \
77

88

9+
# Apply buildifier
10+
buildifier:
11+
bazel run //tools:buildifier
12+
13+
914
# Run cargo raze on the rust dependencies
1015
.PHONY: rust_raze
1116
rust_raze:
1217
cd rust/raze; \
1318
rm Cargo.lock; \
1419
rm -r remote; \
15-
cargo raze;
20+
cargo raze; \
21+
sed -i -e 's/io_bazel_rules_rust/rules_rust/g' rust/raze/remote/*.bazel;
1622

1723

18-
# Run yarn to upgrade the nodejs dependencies
24+
# Run yarn to upgrade the js dependencies
1925
.PHONY: yarn_upgrade
2026
yarn_upgrade:
21-
cd nodejs/requirements; \
27+
cd js/requirements; \
28+
rm yarn.lock; \
2229
yarn install; \
2330

2431

2532
# Run bundle to upgrade the Ruby dependencies
2633
.PHONY: ruby_bundle_upgrade
2734
ruby_bundle_upgrade:
2835
cd ruby; \
36+
rm Gemfile.lock; \
2937
bundle install --path /tmp/ruby-bundle; \
3038

3139

@@ -71,7 +79,6 @@ servers:
7179
.PHONY: tests
7280
tests:
7381
bazel test \
74-
//closure/example/routeguide/... \
7582
//cpp/example/routeguide/... \
7683
//java/example/routeguide/... \
7784
//go/example/routeguide/... \
@@ -80,16 +87,14 @@ tests:
8087
pending_clients:
8188
bazel build \
8289
//android/example/routeguide:client \
83-
//closure/example/routeguide/client \
84-
//nodejs/example/routeguide:client \
90+
//js/example/routeguide:client \
8591
//ruby/example/routeguide:client \
86-
//github.com/grpc/grpc-web/example/routeguide/closure:bundle \
8792
//rust/example/routeguide:client
8893

8994
.PHONY: pending_servers
9095
pending_servers:
9196
bazel build \
92-
//nodejs/example/routeguide:server \
97+
//js/example/routeguide:server \
9398
//ruby/example/routeguide:server \
9499
//rust/example/routeguide:server
95100

0 commit comments

Comments
 (0)