Skip to content

Commit

Permalink
Update toolchain variable definitions to allow static linking
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Googler authored and copybara-github committed Jun 27, 2024
1 parent 280d3ad commit 0d1b084
Showing 1 changed file with 64 additions and 4 deletions.
68 changes: 64 additions & 4 deletions cc/toolchains/variables/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -156,18 +156,72 @@ cc_variable(

cc_variable(
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(
name = types.string,
is_whole_archive = types.bool,
object_files = types.list(types.file),
path = types.string,
shared_libraries = types.list(types.struct(
name = types.string,
is_whole_archive = types.bool,
object_files = types.list(types.file),
path = types.file,
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(
name = "libraries_to_link.shared_libraries",
actions = ["//cc/toolchains/actions:link_actions"],
Expand Down Expand Up @@ -213,8 +267,11 @@ cc_variable(

cc_variable(
name = "linker_param_file",
actions = ["//cc/toolchains/actions:link_actions"],
type = types.file,
actions = [
"//cc/toolchains/actions:cpp_link_static_library",
"//cc/toolchains/actions:link_actions",
],
type = types.option(types.file),
)

cc_variable(
Expand Down Expand Up @@ -255,7 +312,10 @@ cc_variable(

cc_variable(
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),
)

Expand Down

0 comments on commit 0d1b084

Please sign in to comment.