Update toolchain variable definitions to allow static linking

BEGIN_PUBLIC
Update toolchain variable definitions to allow static linking

Updates the rules-based-toolchain variable definitions to reflect the how the variables are used in Bazel's CppActionConfigs.java Java implementation, particularly with respect to static linking.
END_PUBLIC

PiperOrigin-RevId: 647301605
Change-Id: I7ff87a75f9654d70ea160282ba66e99363c79ce5
This commit is contained in:
Googler 2024-06-27 06:55:22 -07:00 committed by Copybara-Service
parent 280d3ad603
commit 0d1b084cfa
1 changed files with 64 additions and 4 deletions

View File

@ -156,8 +156,15 @@ cc_variable(
cc_variable( cc_variable(
name = "libraries_to_link", name = "libraries_to_link",
actions = ["//cc/toolchains/actions:link_actions"], actions = [
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
type = types.option(types.list(types.struct( type = types.option(types.list(types.struct(
name = types.string,
is_whole_archive = types.bool,
object_files = types.list(types.file),
path = types.string,
shared_libraries = types.list(types.struct( shared_libraries = types.list(types.struct(
name = types.string, name = types.string,
is_whole_archive = types.bool, is_whole_archive = types.bool,
@ -165,9 +172,56 @@ cc_variable(
path = types.file, path = types.file,
type = types.string, type = types.string,
)), )),
type = types.string,
))), ))),
) )
cc_variable(
name = "libraries_to_link.type",
actions = [
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
# See :libraries_to_link.
type = types.string,
)
cc_variable(
name = "libraries_to_link.name",
actions = [
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
# See :libraries_to_link.
type = types.string,
)
cc_variable(
name = "libraries_to_link.path",
actions = [
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
# See :libraries_to_link.
type = types.string,
)
cc_variable(
name = "libraries_to_link.object_files",
actions = [
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
# See :libraries_to_link.
type = types.list(types.file),
)
cc_variable(
name = "libraries_to_link.is_whole_archive",
actions = ["//cc/toolchains/actions:link_actions"],
type = types.bool,
)
cc_variable( cc_variable(
name = "libraries_to_link.shared_libraries", name = "libraries_to_link.shared_libraries",
actions = ["//cc/toolchains/actions:link_actions"], actions = ["//cc/toolchains/actions:link_actions"],
@ -213,8 +267,11 @@ cc_variable(
cc_variable( cc_variable(
name = "linker_param_file", name = "linker_param_file",
actions = ["//cc/toolchains/actions:link_actions"], actions = [
type = types.file, "//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
type = types.option(types.file),
) )
cc_variable( cc_variable(
@ -255,7 +312,10 @@ cc_variable(
cc_variable( cc_variable(
name = "output_execpath", name = "output_execpath",
actions = ["//cc/toolchains/actions:link_actions"], actions = [
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
type = types.option(types.directory), type = types.option(types.directory),
) )