Skip to content

Commit 76117b4

Browse files
rickeylevcopybara-github
authored andcommitted
python: expose more helpers to make Starlark rules work outside of builtins
These are necessary for deeper and more correct integration between C++ and Python, which is predominately used within the Google implementation. PiperOrigin-RevId: 577004134 Change-Id: I31afe7993492c9ebbc12e9bed7aa42667ab99aaf
1 parent ec354f4 commit 76117b4

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/main/starlark/builtins_bzl/common/python/py_internal.bzl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ def _cc_semantics_get_runtimes_toolchain(*args, **kwargs):
4444
def _cc_semantics_get_stl(*args, **kwargs):
4545
return cc_semantics.get_stl(*args, **kwargs)
4646

47+
def _cc_toolchain_strip_files(cc_toolchain, *args, **kwargs):
48+
return cc_toolchain.strip_files(*args, **kwargs)
49+
50+
def _cc_launcher_info_cc_info(cc_launcher_info, *args, **kwargs):
51+
return cc_launcher_info.cc_info(*args, **kwargs)
52+
4753
def _compilation_outputs(cc_launcher_info):
4854
return cc_launcher_info.compilation_outputs()
4955

@@ -71,6 +77,9 @@ def _declare_shareable_artifact(ctx, *args, **kwargs):
7177
def _expand_location_and_make_variables(*args, **kwargs):
7278
return _py_builtins.expand_location_and_make_variables(*args, **kwargs)
7379

80+
def _extra_libraries_build_libraries(extra_libraries, *args, **kwargs):
81+
return extra_libraries.build_libraries(*args, **kwargs)
82+
7483
def _get_current_os_name(*args, **kwargs):
7584
return _py_builtins.get_current_os_name(*args, **kwargs)
7685

@@ -101,6 +110,12 @@ def _runfiles_enabled(ctx):
101110
def _link(*args, **kwargs):
102111
return cc_common.link(*args, **kwargs)
103112

113+
def _linking_context_extra_link_time_libraries(linking_context, *args, **kwargs):
114+
return linking_context.extra_link_time_libraries(*args, **kwargs)
115+
116+
def _linking_context_linkstamps(linking_context, *args, **kwargs):
117+
return linking_context.linkstamps(*args, **kwargs)
118+
104119
def _make_runfiles_respect_legacy_external_runfiles(*args, **kwargs):
105120
return _py_builtins.make_runfiles_respect_legacy_external_runfiles(*args, **kwargs)
106121

@@ -129,9 +144,11 @@ py_internal = struct(
129144
add_py_extra_pseudo_action = _add_py_extra_pseudo_action,
130145
are_action_listeners_enabled = _are_action_listeners_enabled,
131146
cc_helper = cc_helper,
147+
cc_launcher_info_cc_info = _cc_launcher_info_cc_info,
132148
cc_semantics_get_cc_runtimes = _cc_semantics_get_cc_runtimes,
133149
cc_semantics_get_runtimes_toolchain = _cc_semantics_get_runtimes_toolchain,
134150
cc_semantics_get_stl = _cc_semantics_get_stl,
151+
cc_toolchain_strip_files = _cc_toolchain_strip_files,
135152
compilation_outputs = _compilation_outputs,
136153
compile = _compile,
137154
copy_without_caching = _copy_without_caching,
@@ -141,6 +158,7 @@ py_internal = struct(
141158
declare_constant_metadata_file = _declare_constant_metadata_file,
142159
declare_shareable_artifact = _declare_shareable_artifact,
143160
expand_location_and_make_variables = _expand_location_and_make_variables,
161+
extra_libraries_build_libraries = _extra_libraries_build_libraries,
144162
get_current_os_name = _get_current_os_name,
145163
get_label_repo_runfiles_path = _get_label_repo_runfiles_path,
146164
get_legacy_external_runfiles = _get_legacy_external_runfiles,
@@ -150,6 +168,8 @@ py_internal = struct(
150168
is_singleton_depset = _is_singleton_depset,
151169
is_tool_configuration = _is_tool_configuration,
152170
link = _link,
171+
linking_context_extra_link_time_libraries = _linking_context_extra_link_time_libraries,
172+
linking_context_linkstamps = _linking_context_linkstamps,
153173
make_runfiles_respect_legacy_external_runfiles = _make_runfiles_respect_legacy_external_runfiles,
154174
merge_debug_context = _merge_debug_context,
155175
merge_linking_contexts = _merge_linking_contexts,

0 commit comments

Comments
 (0)