-
Notifications
You must be signed in to change notification settings - Fork 582
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
Update bazel and deps #1111
base: main
Are you sure you want to change the base?
Update bazel and deps #1111
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
example-workspace |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# TODO: Add support for bzlmod | ||
common --enable_bzlmod=false |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
6.2.0 | ||
7.1.2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") | ||
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") | ||
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") | ||
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") | ||
load("@rules_python//python:pip.bzl", "pip_install") | ||
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies") | ||
load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains") | ||
load("@rules_python//python:pip.bzl", "pip_parse") | ||
|
||
def _pgv_pip_dependencies(): | ||
# This rule translates the specified requirements.in (which must be same as install_requires from setup.cfg) | ||
# into @pgv_pip_deps//:requirements.bzl. | ||
pip_install( | ||
pip_parse( | ||
name = "pgv_pip_deps", | ||
requirements = "@com_envoyproxy_protoc_gen_validate//python:requirements.in", | ||
requirements_lock = "@com_envoyproxy_protoc_gen_validate//python:requirements.txt", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the old rule was removed the new one requires a lockfile |
||
) | ||
|
||
def _pgv_go_dependencies(): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load("@bazel_features//:deps.bzl", "bazel_features_deps") | ||
load("@com_google_protobuf//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS") | ||
load("@pgv_pip_deps//:requirements.bzl", "install_deps") | ||
load("@rules_jvm_external//:defs.bzl", "maven_install") | ||
load("//:dependencies.bzl", "go_third_party") | ||
|
||
def pgv_extra_dependency_imports(): | ||
bazel_features_deps() | ||
|
||
install_deps() | ||
|
||
# gazelle:repository_macro dependencies.bzl%go_third_party | ||
go_third_party() | ||
|
||
maven_install( | ||
artifacts = PROTOBUF_MAVEN_ARTIFACTS, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is required for protobuf java code now |
||
maven_install_json = "@com_google_protobuf//:maven_install.json", | ||
repositories = [ | ||
"https://repo1.maven.org/maven2", | ||
"https://repo.maven.apache.org/maven2", | ||
], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,4 +238,5 @@ java_proto_gen_validate = rule( | |
"srcjar": "lib%{name}-src.jar", | ||
}, | ||
implementation = _java_proto_gen_validate_impl, | ||
toolchains = ["@bazel_tools//tools/jdk:toolchain_type"], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
) |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../.bazelrc |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../.bazelversion |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
load("@com_envoyproxy_protoc_gen_validate//bazel:pgv_proto_library.bzl", "pgv_cc_proto_library") | ||
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") | ||
load("@rules_python//python:proto.bzl", "py_proto_library") | ||
|
||
package( | ||
default_visibility = ["//visibility:public"], | ||
|
@@ -35,9 +35,5 @@ cc_test( | |
|
||
py_proto_library( | ||
name = "bar_py_proto", | ||
srcs = ["bar.proto"], | ||
deps = [ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. py_proto_library from rules_python now works how all the others do |
||
"@com_envoyproxy_protoc_gen_validate//validate:validate_py", | ||
"@com_google_protobuf//:protobuf_python", | ||
], | ||
deps = ["bar_proto"], | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
package io.envoyproxy.pgv; | ||
|
||
import com.google.protobuf.GeneratedMessageV3; | ||
import com.google.protobuf.Message; | ||
|
||
/** | ||
* {@code RequiredValidation} implements PGV validation for required fields. | ||
|
@@ -9,7 +9,7 @@ public final class RequiredValidation { | |
private RequiredValidation() { | ||
} | ||
|
||
public static void required(String field, GeneratedMessageV3 value) throws ValidationException { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
public static void required(String field, Message value) throws ValidationException { | ||
if (value == null) { | ||
throw new ValidationException(field, "null", "is required"); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
load("@rules_python//python:defs.bzl", "py_library") | ||
load("@pgv_pip_deps//:requirements.bzl", "all_requirements") | ||
load("@rules_python//python:defs.bzl", "py_library") | ||
load("@rules_python//python:pip.bzl", "compile_pip_requirements") | ||
|
||
exports_files([ | ||
"requirements.txt", | ||
"requirements.in", | ||
"setup.cfg", | ||
]) | ||
|
||
compile_pip_requirements( | ||
name = "requirements", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this also creates a test to make sure the lockfile is updated, so the new lockfile is slightly easier to manage with that |
||
src = "requirements.in", | ||
) | ||
|
||
py_library( | ||
name = "validator_py", | ||
srcs = glob(["**/*.py"]), | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still a bit of a mess since you cannot do some of these loads in the same bzl file where you pull in the dep, I think we'd have to create another file if we wanted to eliminate all the custom things done here.