@@ -200,6 +200,13 @@ def py_executable_base_impl(ctx, *, semantics, is_test, inherited_environment =
200
200
providers = modern_providers ,
201
201
)
202
202
203
+ def _get_build_info (ctx , cc_toolchain ):
204
+ build_info_files = py_internal .cc_toolchain_build_info_files (cc_toolchain )
205
+ if cc_helper .is_stamping_enabled (ctx ):
206
+ return build_info_files .non_redacted_build_info_files .to_list ()
207
+ else :
208
+ return build_info_files .redacted_build_info_files .to_list ()
209
+
203
210
def _validate_executable (ctx ):
204
211
if ctx .attr .python_version != "PY3" :
205
212
fail ("It is not allowed to use Python 2" )
@@ -509,6 +516,7 @@ def _get_native_deps_details(ctx, *, semantics, cc_details, is_test):
509
516
is_test = is_test ,
510
517
requested_features = cc_feature_config .requested_features ,
511
518
feature_configuration = cc_feature_config .feature_configuration ,
519
+ cc_toolchain = cc_details .cc_toolchain ,
512
520
)
513
521
ctx .actions .symlink (
514
522
output = dso ,
@@ -517,19 +525,22 @@ def _get_native_deps_details(ctx, *, semantics, cc_details, is_test):
517
525
)
518
526
else :
519
527
linked_lib = dso
520
- _cc_common .link (
528
+
529
+ # The regular cc_common.link API can't be used because several
530
+ # args are private-use only; see # private comments
531
+ py_internal .link (
521
532
name = ctx .label .name ,
522
533
actions = ctx .actions ,
523
534
linking_contexts = [cc_info .linking_context ],
524
535
output_type = "dynamic_library" ,
525
- never_link = True ,
526
- native_deps = True ,
536
+ never_link = True , # private
537
+ native_deps = True , # private
527
538
feature_configuration = cc_feature_config .feature_configuration ,
528
539
cc_toolchain = cc_details .cc_toolchain ,
529
- test_only_target = is_test ,
540
+ test_only_target = is_test , # private
530
541
stamp = 1 if is_stamping_enabled (ctx , semantics ) else 0 ,
531
- main_output = linked_lib ,
532
- use_shareable_artifact_factory = True ,
542
+ main_output = linked_lib , # private
543
+ use_shareable_artifact_factory = True , # private
533
544
# NOTE: Only flags not captured by cc_info.linking_context need to
534
545
# be manually passed
535
546
user_link_flags = semantics .get_native_deps_user_link_flags (ctx ),
@@ -545,8 +556,9 @@ def _create_shared_native_deps_dso(
545
556
cc_info ,
546
557
is_test ,
547
558
feature_configuration ,
548
- requested_features ):
549
- linkstamps = cc_info .linking_context .linkstamps ()
559
+ requested_features ,
560
+ cc_toolchain ):
561
+ linkstamps = py_internal .linking_context_linkstamps (cc_info .linking_context )
550
562
551
563
partially_disabled_thin_lto = (
552
564
_cc_common .is_enabled (
@@ -570,8 +582,11 @@ def _create_shared_native_deps_dso(
570
582
for input in cc_info .linking_context .linker_inputs .to_list ()
571
583
for flag in input .user_link_flags
572
584
],
573
- linkstamps = [linkstamp .file () for linkstamp in linkstamps .to_list ()],
574
- build_info_artifacts = _cc_common .get_build_info (ctx ) if linkstamps else [],
585
+ linkstamps = [
586
+ py_internal .linkstamp_file (linkstamp )
587
+ for linkstamp in linkstamps .to_list ()
588
+ ],
589
+ build_info_artifacts = _get_build_info (ctx , cc_toolchain ) if linkstamps else [],
575
590
features = requested_features ,
576
591
is_test_target_partially_disabled_thin_lto = is_test and partially_disabled_thin_lto ,
577
592
)
0 commit comments