protoc-gen-validate icon indicating copy to clipboard operation
protoc-gen-validate copied to clipboard

Bazel WORKSPACE forces downstream projects to explicitly enumerate protoc-gen-validate's dependencies

Open gnossen opened this issue 6 years ago • 5 comments

Related: https://github.com/envoyproxy/protoc-gen-validate/issues/136 Related: https://github.com/grpc/grpc/issues/19835

It is standard practice to leave direct invocations of repository rules out of one's WORKSPACE file and instead to farm them off to a separate .bzl containing a PROJECT_deps() macro (i.e. protoc_gen_validate_deps()) that downstream projects can use to consume all dependencies without explicitly enumerating all transitive dependencies.

I'm willing to put up a PR to resolve this issue if the maintainers are amenable to the change.

gnossen avatar Aug 02 '19 20:08 gnossen

@akonradi

gnossen avatar Aug 02 '19 21:08 gnossen

Thanks for the info! I have no complaints here, but defer to @akonradi or someone more experienced with Bazel to comment.

rodaine avatar Aug 02 '19 21:08 rodaine

@gnossen Thanks, I don't use Bazel much in OSS land so I wasn't aware of this particular wart. Happy to review a PR to fix this.

akonradi avatar Aug 02 '19 21:08 akonradi

@gnossen Does #258 address this sufficiently?

akonradi avatar Aug 08 '19 14:08 akonradi

I think the following is related to this issue.

I have the following in WORKSPACE:

http_archive(
    name = "com_envoyproxy_protoc_gen_validate",
    sha256 = "4c692c62e16c168049bca2b2972b0a25222870cf53e61be30b50d761e58728bd",
    strip_prefix = "protoc-gen-validate-0.6.7",
    urls = [
        "https://github.com/envoyproxy/protoc-gen-validate/archive/refs/tags/v0.6.7.tar.gz",
    ],
)

# Load the dependencies of PGV. This is required for the next step to work.
load("@com_envoyproxy_protoc_gen_validate//bazel:repositories.bzl", "pgv_dependencies")

pgv_dependencies()

# Perform any necessary actions to initialize dependencies.
load("@com_envoyproxy_protoc_gen_validate//bazel:dependency_imports.bzl", "pgv_dependency_imports")

pgv_dependency_imports()

load("@com_envoyproxy_protoc_gen_validate//:dependencies.bzl", "go_third_party")

go_third_party()

But the following error is hit:

	File "/home/nyap/.cache/bazel/_bazel_nyap/0205f642c591b57580b66c4cefe4a908/external/com_envoyproxy_protoc_gen_validate/bazel/dependency_imports.bzl", line 5, column 40, in <toplevel>
		load("@rules_python//python:pip.bzl", "pip_install")
Error: file '@rules_python//python:pip.bzl' does not contain symbol 'pip_install'

noel-yap avatar Jul 19 '22 19:07 noel-yap