[WIP] Add new protoc-gen-validate module to toolshed bazel-registry #3684
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Adding protoc-gen-validate Module to Bazel Registry
Original prompt
Summary
Add a new
protoc-gen-validatemodule to the toolshed bazel-registry based on BCR version1.2.1.bcr.2, with an additional patch to fix re2 dependency labels for bzlmod compatibility.Background
Envoy is migrating dependencies to bzlmod via the toolshed bazel-registry. The
protoc-gen-validate(PGV) module in BCR uses@com_googlesource_code_re2as a repo_name alias for there2dependency, but the internal Starlark files still reference@com_googlesource_code_re2//:re2which doesn't work correctly in all bzlmod scenarios. We need to patch these to use the canonical@re2label instead.Required Changes
Create the following structure in
bazel-registry/modules/protoc-gen-validate/1.2.1.bcr.2.envoy/:1.
MODULE.bazelCopy from BCR's
1.2.1.bcr.2version but update the version string:Important: Remove the
repo_name = "com_googlesource_code_re2"from there2bazel_dep since we're patching the files to use@re2directly.2.
source.jsonBased on BCR's source.json but adding the re2 patch:
{ "url": "https://github.com/bufbuild/protoc-gen-validate/archive/refs/tags/v1.2.1.tar.gz", "integrity": "sha256-5HGDUnVN8Tk7h5K2MTOKqFYvOQ6BYHg+NlRUvBHZYyg=", "strip_prefix": "protoc-gen-validate-1.2.1", "overlay": { "MODULE.bazel": "sha256-<compute-after-creating-file>" }, "patches": { "bazel_9_fixes.patch": "sha256-bv6l2BHe/pw7Zi5HBwBloPAzIC5YxEuqlW+26Brn3fM=", "re2_label_fix.patch": "sha256-<compute-after-creating-file>" }, "patch_strip": 1 }3.
patches/bazel_9_fixes.patchCopy the existing patch from BCR (same content as BCR's 1.2.1.bcr.2):