Skip to content

Commit

Permalink
Add strip_flags
Browse files Browse the repository at this point in the history
Copybara Import from #324

BEGIN_PUBLIC
Add strip_flags (#324)

Previously the strip action appeared to be entirely invalid since no
flags were passed to strip. I believe this is because the strip action
was configured in the legacy feature code without any extra features,
just directly on the action.

Closes #324
END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=#324 from keith:ks/add-strip_flags 79f1143
PiperOrigin-RevId: 726219472
Change-Id: Icb7685353896d0d4b392432637fa8cf64dc61c0d
  • Loading branch information
keith authored and copybara-github committed Feb 12, 2025
1 parent 4ac36f7 commit 9c91c03
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
1 change: 1 addition & 0 deletions cc/toolchains/args/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ cc_feature_set(
"//cc/toolchains/args/runtime_library_search_directories:feature",
"//cc/toolchains/args/shared_flag:feature",
"//cc/toolchains/args/strip_debug_symbols:feature",
"//cc/toolchains/args/strip_flags:feature",
],
)

Expand Down
57 changes: 57 additions & 0 deletions cc/toolchains/args/strip_flags/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
load("//cc/toolchains:args.bzl", "cc_args")
load("//cc/toolchains:args_list.bzl", "cc_args_list")
load("//cc/toolchains:feature.bzl", "cc_feature")

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

cc_feature(
name = "feature",
args = [":strip_flags"],
# This does not override a feature since these arguments are directly bound
# to the strip action in CppActionConfigs.java.
feature_name = "strip_flags_feature",
)

cc_args_list(
name = "strip_flags",
args = [
":strip_debug",
":preserve_dates",
":output_file",
":input_file",
],
visibility = ["//visibility:public"],
)

cc_args(
name = "strip_debug",
actions = ["//cc/toolchains/actions:strip"],
args = ["-S"],
)

cc_args(
name = "preserve_dates",
actions = ["//cc/toolchains/actions:strip"],
args = select({
"@platforms//os:macos": [],
"//conditions:default": ["-p"],
}),
)

cc_args(
name = "output_file",
actions = ["//cc/toolchains/actions:strip"],
args = [
"-o",
"{output_file}",
],
format = {"output_file": "//cc/toolchains/variables:output_file"},
requires_not_none = "//cc/toolchains/variables:output_file",
)

cc_args(
name = "input_file",
actions = ["//cc/toolchains/actions:strip"],
args = ["{input_file}"],
format = {"input_file": "//cc/toolchains/variables:input_file"},
)

0 comments on commit 9c91c03

Please sign in to comment.