aboutsummaryrefslogtreecommitdiff
path: root/MODULE.bazel
diff options
context:
space:
mode:
authorChi-Ju Wu <sayter99@gmail.com>2024-04-19 18:45:21 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2024-04-19 18:52:04 +0300
commitf6187b05a5eaf753faa0e29a5acd77dd0544d474 (patch)
tree17f48c8e567ce998feef40578a6989b49a2a27e1 /MODULE.bazel
parent671672b4d7994a9b07a307ae654885c7202ae886 (diff)
downloadnanopb-c-f6187b05a5eaf753faa0e29a5acd77dd0544d474.tar.gz
bazel: Migrate from WORKSPACE to bzlmod (#950)
The bazel build system is migrating to a new way of defining modules. To support this, nanopb bazel build rules have been updated. Co-authored-by: Mark Hill <markleehill@gmail.com>
Diffstat (limited to 'MODULE.bazel')
-rw-r--r--MODULE.bazel38
1 files changed, 38 insertions, 0 deletions
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 0000000..c3ce9f5
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,38 @@
+module(
+ name = "nanopb",
+ version = "0.4.9",
+)
+
+bazel_dep(name = "bazel_skylib", version = "1.5.0")
+bazel_dep(name = "rules_cc", version = "0.0.9")
+bazel_dep(name = "rules_python", version = "0.31.0")
+bazel_dep(name = "rules_proto", version = "5.3.0-21.7")
+bazel_dep(name = "protobuf", version = "23.1", repo_name = "com_google_protobuf")
+
+pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
+
+python = use_extension("@rules_python//python/extensions:python.bzl", "python")
+
+PYTHON_VERSION = "3.11"
+
+# No need for this since rules_python already creates our version.
+# python.toolchain(python_version = PYTHON_VERSION)
+use_repo(python, "python_versions")
+
+use_repo(pip, "nanopb_pypi")
+pip.parse(
+ hub_name = "nanopb_pypi",
+ python_version = PYTHON_VERSION,
+ requirements_lock = "@nanopb//:extra/requirements_lock.txt",
+)
+
+http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "rules_proto_grpc",
+ sha256 = "c0d718f4d892c524025504e67a5bfe83360b3a982e654bc71fed7514eb8ac8ad",
+ strip_prefix = "rules_proto_grpc-4.6.0",
+ urls = ["https://github.com/rules-proto-grpc/rules_proto_grpc/archive/4.6.0.tar.gz"],
+)
+
+register_toolchains("@rules_proto_grpc//protobuf:protoc_toolchain")