Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions cc/toolchains/args/archiver_flags/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("//cc/toolchains:args.bzl", "cc_args")
load("//cc/toolchains:args_list.bzl", "cc_args_list")
load("//cc/toolchains:feature.bzl", "cc_feature")
load("//cc/toolchains:nested_args.bzl", "cc_nested_args")

package(default_visibility = ["//visibility:private"])

bool_flag(
name = "use_libtool_on_macos",
build_setting_default = True,
)

config_setting(
name = "use_libtool_on_macos_setting",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these targets be public to allow toolchain implementors to select on it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hrm what would be the use case? I guess if you're avoiding this feature maybe you should Add your own flag? Not sure

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Basically this; #403 i am not sure what's the best approach here.

constraint_values = ["@platforms//os:macos"],
flag_values = {":use_libtool_on_macos": "true"},
)

cc_feature(
name = "feature",
args = [":archiver_flags"],
Expand All @@ -26,7 +38,7 @@ cc_args(
name = "create_static_archive",
actions = ["//cc/toolchains/actions:ar_actions"],
args = select({
"@platforms//os:macos": ["-static"],
":use_libtool_on_macos_setting": ["-static"],
"//conditions:default": ["rcsD"],
}),
)
Expand All @@ -35,7 +47,7 @@ cc_args(
name = "output_execpath",
actions = ["//cc/toolchains/actions:ar_actions"],
args = select({
"@platforms//os:macos": ["-o"],
":use_libtool_on_macos_setting": ["-o"],
"//conditions:default": [],
}) + ["{output_execpath}"],
format = {"output_execpath": "//cc/toolchains/variables:output_execpath"},
Expand Down