8000 Add gazelle_python_manifest generation to the example · bazel-contrib/rules_python@0a5f79f · GitHub
[go: up one dir, main page]

Skip to content

Commit 0a5f79f

Browse files
committed
Add gazelle_python_manifest generation to the example
1 parent c2a07ad commit 0a5f79f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

examples/bzlmod_build_file_generation/BUILD.bazel

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
load("@gazelle//:def.bzl", "gazelle")
66
load("@pip//:requirements.bzl", "all_whl_requirements")
77
load("@rules_python//gazelle:def.bzl", "GAZELLE_PYTHON_RUNTIME_DEPS")
8+
load("@rules_python//gazelle/manifest:defs.bzl", "gazelle_python_manifest")
89
load("@rules_python//gazelle/modules_mapping:def.bzl", "modules_mapping")
910
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
1011
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
@@ -30,6 +31,20 @@ modules_mapping(
3031
wheels = all_whl_requirements,
3132
)
3233

34+
# Gazelle python extension needs a manifest file mapping from
35+
# an import to the installed package that provides it.
36+
# This macro produces two targets:
37+
# - //:gazelle_python_manifest.update can be used with `bazel run`
38+
# to recalculate the manifest
39+
# - //:gazelle_python_manifest.test is a test target ensuring that
40+
# the manifest doesn't need to be updated
41+
gazelle_python_manifest(
42+
name = "gazelle_python_manifest",
43+
modules_mapping = ":modules_map",
44+
pip_repository_name = "pip",
45+
requirements = "//:requirements_lock.txt",
46+
)
47+
3348
# Our gazelle target points to the python gazelle binary.
3449
# This is the simple case where we only need one language supported.
3550
# If you also had proto, go, or other gazelle-supported languages,

0 commit comments

Comments
 (0)
0