Skip to content

4.4.0 Release #244

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 23 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9b847f0
Use non-aliased attr for pip_parse requirements
aaliddell Dec 4, 2022
22efd5b
Rename repo: grpc_ecosystem_grpc_gateway to grpc_ecosystem_grpc_gatew…
Jan 5, 2023
b1dfe44
prefix with com_github
Jan 6, 2023
c064d11
Add args.use_param_file, closes #241
aaliddell Jan 15, 2023
93ab40f
Remove double-quote char from special chars path due to Windows compa…
aaliddell Jan 15, 2023
d7b0490
Apply buildifier
aaliddell Jan 15, 2023
1ff4d46
Add bzl_library build targets.
gonzojive Feb 1, 2023
74c8c66
Bump min Bazel version to 5.3.0, closes #230
aaliddell Mar 5, 2023
cd1d816
Exclude D rules from MacOS at lang rather than rule level
aaliddell Mar 5, 2023
ce4d886
Merge pull request #247 from gonzojive/bzl-library
aaliddell Mar 5, 2023
59392b1
Reorder deps to pass Rulegen Diff check
atavakoliyext Mar 7, 2023
5d63249
Merge pull request #243 from yext/4.3.0-yext
aaliddell Mar 7, 2023
183e202
Replace remaining names of grpc gateway
aaliddell Mar 7, 2023
a95dceb
Export proto_compile, see #240
aaliddell Mar 22, 2023
ffb8b5f
Add untested workflow to publish release assets
aaliddell Mar 22, 2023
092451c
Fix capitalization on Objective-C outputs
danny-skydio Apr 6, 2023
b4bc48d
Merge pull request #253 from danny-skydio/master
aaliddell May 3, 2023
41a08bf
Update protoc-gen-validate
aaliddell May 3, 2023
9635a14
Update release URL in test workspace
aaliddell May 3, 2023
ad48699
Add changelog
aaliddell May 3, 2023
dadb0d1
Merge branch 'dev' of github.com:rules-proto-grpc/rules_proto_grpc in…
aaliddell May 3, 2023
eca206a
Extend objc test workspace
aaliddell May 3, 2023
2e710c9
Update readme
aaliddell May 3, 2023
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
1 change: 0 additions & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ tasks:
- "//c/..."
- "//cpp/..."
- "//csharp/..."
- "//d/..."
- "//doc/..."
- "//fsharp/..."
- "//go/..."
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/publish-release-assets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Release Assets

on:
release:
types: [published]

jobs:
publish:
name: Publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Env
run: |
REPO_NAME=$(echo ${GITHUB_REPOSITORY?missing} | cut -d "/" -f 2)
FILE_STEM=${REPO_NAME?mising}-${GITHUB_REF_NAME?missing}
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')
echo "REPO_NAME=${REPO_NAME}" >> $GITHUB_ENV
echo "FILE_STEM=${FILE_STEM}" >> $GITHUB_ENV
echo "FILE_NAME=${FILE_STEM}.tar.gz" >> $GITHUB_ENV
echo "UPLOAD_URL=${UPLOAD_URL}" >> $GITHUB_ENV
- name: Build Assets
run: |
git archive --format=tar --prefix="${FILE_STEM?missing}/" "${GITHUB_REF_NAME?missing}" | gzip --best > "${FILE_NAME?missing}"
echo "Asset SHA256: $(sha256sum ${FILE_NAME?missing})" >> $GITHUB_STEP_SUMMARY
- name: Upload Assets to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: ./${{ env.FILE_NAME }}
asset_name: ${{ env.FILE_NAME }}
asset_content_type: application/gzip
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "defs",
srcs = ["defs.bzl"],
visibility = ["//visibility:public"],
deps = [
"//internal",
],
)
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@

## Announcements 📣

#### 2023/05/03 - Version 4.4.0

[Version 4.4.0 has been released](https://github.com/rules-proto-grpc/rules_proto_grpc/releases/tag/4.4.0),
which mainly contains fixes for build edge-cases and wider compatibility

#### 2022/12/04 - Version 4.3.0

[Version 4.3.0 has been released](https://github.com/rules-proto-grpc/rules_proto_grpc/releases/tag/4.3.0),
Expand Down
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ load("//grpc-gateway:repositories.bzl", "gateway_repos")

gateway_repos()

load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")

go_repositories()

Expand Down Expand Up @@ -235,7 +235,7 @@ load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "rules_proto_grpc_py3_deps",
python_interpreter = "python3",
requirements = "@rules_proto_grpc//python:requirements.txt",
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
)

load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")
Expand Down
7 changes: 6 additions & 1 deletion defs.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Top level definition exports for rules_proto_grpc."""

load("//internal:common.bzl", _bazel_build_rule_common_attrs = "bazel_build_rule_common_attrs")
load("//internal:compile.bzl", _proto_compile_attrs = "proto_compile_attrs", _proto_compile_impl = "proto_compile_impl")
load("//internal:compile.bzl", _proto_compile = "proto_compile", _proto_compile_attrs = "proto_compile_attrs", _proto_compile_impl = "proto_compile_impl")
load("//internal:filter_files.bzl", _filter_files = "filter_files")
load("//internal:plugin.bzl", _proto_plugin = "proto_plugin")
load("//internal:providers.bzl", _ProtoCompileInfo = "ProtoCompileInfo", _ProtoPluginInfo = "ProtoPluginInfo")
Expand All @@ -17,6 +17,11 @@ proto_plugin = _proto_plugin
proto_compile_attrs = _proto_compile_attrs
proto_compile_impl = _proto_compile_impl

# Export compilation function, which can be wrapped by external rules that need more
# pre-configuration than proto_compile_impl alone allows. e.g third party versions of
# doc_template_compile_impl-like rules
proto_compile = _proto_compile

# Export utils
bazel_build_rule_common_attrs = _bazel_build_rule_common_attrs
filter_files = _filter_files
34 changes: 34 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,40 @@
Changelog
=========

4.4.0
-----

General
*******

- Increased minimum supported Bazel version from 5.0.0 to 5.3.0.
`#230 <https://github.com/rules-proto-grpc/rules_proto_grpc/issues/230>`__
- Added support for param file for excess arguments, which allows for longer commands lines without
failure
- Fixed Windows incompatibility due to test workspace containing quote character in path
- The `proto_compile` function is now exported in the public `defs.bzl` for use in external rules
- Added static release assets generation, which will change the format of the download URL to use in
your WORKSPACE. See the sample installation docs for the new URL

Go
**

- Updated ``github.com/envoyproxy/protoc-gen-validate`` to 1.0.0

grpc-gateway
************

- **WORKSPACE update needed**: Renamed ``grpc-gateway`` repository name from
``grpc_ecosystem_grpc_gateway`` to ``com_github_grpc_ecosystem_grpc_gateway_v2``, to match the
naming used by Gazelle. You may need to update your WORKSPACE file to use the new name

Objective-C
***********

- Fixed expected naming of output files for proto files containing numbers in file name.
`#253 <https://github.com/rules-proto-grpc/rules_proto_grpc/pull/253>`__


4.3.0
-----

Expand Down
6 changes: 3 additions & 3 deletions docs/lang/grpc-gateway.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
version = "1.17.1",
)

load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")

go_repositories()

Expand Down Expand Up @@ -164,7 +164,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
version = "1.17.1",
)

load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")

go_repositories()

Expand Down Expand Up @@ -272,7 +272,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
version = "1.17.1",
)

load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")

go_repositories()

Expand Down
4 changes: 2 additions & 2 deletions docs/lang/python.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
pip_parse(
name = "rules_proto_grpc_py3_deps",
python_interpreter = "python3",
requirements = "@rules_proto_grpc//python:requirements.txt",
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
)

load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")
Expand Down Expand Up @@ -571,7 +571,7 @@ Full example project can be found `here <https://github.com/rules-proto-grpc/rul
pip_parse(
name = "rules_proto_grpc_py3_deps",
python_interpreter = "python3",
requirements = "@rules_proto_grpc//python:requirements.txt",
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
)

load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")
Expand Down
2 changes: 1 addition & 1 deletion example/grpc-gateway/gateway_grpc_compile/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ go_register_toolchains(
version = "1.17.1",
)

load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")

go_repositories()

Expand Down
2 changes: 1 addition & 1 deletion example/grpc-gateway/gateway_grpc_library/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ go_register_toolchains(
version = "1.17.1",
)

load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")

go_repositories()

Expand Down
2 changes: 1 addition & 1 deletion example/grpc-gateway/gateway_openapiv2_compile/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ go_register_toolchains(
version = "1.17.1",
)

load("@grpc_ecosystem_grpc_gateway//:repositories.bzl", "go_repositories")
load("@com_github_grpc_ecosystem_grpc_gateway_v2//:repositories.bzl", "go_repositories")

go_repositories()

Expand Down
2 changes: 1 addition & 1 deletion example/python/python_grpclib_compile/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "rules_proto_grpc_py3_deps",
python_interpreter = "python3",
requirements = "@rules_proto_grpc//python:requirements.txt",
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
)

load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")
Expand Down
2 changes: 1 addition & 1 deletion example/python/python_grpclib_library/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ load("@rules_python//python:pip.bzl", "pip_parse")
pip_parse(
name = "rules_proto_grpc_py3_deps",
python_interpreter = "python3",
requirements = "@rules_proto_grpc//python:requirements.txt",
requirements_lock = "@rules_proto_grpc//python:requirements.txt",
)

load("@rules_proto_grpc_py3_deps//:requirements.bzl", "install_deps")
Expand Down
10 changes: 5 additions & 5 deletions go/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ def go_repos(**kwargs): # buildifier: disable=function-docstring
go_repository(
name = "com_github_envoyproxy_protoc_gen_validate",
importpath = "github.com/envoyproxy/protoc-gen-validate",
sum = "h1:wyv+mWIshClA4g6hTlKD9xb6fiNAnDu3+8qYf7KSuSE=",
version = "v0.9.0",
sum = "h1:FPFO7LWZ2pfphahSUMX8L5p/6FqSzRYRxq6V74eG8ZI=",
version = "v1.0.0",
)

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

go_repository(
Expand Down
4 changes: 2 additions & 2 deletions grpc-gateway/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ proto_plugin(
],
options = ["paths=source_relative"],
outputs = ["{protopath}.pb.gw.go"],
tool = "@grpc_ecosystem_grpc_gateway//protoc-gen-grpc-gateway",
tool = "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway",
visibility = ["//visibility:public"],
)

Expand All @@ -23,6 +23,6 @@ proto_plugin(
quirks = [
"QUIRK_DIRECT_MODE",
],
tool = "@grpc_ecosystem_grpc_gateway//protoc-gen-openapiv2",
tool = "@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2",
visibility = ["//visibility:public"],
)
2 changes: 1 addition & 1 deletion grpc-gateway/example/gateway/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ go_library(
deps = [
"//grpc-gateway/example/api:go_default_library",
"@com_github_golang_glog//:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
"@go_googleapis//google/rpc:errdetails_go_proto",
"@grpc_ecosystem_grpc_gateway//runtime:go_default_library",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//connectivity:go_default_library",
],
Expand Down
4 changes: 2 additions & 2 deletions grpc-gateway/gateway_grpc_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ GATEWAY_DEPS = [
"@org_golang_google_protobuf//proto:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//metadata:go_default_library",
"@grpc_ecosystem_grpc_gateway//runtime:go_default_library",
"@grpc_ecosystem_grpc_gateway//utilities:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
]
4 changes: 2 additions & 2 deletions grpc-gateway/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

load(
"//:repositories.bzl",
"grpc_ecosystem_grpc_gateway",
"com_github_grpc_ecosystem_grpc_gateway_v2",
)
load("//go:repositories.bzl", "go_repos")

def gateway_repos(**kwargs): # buildifier: disable=function-docstring
go_repos(**kwargs)
grpc_ecosystem_grpc_gateway(**kwargs)
com_github_grpc_ecosystem_grpc_gateway_v2(**kwargs)
17 changes: 17 additions & 0 deletions internal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

bzl_library(
name = "internal",
srcs = [
"common.bzl",
"compile.bzl",
"filter_files.bzl",
"plugin.bzl",
"protoc.bzl",
"providers.bzl",
],
visibility = ["//:__subpackages__"],
deps = [
"@rules_proto//proto:defs",
],
)
46 changes: 41 additions & 5 deletions internal/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def pascal_objc(s):
"""
Convert pascal_case -> PascalCase

Objective C uses pascal case, but there are e exceptions that it uppercases
the entire segment: url, http, and https.
Objective C uses pascal case, but there are exceptions that it uppercases.
For example, it will uppercase the words "url", "http", and "https".

https://github.com/protocolbuffers/protobuf/blob/54176b26a9be6c9903b375596b778f51f5947921/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc#L91

Expand All @@ -78,14 +78,50 @@ def pascal_objc(s):
s = s.replace("-", "_")

segments = []
for segment in s.split("_"):
current = ""
last_char_was_number = False
last_char_was_lower = False
last_char_was_upper = False
for char in s.elems():
if char.isdigit():
if last_char_was_number:
segments.append(current)
current = ""
current += char
last_char_was_number = True
last_char_was_lower = False
last_char_was_upper = False
elif char.islower():
if not last_char_was_lower and not last_char_was_upper:
segments.append(current)
current = ""
current += char
last_char_was_number = False
last_char_was_lower = True
last_char_was_upper = False
elif char.isupper():
if not last_char_was_upper:
segments.append(current)
current = ""
current += char.lower()
last_char_was_number = False
last_char_was_lower = False
last_char_was_upper = True
else:
last_char_was_number = False
last_char_was_lower = False
last_char_was_upper = False
segments.append(current)

new_segments = []
for segment in segments:
repl = _objc_upper_segments.get(segment)
if repl:
segment = repl
else:
segment = capitalize(segment)
segments.append(segment)
return "".join(segments)
new_segments.append(segment)
return "".join(new_segments)

def pascal_case(s):
"""
Expand Down
2 changes: 2 additions & 0 deletions internal/compile.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ def proto_compile(ctx, options, extra_protoc_args, extra_protoc_files):
extra_protoc_args = extra_protoc_args,
)
args = ctx.actions.args()
args.set_param_file_format("multiline")
args.use_param_file("@%s", use_always = False)
args.add_all(args_list)

# Add import roots and files if required by plugin
Expand Down
Loading