Skip to content
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

Add protoc-gen-validate 1.0.4.bcr.2 #3423

Merged
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
87 changes: 87 additions & 0 deletions modules/protoc-gen-validate/1.0.4.bcr.2/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
module(
name = "protoc-gen-validate",
version = "1.0.4.bcr.2",
compatibility_level = 1,
repo_name = "com_envoyproxy_protoc_gen_validate",
)

bazel_dep(
name = "bazel_skylib",
version = "1.4.2",
)
bazel_dep(
name = "gazelle",
version = "0.33.0",
repo_name = "bazel_gazelle",
)
bazel_dep(
name = "protobuf",
version = "23.1",
repo_name = "com_google_protobuf",
)
bazel_dep(
name = "re2",
version = "2021-09-01",
repo_name = "com_googlesource_code_re2",
)
bazel_dep(
name = "rules_cc",
version = "0.0.9",
)
bazel_dep(
name = "rules_go",
version = "0.42.0",
repo_name = "io_bazel_rules_go",
)
bazel_dep(
name = "rules_java",
version = "5.5.0",
)
bazel_dep(
name = "rules_proto",
version = "5.3.0-21.7",
)
bazel_dep(
name = "rules_python",
version = "0.40.0",
)
# -- bazel_dep definitions -- #

go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
go_sdk.download(version = "1.21.1")

go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"com_github_iancoleman_strcase",
"com_github_lyft_protoc_gen_star_v2",
"org_golang_google_protobuf",
"org_golang_x_net",
)

PYTHON_VERSIONS = [
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
]
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
[
python.toolchain(
is_default = python_version == PYTHON_VERSIONS[-1],
python_version = python_version,
)
for python_version in PYTHON_VERSIONS
]
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
[
pip.parse(
hub_name = "pgv_pip_deps",
python_version = python_version,
requirements_lock = "//python:requirements.txt",
)
for python_version in PYTHON_VERSIONS
]
use_repo(pip, "pgv_pip_deps")
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
--- a/MODULE.bazel
+++ a/MODULE.bazel
@@ -0,0 +1,87 @@
+module(
+ name = "protoc-gen-validate",
+ version = "1.0.4.bcr.2",
+ compatibility_level = 1,
+ repo_name = "com_envoyproxy_protoc_gen_validate",
+)
+
+bazel_dep(
+ name = "bazel_skylib",
+ version = "1.4.2",
+)
+bazel_dep(
+ name = "gazelle",
+ version = "0.33.0",
+ repo_name = "bazel_gazelle",
+)
+bazel_dep(
+ name = "protobuf",
+ version = "23.1",
+ repo_name = "com_google_protobuf",
+)
+bazel_dep(
+ name = "re2",
+ version = "2021-09-01",
+ repo_name = "com_googlesource_code_re2",
+)
+bazel_dep(
+ name = "rules_cc",
+ version = "0.0.9",
+)
+bazel_dep(
+ name = "rules_go",
+ version = "0.42.0",
+ repo_name = "io_bazel_rules_go",
+)
+bazel_dep(
+ name = "rules_java",
+ version = "5.5.0",
+)
+bazel_dep(
+ name = "rules_proto",
+ version = "5.3.0-21.7",
+)
+bazel_dep(
+ name = "rules_python",
+ version = "0.40.0",
+)
+# -- bazel_dep definitions -- #
+
+go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
+go_sdk.download(version = "1.21.1")
+
+go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
+go_deps.from_file(go_mod = "//:go.mod")
+use_repo(
+ go_deps,
+ "com_github_iancoleman_strcase",
+ "com_github_lyft_protoc_gen_star_v2",
+ "org_golang_google_protobuf",
+ "org_golang_x_net",
+)
+
+PYTHON_VERSIONS = [
+ "3.9",
+ "3.10",
+ "3.11",
+ "3.12",
+ "3.13",
+]
+python = use_extension("@rules_python//python/extensions:python.bzl", "python")
+[
+ python.toolchain(
+ is_default = python_version == PYTHON_VERSIONS[-1],
+ python_version = python_version,
+ )
+ for python_version in PYTHON_VERSIONS
+]
+pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
+[
+ pip.parse(
+ hub_name = "pgv_pip_deps",
+ python_version = python_version,
+ requirements_lock = "//python:requirements.txt",
+ )
+ for python_version in PYTHON_VERSIONS
+]
+use_repo(pip, "pgv_pip_deps")
86 changes: 86 additions & 0 deletions modules/protoc-gen-validate/1.0.4.bcr.2/patches/pgv.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
commit 75c9584947a9cc8d2cb6c1ccf7a68eabff0ffa44
Author: maleo <[email protected]>
Date: Sun Dec 15 10:58:54 2024 +0000

BCR

diff --git a/bazel/protobuf.bzl b/bazel/protobuf.bzl
index 62f0869..4bed39d 100644
--- a/bazel/protobuf.bzl
+++ b/bazel/protobuf.bzl
@@ -96,7 +96,7 @@ def _protoc_gen_validate_impl(ctx, lang, protos, out_files, protoc_args, package
use_default_shell_env = True,
)

- return struct(
+ return DefaultInfo(
files = depset(out_files),
)

diff --git a/python/BUILD b/python/BUILD
index bf99c5f..268e4ad 100644
--- a/python/BUILD
+++ b/python/BUILD
@@ -3,6 +3,7 @@ load("@pgv_pip_deps//:requirements.bzl", "all_requirements")

exports_files([
"requirements.in",
+ "requirements.txt",
"setup.cfg",
])

diff --git a/python/requirements.txt b/python/requirements.txt
new file mode 100644
index 0000000..866d40b
--- /dev/null
+++ b/python/requirements.txt
@@ -0,0 +1,20 @@
+#
+# This file is autogenerated by pip-compile with Python 3.11
+# by the following command:
+#
+# pip-compile --output-file=requirements.txt requirements.in
+#
+astunparse==1.6.3
+ # via -r requirements.in
+jinja2==3.1.3
+ # via -r requirements.in
+markupsafe==2.1.5
+ # via jinja2
+protobuf==5.26.0
+ # via -r requirements.in
+six==1.16.0
+ # via astunparse
+validate-email==1.3
+ # via -r requirements.in
+wheel==0.43.0
+ # via astunparse
\ No newline at end of file
diff --git a/templates/cc/register.go b/templates/cc/register.go
index da773fc..dc0ae35 100644
--- a/templates/cc/register.go
+++ b/templates/cc/register.go
@@ -117,6 +117,10 @@ func CcFilePath(f pgs.File, ctx pgsgo.Context, tpl *template.Template) *pgs.File
func (fns CCFuncs) methodName(name interface{}) string {
nameStr := fmt.Sprintf("%s", name)
switch nameStr {
+ case "concept":
+ return "concept_"
+ case "requires":
+ return "requires_"
case "const":
return "const_"
case "inline":
diff --git a/validate/BUILD b/validate/BUILD
index a9d38c5..203beb4 100644
--- a/validate/BUILD
+++ b/validate/BUILD
@@ -28,7 +28,7 @@ cc_proto_library(
py_proto_library(
name = "validate_py",
srcs = ["validate.proto"],
- deps = ["@com_google_protobuf//:protobuf_python"],
+ deps = [],
)

go_proto_library(
20 changes: 20 additions & 0 deletions modules/protoc-gen-validate/1.0.4.bcr.2/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
matrix:
platform:
- debian10
- ubuntu2004
- windows
bazel:
- 7.x
- 8.x
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_flags:
- '--cxxopt=-std=c++14'
build_targets:
- '@protoc-gen-validate//bazel/go:pgv_plugin_go'
- '@protoc-gen-validate//validate:cc_validate'
- '@protoc-gen-validate//validate:go_default_library'
- '@protoc-gen-validate//validate:validate_proto'
10 changes: 10 additions & 0 deletions modules/protoc-gen-validate/1.0.4.bcr.2/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"url": "https://github.com/bufbuild/protoc-gen-validate/archive/refs/tags/v1.0.4.tar.gz",
"integrity": "sha256-kuKcIVBnXOlUyWW8qlWcqURwS3VxFTPP4DzlQdz1od0=",
"strip_prefix": "protoc-gen-validate-1.0.4",
"patches": {
"pgv.patch": "sha256-FELPsYok9OMFZxKEWLGj8nXG3nxOYFLt8IB7Ggi7yqk=",
"module_dot_bazel.patch": "sha256-LkNtOkQh2M+VZ1C1Zcez8ekFNgnTv8nCFxSHa3Fv0HU="
},
"patch_strip": 1
}
3 changes: 2 additions & 1 deletion modules/protoc-gen-validate/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
],
"versions": [
"1.0.4",
"1.0.4.bcr.1"
"1.0.4.bcr.1",
"1.0.4.bcr.2"
],
"yanked_versions": {}
}
Loading