Skip to content

Commit

Permalink
Implement shared_flag as cc_args
Browse files Browse the repository at this point in the history
BEGIN_PUBLIC

Implement shared_flag as cc_args

Implements the shared_flag feature as cc_args rules.

END_PUBLIC

PiperOrigin-RevId: 671765792
Change-Id: I0c13873ef2b5c19908cbed13c1b88b5fc957c4cd
  • Loading branch information
Googler authored and copybara-github committed Sep 6, 2024
1 parent 98ab833 commit 4bf8bb1
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cc/toolchains/args/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ cc_feature(
"//cc/toolchains/args/archiver_flags",
"//cc/toolchains/args/force_pic_flags",
"//cc/toolchains/args/linker_param_file",
"//cc/toolchains/args/shared_flag",
],
feature_name = "experimental_replace_legacy_action_config_features",
# TODO: Convert remaining items in this list into their actual args.
Expand All @@ -37,6 +38,5 @@ cc_feature(
"//cc/toolchains/features/legacy:user_link_flags",
"//cc/toolchains/features/legacy:libraries_to_link",
"//cc/toolchains/features/legacy:runtime_library_search_directories",
"//cc/toolchains/features/legacy:shared_flag",
],
)
15 changes: 15 additions & 0 deletions cc/toolchains/args/shared_flag/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
load("//cc/toolchains:args.bzl", "cc_args")

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

cc_args(
name = "shared_flag",
actions = [
"//cc/toolchains/actions:cpp_link_dynamic_library",
"//cc/toolchains/actions:cpp_link_nodeps_dynamic_library",
"//cc/toolchains/actions:lto_index_for_dynamic_library",
"//cc/toolchains/actions:lto_index_for_nodeps_dynamic_library",
],
args = ["-shared"],
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions cc/toolchains/features/legacy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ cc_external_feature(

cc_external_feature(
name = "shared_flag",
deprecation = "Use //cc/toolchains/args/shared_flag instead",
feature_name = "shared_flag",
overridable = True,
)
Expand Down
6 changes: 6 additions & 0 deletions tests/rule_based_toolchain/legacy_features_as_args/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ compare_feature_implementation(
actual_implementation = "//cc/toolchains/args/linker_param_file",
expected = "//tests/rule_based_toolchain/legacy_features_as_args:goldens/unix/linker_param_file.textproto",
)

compare_feature_implementation(
name = "shared_flag_test",
actual_implementation = "//cc/toolchains/args/shared_flag",
expected = "//tests/rule_based_toolchain/legacy_features_as_args:goldens/unix/shared_flag.textproto",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
enabled: false
flag_sets {
actions: "c++-link-dynamic-library"
actions: "c++-link-nodeps-dynamic-library"
actions: "lto-index-for-dynamic-library"
actions: "lto-index-for-nodeps-dynamic-library"
flag_groups {
flags: "-shared"
}
}
name: "shared_flag_test"

0 comments on commit 4bf8bb1

Please sign in to comment.