You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Probably more a bazel / bzlmod than rules_proto_grpc question but:
How can i load the variables from protobuf_version.bzl which lives in the protobuf root-dir when this protobuf(-toolchain) was selected during rules_proto_grpc setup?
Is there any nice way of doing that? Is it even possible?
I tried use_repo(protoc, "com_google_protobuf") and some other stuff within Module.bazel but it seems i'm not understanding how this works as i'm unable to load the file.
Some background:
Setup might look like:
VERSION_PROTOBUF_TOOLCHAIN_SELECTED="$$$$$-SELECTION-$$$$$"# TO BE INJECTED BEFORE BAZEL INVOCATIONVERSION_RULES_PROTO_GRPC="5.0.0"VERSION_RULES_PYTHON="0.34.0"VERSION_PYTHON_TOOLCHAIN="3.10"bazel_dep(name="rules_proto_grpc_cpp", version=VERSION_RULES_PROTO_GRPC)
bazel_dep(name="toolchains_protoc", version="0.3.3")
# Prevent version skew by matching protoc version to protobuf version, as C++ is the only lang that# has no cross-version runtime guarantee:# https://protobuf.dev/support/cross-version-runtime-guarantee/#cppprotoc=use_extension("@toolchains_protoc//protoc:extensions.bzl", "protoc")
protoc.toolchain(
google_protobuf="com_google_protobuf",
version="v"+VERSION_PROTOBUF_TOOLCHAIN_SELECTED,
)
# Python# ------bazel_dep(name="rules_proto_grpc_python", version=VERSION_RULES_PROTO_GRPC)
bazel_dep(name="rules_python", version=VERSION_RULES_PYTHON)
python=use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version=VERSION_PYTHON_TOOLCHAIN)
and later i want to do some calculation to decide about the version of some package i'm trying to build:
Now i somehow try to access the mentioned variable PROTOC_VERSION as some kind of reflection (as the result was influenced by external pre-build variable: $$$$$-SELECTION-$$$$$).
The PROTOC_VERSION is an oversimplified example as i'm eventually trying to infer the information necessary to define version-constraints in packages build respecting Cross-Version Runtime Guarantee -> also need non 1:1 mapped values from PROTOBUF_PYTHON_VERSION.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Probably more a bazel / bzlmod than rules_proto_grpc question but:
Some background:
Setup might look like:
and later i want to do some calculation to decide about the version of some package i'm trying to build:
Now i somehow try to access the mentioned variable PROTOC_VERSION as some kind of reflection (as the result was influenced by external pre-build variable:
$$$$$-SELECTION-$$$$$
).The
PROTOC_VERSION
is an oversimplified example as i'm eventually trying to infer the information necessary to define version-constraints in packages build respecting Cross-Version Runtime Guarantee -> also need non 1:1 mapped values fromPROTOBUF_PYTHON_VERSION
.Beta Was this translation helpful? Give feedback.
All reactions