aboutsummaryrefslogtreecommitdiff
path: root/gazelle/manifest/defs.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'gazelle/manifest/defs.bzl')
-rw-r--r--gazelle/manifest/defs.bzl37
1 files changed, 28 insertions, 9 deletions
diff --git a/gazelle/manifest/defs.bzl b/gazelle/manifest/defs.bzl
index f1266a0..f1a16c4 100644
--- a/gazelle/manifest/defs.bzl
+++ b/gazelle/manifest/defs.bzl
@@ -25,7 +25,8 @@ def gazelle_python_manifest(
pip_repository_name = "",
pip_deps_repository_name = "",
manifest = ":gazelle_python.yaml",
- use_pip_repository_aliases = False):
+ use_pip_repository_aliases = None,
+ **kwargs):
"""A macro for defining the updating and testing targets for the Gazelle manifest file.
Args:
@@ -35,10 +36,12 @@ def gazelle_python_manifest(
the manifest generator.
pip_repository_name: the name of the pip_install or pip_repository target.
use_pip_repository_aliases: boolean flag to enable using user-friendly
- python package aliases.
+ python package aliases. Defaults to True.
pip_deps_repository_name: deprecated - the old pip_install target name.
modules_mapping: the target for the generated modules_mapping.json file.
manifest: the target for the Gazelle manifest file.
+ **kwargs: other bazel attributes passed to the target target generated by
+ this macro.
"""
if pip_deps_repository_name != "":
# buildifier: disable=print
@@ -82,11 +85,23 @@ def gazelle_python_manifest(
update_target_label,
]
- if use_pip_repository_aliases:
+ # TODO @aignas 2023-10-31: When removing this code, cleanup the
+ # code in gazelle to only work with aliased targets.
+ if use_pip_repository_aliases == None:
+ update_args += [
+ "--omit-pip-repository-aliases-setting",
+ "true",
+ ]
+ elif use_pip_repository_aliases:
update_args += [
"--use-pip-repository-aliases",
"true",
]
+ else:
+ update_args += [
+ "--use-pip-repository-aliases",
+ "false",
+ ]
go_binary(
name = update_target,
@@ -102,6 +117,14 @@ def gazelle_python_manifest(
tags = ["manual"],
)
+ attrs = {
+ "env": {
+ "_TEST_MANIFEST": "$(rootpath {})".format(manifest),
+ "_TEST_MANIFEST_GENERATOR_HASH": "$(rootpath {})".format(manifest_generator_hash),
+ "_TEST_REQUIREMENTS": "$(rootpath {})".format(requirements),
+ },
+ "size": "small",
+ }
go_test(
name = "{}.test".format(name),
srcs = [Label("//manifest/test:test.go")],
@@ -110,14 +133,10 @@ def gazelle_python_manifest(
requirements,
manifest_generator_hash,
],
- env = {
- "_TEST_MANIFEST": "$(rootpath {})".format(manifest),
- "_TEST_MANIFEST_GENERATOR_HASH": "$(rootpath {})".format(manifest_generator_hash),
- "_TEST_REQUIREMENTS": "$(rootpath {})".format(requirements),
- },
rundir = ".",
deps = [Label("//manifest")],
- size = "small",
+ # kwargs could contain test-specific attributes like size or timeout
+ **dict(attrs, **kwargs)
)
native.filegroup(