Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal functionality #124

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/unittest.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ def _make_analysis_test(
fragments = [],
config_settings = {},
extra_target_under_test_aspects = [],
target_under_test_for_dependency_resolution = False,
doc = ""):
"""Creates an analysis test rule from its implementation function.

Expand Down Expand Up @@ -267,6 +268,9 @@ def _make_analysis_test(
flags in a single build
extra_target_under_test_aspects: An optional list of aspects to apply to the target_under_test
in addition to those set up by default for the test harness itself.
target_under_test_for_dependency_resolution: If true, the target_under_test will be used for
dependency resolution. See
https://bazel.build/rules/lib/toplevel/attr#label.for_dependency_resolution for more info.
doc: A description of the rule that can be extracted by documentation generating tools.

Returns:
Expand All @@ -287,6 +291,9 @@ def _make_analysis_test(
)
target_attr_kwargs["cfg"] = test_transition

if target_under_test_for_dependency_resolution:
target_attr_kwargs["for_dependency_resolution"] = True

attrs["target_under_test"] = attr.label(
aspects = [_action_retrieving_aspect] + extra_target_under_test_aspects,
mandatory = True,
Expand Down