Skip to content

Commit 298ac1a

Browse files
authored
Merge pull request #244 from rules-proto-grpc/dev
4.4.0 Release
2 parents bbb8193 + 2e710c9 commit 298ac1a

File tree

35 files changed

+202
-49
lines changed

35 files changed

+202
-49
lines changed

.bazelci/presubmit.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ tasks:
115115
- "//c/..."
116116
- "//cpp/..."
117117
- "//csharp/..."
118-
- "//d/..."
119118
- "//doc/..."
120119
- "//fsharp/..."
121120
- "//go/..."
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish Release Assets
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
name: Publish
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Setup Env
15+
run: |
16+
REPO_NAME=$(echo ${GITHUB_REPOSITORY?missing} | cut -d "/" -f 2)
17+
FILE_STEM=${REPO_NAME?mising}-${GITHUB_REF_NAME?missing}
18+
UPLOAD_URL=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${GITHUB_REPOSITORY?missing}/releases/tags/${GITHUB_REF_NAME?missing} | jq -r '.upload_url')
19+
echo "REPO_NAME=${REPO_NAME}" >> $GITHUB_ENV
20+
echo "FILE_STEM=${FILE_STEM}" >> $GITHUB_ENV
21+
echo "FILE_NAME=${FILE_STEM}.tar.gz" >> $GITHUB_ENV
22+
echo "UPLOAD_URL=${UPLOAD_URL}" >> $GITHUB_ENV
23+
- name: Build Assets
24+
run: |
25+
git archive --format=tar --prefix="${FILE_STEM?missing}/" "${GITHUB_REF_NAME?missing}" | gzip --best > "${FILE_NAME?missing}"
26+
echo "Asset SHA256: $(sha256sum ${FILE_NAME?missing})" >> $GITHUB_STEP_SUMMARY
27+
- name: Upload Assets to Release
28+
uses: actions/upload-release-asset@v1
29+
env:
30+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
with:
32+
upload_url: ${{ env.UPLOAD_URL }}
33+
asset_path: ./${{ env.FILE_NAME }}
34+
asset_name: ${{ env.FILE_NAME }}
35+
asset_content_type: application/gzip

BUILD.bazel

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2+
3+
bzl_library(
4+
name = "defs",
5+
srcs = ["defs.bzl"],
6+
visibility = ["//visibility:public"],
7+
deps = [
8+
"//internal",
9+
],
10+
)

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414

1515
## Announcements 📣
1616

17+
#### 2023/05/03 - Version 4.4.0
18+
19+
[Version 4.4.0 has been released](https://github.com/rules-proto-grpc/rules_proto_grpc/releases/tag/4.4.0),
20+
which mainly contains fixes for build edge-cases and wider compatibility
21+
1722
#### 2022/12/04 - Version 4.3.0
1823

1924
[Version 4.3.0 has been released](https://github.com/rules-proto-grpc/rules_proto_grpc/releases/tag/4.3.0),

WORKSPACE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ load("//grpc-gateway:repositories.bzl", "gateway_repos")
177177

178178
gateway_repos()
179179

180-
load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
180+
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")
181181

182182
go_repositories()
183183

@@ -235,7 +235,7 @@ load("@rules_python//python:pip.bzl", "pip_parse")
235235
pip_parse(
236236
name = "rules_proto_grpc_py3_deps",
237237
python_interpreter = "python3",
238-
requirements = "@rules_proto_grpc//python:requirements.txt",
238+
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
239239
)
240240

241241
load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")

defs.bzl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Top level definition exports for rules_proto_grpc."""
22

33
load("//internal:common.bzl", _bazel_build_rule_common_attrs = "bazel_build_rule_common_attrs")
4-
load("//internal:compile.bzl", _proto_compile_attrs = "proto_compile_attrs", _proto_compile_impl = "proto_compile_impl")
4+
load("//internal:compile.bzl", _proto_compile = "proto_compile", _proto_compile_attrs = "proto_compile_attrs", _proto_compile_impl = "proto_compile_impl")
55
load("//internal:filter_files.bzl", _filter_files = "filter_files")
66
load("//internal:plugin.bzl", _proto_plugin = "proto_plugin")
77
load("//internal:providers.bzl", _ProtoCompileInfo = "ProtoCompileInfo", _ProtoPluginInfo = "ProtoPluginInfo")
@@ -17,6 +17,11 @@ proto_plugin = _proto_plugin
1717
proto_compile_attrs = _proto_compile_attrs
1818
proto_compile_impl = _proto_compile_impl
1919

20+
# Export compilation function, which can be wrapped by external rules that need more
21+
# pre-configuration than proto_compile_impl alone allows. e.g third party versions of
22+
# doc_template_compile_impl-like rules
23+
proto_compile = _proto_compile
24+
2025
# Export utils
2126
bazel_build_rule_common_attrs = _bazel_build_rule_common_attrs
2227
filter_files = _filter_files

docs/changelog.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@
66
Changelog
77
=========
88

9+
4.4.0
10+
-----
11+
12+
General
13+
*******
14+
15+
- Increased minimum supported Bazel version from 5.0.0 to 5.3.0.
16+
`#230 <https://github.com/rules-proto-grpc/rules_proto_grpc/issues/230>`__
17+
- Added support for param file for excess arguments, which allows for longer commands lines without
18+
failure
19+
- Fixed Windows incompatibility due to test workspace containing quote character in path
20+
- The `proto_compile` function is now exported in the public `defs.bzl` for use in external rules
21+
- Added static release assets generation, which will change the format of the download URL to use in
22+
your WORKSPACE. See the sample installation docs for the new URL
23+
24+
Go
25+
**
26+
27+
- Updated ``github.com/envoyproxy/protoc-gen-validate`` to 1.0.0
28+
29+
grpc-gateway
30+
************
31+
32+
- **WORKSPACE update needed**: Renamed ``grpc-gateway`` repository name from
33+
``grpc_ecosystem_grpc_gateway`` to ``com_github_grpc_ecosystem_grpc_gateway_v2``, to match the
34+
naming used by Gazelle. You may need to update your WORKSPACE file to use the new name
35+
36+
Objective-C
37+
***********
38+
39+
- Fixed expected naming of output files for proto files containing numbers in file name.
40+
`#253 <https://github.com/rules-proto-grpc/rules_proto_grpc/pull/253>`__
41+
42+
943
4.3.0
1044
-----
1145

docs/lang/grpc-gateway.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
5454
version = "1.17.1",
5555
)
5656
57-
load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
57+
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")
5858
5959
go_repositories()
6060
@@ -164,7 +164,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
164164
version = "1.17.1",
165165
)
166166
167-
load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
167+
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")
168168
169169
go_repositories()
170170
@@ -272,7 +272,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
272272
version = "1.17.1",
273273
)
274274
275-
load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
275+
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")
276276
277277
go_repositories()
278278

docs/lang/python.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
261261
pip_parse(
262262
name = "rules_proto_grpc_py3_deps",
263263
python_interpreter = "python3",
264-
requirements = "@rules_proto_grpc//python:requirements.txt",
264+
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
265265
)
266266
267267
load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")
@@ -571,7 +571,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
571571
pip_parse(
572572
name = "rules_proto_grpc_py3_deps",
573573
python_interpreter = "python3",
574-
requirements = "@rules_proto_grpc//python:requirements.txt",
574+
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
575575
)
576576
577577
load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")

example/grpc-gateway/gateway_grpc_compile/WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ go_register_toolchains(
3333
version = "1.17.1",
3434
)
3535

36-
load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
36+
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")
3737

3838
go_repositories()
3939

example/grpc-gateway/gateway_grpc_library/WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ go_register_toolchains(
3333
version = "1.17.1",
3434
)
3535

36-
load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
36+
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")
3737

3838
go_repositories()
3939

example/grpc-gateway/gateway_openapiv2_compile/WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ go_register_toolchains(
3333
version = "1.17.1",
3434
)
3535

36-
load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
36+
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")
3737

3838
go_repositories()
3939

example/python/python_grpclib_compile/WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ load("@rules_python//python:pip.bzl", "pip_parse")
3232
pip_parse(
3333
name = "rules_proto_grpc_py3_deps",
3434
python_interpreter = "python3",
35-
requirements = "@rules_proto_grpc//python:requirements.txt",
35+
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
3636
)
3737

3838
load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")

example/python/python_grpclib_library/WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ load("@rules_python//python:pip.bzl", "pip_parse")
3232
pip_parse(
3333
name = "rules_proto_grpc_py3_deps",
3434
python_interpreter = "python3",
35-
requirements = "@rules_proto_grpc//python:requirements.txt",
35+
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
3636
)
3737

3838
load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")

go/repositories.bzl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ def go_repos(**kwargs): # buildifier: disable=function-docstring
3737
go_repository(
3838
name = "com_github_envoyproxy_protoc_gen_validate",
3939
importpath = "github.com/envoyproxy/protoc-gen-validate",
40-
sum = "h1:wyv+mWIshClA4g6hTlKD9xb6fiNAnDu3+8qYf7KSuSE=",
41-
version = "v0.9.0",
40+
sum = "h1:FPFO7LWZ2pfphahSUMX8L5p/6FqSzRYRxq6V74eG8ZI=",
41+
version = "v1.0.0",
4242
)
4343

4444
go_repository(
4545
name = "com_github_lyft_protoc_gen_star",
46-
importpath = "github.com/lyft/protoc-gen-star",
47-
sum = "h1:erE0rdztuaDq3bpGifD95wfoPrSZc95nGA6tbiNYh6M=",
48-
version = "v0.6.1",
46+
importpath = "github.com/lyft/protoc-gen-star/v2",
47+
sum = "h1:/3+/2sWyXeMLzKd1bX+ixWKgEMsULrIivpDsuaF441o=",
48+
version = "v2.0.3",
4949
)
5050

5151
go_repository(

grpc-gateway/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ proto_plugin(
99
],
1010
options = ["paths=source_relative"],
1111
outputs = ["{protopath}.pb.gw.go"],
12-
tool = "@grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway",
12+
tool = "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway",
1313
visibility = ["//visibility:public"],
1414
)
1515

@@ -23,6 +23,6 @@ proto_plugin(
2323
quirks = [
2424
"QUIRK_DIRECT_MODE",
2525
],
26-
tool = "@grpc_ecosystem_grpc_gateway//protoc-gen-openapiv2",
26+
tool = "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2",
2727
visibility = ["//visibility:public"],
2828
)

grpc-gateway/example/gateway/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ go_library(
1313
deps = [
1414
"//grpc-gateway/example/api:go_default_library",
1515
"@com_github_golang_glog//:go_default_library",
16+
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
1617
"@go_googleapis//google/rpc:errdetails_go_proto",
17-
"@grpc_ecosystem_grpc_gateway//runtime:go_default_library",
1818
"@org_golang_google_grpc//:go_default_library",
1919
"@org_golang_google_grpc//connectivity:go_default_library",
2020
],

grpc-gateway/gateway_grpc_library.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ GATEWAY_DEPS = [
3636
"@org_golang_google_protobuf//proto:go_default_library",
3737
"@org_golang_google_grpc//grpclog:go_default_library",
3838
"@org_golang_google_grpc//metadata:go_default_library",
39-
"@grpc_ecosystem_grpc_gateway//runtime:go_default_library",
40-
"@grpc_ecosystem_grpc_gateway//utilities:go_default_library",
39+
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
40+
"@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library",
4141
"@go_googleapis//google/api:annotations_go_proto",
4242
]

grpc-gateway/repositories.bzl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
load(
44
"//:repositories.bzl",
5-
"grpc_ecosystem_grpc_gateway",
5+
"com_github_grpc_ecosystem_grpc_gateway_v2",
66
)
77
load("//go:repositories.bzl", "go_repos")
88

99
def gateway_repos(**kwargs): # buildifier: disable=function-docstring
1010
go_repos(**kwargs)
11-
grpc_ecosystem_grpc_gateway(**kwargs)
11+
com_github_grpc_ecosystem_grpc_gateway_v2(**kwargs)

internal/BUILD.bazel

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2+
3+
bzl_library(
4+
name = "internal",
5+
srcs = [
6+
"common.bzl",
7+
"compile.bzl",
8+
"filter_files.bzl",
9+
"plugin.bzl",
10+
"protoc.bzl",
11+
"providers.bzl",
12+
],
13+
visibility = ["//:__subpackages__"],
14+
deps = [
15+
"@rules_proto//proto:defs",
16+
],
17+
)

internal/common.bzl

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def pascal_objc(s):
5959
"""
6060
Convert pascal_case -> PascalCase
6161
62-
Objective C uses pascal case, but there are e exceptions that it uppercases
63-
the entire segment: url, http, and https.
62+
Objective C uses pascal case, but there are exceptions that it uppercases.
63+
For example, it will uppercase the words "url", "http", and "https".
6464
6565
https://github.com/protocolbuffers/protobuf/blob/54176b26a9be6c9903b375596b778f51f5947921/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc#L91
6666
@@ -78,14 +78,50 @@ def pascal_objc(s):
7878
s = s.replace("-", "_")
7979

8080
segments = []
81-
for segment in s.split("_"):
81+
current = ""
82+
last_char_was_number = False
83+
last_char_was_lower = False
84+
last_char_was_upper = False
85+
for char in s.elems():
86+
if char.isdigit():
87+
if last_char_was_number:
88+
segments.append(current)
89+
current = ""
90+
current += char
91+
last_char_was_number = True
92+
last_char_was_lower = False
93+
last_char_was_upper = False
94+
elif char.islower():
95+
if not last_char_was_lower and not last_char_was_upper:
96+
segments.append(current)
97+
current = ""
98+
current += char
99+
last_char_was_number = False
100+
last_char_was_lower = True
101+
last_char_was_upper = False
102+
elif char.isupper():
103+
if not last_char_was_upper:
104+
segments.append(current)
105+
current = ""
106+
current += char.lower()
107+
last_char_was_number = False
108+
last_char_was_lower = False
109+
last_char_was_upper = True
110+
else:
111+
last_char_was_number = False
112+
last_char_was_lower = False
113+
last_char_was_upper = False
114+
segments.append(current)
115+
116+
new_segments = []
117+
for segment in segments:
82118
repl = _objc_upper_segments.get(segment)
83119
if repl:
84120
segment = repl
85121
else:
86122
segment = capitalize(segment)
87-
segments.append(segment)
88-
return "".join(segments)
123+
new_segments.append(segment)
124+
return "".join(new_segments)
89125

90126
def pascal_case(s):
91127
"""

internal/compile.bzl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ def proto_compile(ctx, options, extra_protoc_args, extra_protoc_files):
291291
extra_protoc_args = extra_protoc_args,
292292
)
293293
args = ctx.actions.args()
294+
args.set_param_file_format("multiline")
295+
args.use_param_file("@%s", use_always = False)
294296
args.add_all(args_list)
295297

296298
# Add import roots and files if required by plugin

0 commit comments

Comments
 (0)