Skip to content

Commit 70f9a3c

Browse files
A GooglerBlaze Rules Copybara
authored andcommitted
Internal functionality
PiperOrigin-RevId: 700275113
1 parent 7b562c4 commit 70f9a3c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/unittest.bzl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ def _make_analysis_test(
227227
fragments = [],
228228
config_settings = {},
229229
extra_target_under_test_aspects = [],
230+
target_under_test_for_dependency_resolution = False,
230231
doc = ""):
231232
"""Creates an analysis test rule from its implementation function.
232233
@@ -267,6 +268,9 @@ def _make_analysis_test(
267268
flags in a single build
268269
extra_target_under_test_aspects: An optional list of aspects to apply to the target_under_test
269270
in addition to those set up by default for the test harness itself.
271+
target_under_test_for_dependency_resolution: If true, the target_under_test will be used for
272+
dependency resolution. See
273+
https://bazel.build/rules/lib/toplevel/attr#label.for_dependency_resolution for more info.
270274
doc: A description of the rule that can be extracted by documentation generating tools.
271275
272276
Returns:
@@ -287,6 +291,9 @@ def _make_analysis_test(
287291
)
288292
target_attr_kwargs["cfg"] = test_transition
289293

294+
if target_under_test_for_dependency_resolution:
295+
target_attr_kwargs["for_dependency_resolution"] = True
296+
290297
attrs["target_under_test"] = attr.label(
291298
aspects = [_action_retrieving_aspect] + extra_target_under_test_aspects,
292299
mandatory = True,

0 commit comments

Comments
 (0)