Skip to content

Commit 3fcd398

Browse files
committed
Add protoc-gen-validate 1.0.4.bcr.2
This returns DefaultInfo in rules instead of a plain struct().
1 parent 08b05bb commit 3fcd398

File tree

6 files changed

+295
-1
lines changed

6 files changed

+295
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
module(
2+
name = "protoc-gen-validate",
3+
version = "1.0.4.bcr.2",
4+
compatibility_level = 1,
5+
repo_name = "com_envoyproxy_protoc_gen_validate",
6+
)
7+
8+
bazel_dep(
9+
name = "bazel_skylib",
10+
version = "1.4.2",
11+
)
12+
bazel_dep(
13+
name = "gazelle",
14+
version = "0.33.0",
15+
repo_name = "bazel_gazelle",
16+
)
17+
bazel_dep(
18+
name = "protobuf",
19+
version = "23.1",
20+
repo_name = "com_google_protobuf",
21+
)
22+
bazel_dep(
23+
name = "re2",
24+
version = "2021-09-01",
25+
repo_name = "com_googlesource_code_re2",
26+
)
27+
bazel_dep(
28+
name = "rules_cc",
29+
version = "0.0.9",
30+
)
31+
bazel_dep(
32+
name = "rules_go",
33+
version = "0.42.0",
34+
repo_name = "io_bazel_rules_go",
35+
)
36+
bazel_dep(
37+
name = "rules_java",
38+
version = "5.5.0",
39+
)
40+
bazel_dep(
41+
name = "rules_proto",
42+
version = "5.3.0-21.7",
43+
)
44+
bazel_dep(
45+
name = "rules_python",
46+
version = "0.40.0",
47+
)
48+
# -- bazel_dep definitions -- #
49+
50+
go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
51+
go_sdk.download(version = "1.21.1")
52+
53+
go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
54+
go_deps.from_file(go_mod = "//:go.mod")
55+
use_repo(
56+
go_deps,
57+
"com_github_iancoleman_strcase",
58+
"com_github_lyft_protoc_gen_star_v2",
59+
"org_golang_google_protobuf",
60+
"org_golang_x_net",
61+
)
62+
63+
PYTHON_VERSIONS = [
64+
"3.9",
65+
"3.10",
66+
"3.11",
67+
"3.12",
68+
"3.13",
69+
]
70+
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
71+
[
72+
python.toolchain(
73+
is_default = python_version == PYTHON_VERSIONS[-1],
74+
python_version = python_version,
75+
)
76+
for python_version in PYTHON_VERSIONS
77+
]
78+
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
79+
[
80+
pip.parse(
81+
hub_name = "pgv_pip_deps",
82+
python_version = python_version,
83+
requirements_lock = "//python:requirements.txt",
84+
)
85+
for python_version in PYTHON_VERSIONS
86+
]
87+
use_repo(pip, "pgv_pip_deps")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
--- a/MODULE.bazel
2+
+++ a/MODULE.bazel
3+
@@ -0,0 +1,87 @@
4+
+module(
5+
+ name = "protoc-gen-validate",
6+
+ version = "1.0.4.bcr.2",
7+
+ compatibility_level = 1,
8+
+ repo_name = "com_envoyproxy_protoc_gen_validate",
9+
+)
10+
+
11+
+bazel_dep(
12+
+ name = "bazel_skylib",
13+
+ version = "1.4.2",
14+
+)
15+
+bazel_dep(
16+
+ name = "gazelle",
17+
+ version = "0.33.0",
18+
+ repo_name = "bazel_gazelle",
19+
+)
20+
+bazel_dep(
21+
+ name = "protobuf",
22+
+ version = "23.1",
23+
+ repo_name = "com_google_protobuf",
24+
+)
25+
+bazel_dep(
26+
+ name = "re2",
27+
+ version = "2021-09-01",
28+
+ repo_name = "com_googlesource_code_re2",
29+
+)
30+
+bazel_dep(
31+
+ name = "rules_cc",
32+
+ version = "0.0.9",
33+
+)
34+
+bazel_dep(
35+
+ name = "rules_go",
36+
+ version = "0.42.0",
37+
+ repo_name = "io_bazel_rules_go",
38+
+)
39+
+bazel_dep(
40+
+ name = "rules_java",
41+
+ version = "5.5.0",
42+
+)
43+
+bazel_dep(
44+
+ name = "rules_proto",
45+
+ version = "5.3.0-21.7",
46+
+)
47+
+bazel_dep(
48+
+ name = "rules_python",
49+
+ version = "0.40.0",
50+
+)
51+
+# -- bazel_dep definitions -- #
52+
+
53+
+go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")
54+
+go_sdk.download(version = "1.21.1")
55+
+
56+
+go_deps = use_extension("@bazel_gazelle//:extensions.bzl", "go_deps")
57+
+go_deps.from_file(go_mod = "//:go.mod")
58+
+use_repo(
59+
+ go_deps,
60+
+ "com_github_iancoleman_strcase",
61+
+ "com_github_lyft_protoc_gen_star_v2",
62+
+ "org_golang_google_protobuf",
63+
+ "org_golang_x_net",
64+
+)
65+
+
66+
+PYTHON_VERSIONS = [
67+
+ "3.9",
68+
+ "3.10",
69+
+ "3.11",
70+
+ "3.12",
71+
+ "3.13",
72+
+]
73+
+python = use_extension("@rules_python//python/extensions:python.bzl", "python")
74+
+[
75+
+ python.toolchain(
76+
+ is_default = python_version == PYTHON_VERSIONS[-1],
77+
+ python_version = python_version,
78+
+ )
79+
+ for python_version in PYTHON_VERSIONS
80+
+]
81+
+pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
82+
+[
83+
+ pip.parse(
84+
+ hub_name = "pgv_pip_deps",
85+
+ python_version = python_version,
86+
+ requirements_lock = "//python:requirements.txt",
87+
+ )
88+
+ for python_version in PYTHON_VERSIONS
89+
+]
90+
+use_repo(pip, "pgv_pip_deps")
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
commit 75c9584947a9cc8d2cb6c1ccf7a68eabff0ffa44
2+
Author: maleo <[email protected]>
3+
Date: Sun Dec 15 10:58:54 2024 +0000
4+
5+
BCR
6+
7+
diff --git a/bazel/protobuf.bzl b/bazel/protobuf.bzl
8+
index 62f0869..4bed39d 100644
9+
--- a/bazel/protobuf.bzl
10+
+++ b/bazel/protobuf.bzl
11+
@@ -96,7 +96,7 @@ def _protoc_gen_validate_impl(ctx, lang, protos, out_files, protoc_args, package
12+
use_default_shell_env = True,
13+
)
14+
15+
- return struct(
16+
+ return DefaultInfo(
17+
files = depset(out_files),
18+
)
19+
20+
diff --git a/python/BUILD b/python/BUILD
21+
index bf99c5f..268e4ad 100644
22+
--- a/python/BUILD
23+
+++ b/python/BUILD
24+
@@ -3,6 +3,7 @@ load("@pgv_pip_deps//:requirements.bzl", "all_requirements")
25+
26+
exports_files([
27+
"requirements.in",
28+
+ "requirements.txt",
29+
"setup.cfg",
30+
])
31+
32+
diff --git a/python/requirements.txt b/python/requirements.txt
33+
new file mode 100644
34+
index 0000000..866d40b
35+
--- /dev/null
36+
+++ b/python/requirements.txt
37+
@@ -0,0 +1,20 @@
38+
+#
39+
+# This file is autogenerated by pip-compile with Python 3.11
40+
+# by the following command:
41+
+#
42+
+# pip-compile --output-file=requirements.txt requirements.in
43+
+#
44+
+astunparse==1.6.3
45+
+ # via -r requirements.in
46+
+jinja2==3.1.3
47+
+ # via -r requirements.in
48+
+markupsafe==2.1.5
49+
+ # via jinja2
50+
+protobuf==5.26.0
51+
+ # via -r requirements.in
52+
+six==1.16.0
53+
+ # via astunparse
54+
+validate-email==1.3
55+
+ # via -r requirements.in
56+
+wheel==0.43.0
57+
+ # via astunparse
58+
\ No newline at end of file
59+
diff --git a/templates/cc/register.go b/templates/cc/register.go
60+
index da773fc..dc0ae35 100644
61+
--- a/templates/cc/register.go
62+
+++ b/templates/cc/register.go
63+
@@ -117,6 +117,10 @@ func CcFilePath(f pgs.File, ctx pgsgo.Context, tpl *template.Template) *pgs.File
64+
func (fns CCFuncs) methodName(name interface{}) string {
65+
nameStr := fmt.Sprintf("%s", name)
66+
switch nameStr {
67+
+ case "concept":
68+
+ return "concept_"
69+
+ case "requires":
70+
+ return "requires_"
71+
case "const":
72+
return "const_"
73+
case "inline":
74+
diff --git a/validate/BUILD b/validate/BUILD
75+
index a9d38c5..203beb4 100644
76+
--- a/validate/BUILD
77+
+++ b/validate/BUILD
78+
@@ -28,7 +28,7 @@ cc_proto_library(
79+
py_proto_library(
80+
name = "validate_py",
81+
srcs = ["validate.proto"],
82+
- deps = ["@com_google_protobuf//:protobuf_python"],
83+
+ deps = [],
84+
)
85+
86+
go_proto_library(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
matrix:
2+
platform:
3+
- debian10
4+
- ubuntu2004
5+
- windows
6+
bazel:
7+
- 7.x
8+
- 8.x
9+
tasks:
10+
verify_targets:
11+
name: Verify build targets
12+
platform: ${{ platform }}
13+
bazel: ${{ bazel }}
14+
build_flags:
15+
- '--cxxopt=-std=c++14'
16+
build_targets:
17+
- '@protoc-gen-validate//bazel/go:pgv_plugin_go'
18+
- '@protoc-gen-validate//validate:cc_validate'
19+
- '@protoc-gen-validate//validate:go_default_library'
20+
- '@protoc-gen-validate//validate:validate_proto'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"url": "https://github.com/bufbuild/protoc-gen-validate/archive/refs/tags/v1.0.4.tar.gz",
3+
"integrity": "sha256-kuKcIVBnXOlUyWW8qlWcqURwS3VxFTPP4DzlQdz1od0=",
4+
"strip_prefix": "protoc-gen-validate-1.0.4",
5+
"patches": {
6+
"pgv.patch": "sha256-FELPsYok9OMFZxKEWLGj8nXG3nxOYFLt8IB7Ggi7yqk=",
7+
"module_dot_bazel.patch": "sha256-NfxGXYRoeXS7HjIGuXwaqptugPFEvYFDXiJCyu7zt08="
8+
},
9+
"patch_strip": 1
10+
}

modules/protoc-gen-validate/metadata.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
],
1212
"versions": [
1313
"1.0.4",
14-
"1.0.4.bcr.1"
14+
"1.0.4.bcr.1",
15+
"1.0.4.bcr.2"
1516
],
1617
"yanked_versions": {}
1718
}

0 commit comments

Comments
 (0)