| load("@bazel_gazelle//:def.bzl", "gazelle") |
| load("@rules_python//gazelle:def.bzl", "GAZELLE_PYTHON_RUNTIME_DEPS") |
| load("@rules_python//gazelle/manifest:defs.bzl", "gazelle_python_manifest") |
| load("@rules_python//python:defs.bzl", "py_library") |
| |
| # Gazelle python extension needs a manifest file mapping from |
| # an import to the installed package that provides it. |
| # This macro produces two targets: |
| # - //:gazelle_python_manifest.update can be used with `bazel run` |
| # to recalculate the manifest |
| # - //:gazelle_python_manifest.test is a test target ensuring that |
| # the manifest doesn't need to be updated |
| gazelle_python_manifest( |
| name = "gazelle_python_manifest", |
| modules_mapping = "@modules_map//:modules_mapping.json", |
| pip_deps_repository_name = "pip", |
| requirements = "//:requirements_lock.txt", |
| ) |
| |
| # Our gazelle target points to the python gazelle binary. |
| # This is the simple case where we only need one language supported. |
| # If you also had proto, go, or other gazelle-supported languages, |
| # you would also need a gazelle_binary rule. |
| # See https://github.com/bazelbuild/bazel-gazelle/blob/master/extend.rst#example |
| gazelle( |
| name = "gazelle", |
| data = GAZELLE_PYTHON_RUNTIME_DEPS, |
| gazelle = "@rules_python//gazelle:gazelle_python_binary", |
| ) |
| |
| # This rule is auto-generated and managed by Gazelle, |
| # because it found the __init__.py file in this folder. |
| py_library( |
| name = "build_file_generation", |
| srcs = ["__init__.py"], |
| visibility = ["//:__subpackages__"], |
| ) |