Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 549758968
  • Loading branch information
googlewalt authored and swiple-rules-gardener committed Jul 20, 2023
1 parent 3a07e48 commit c97983d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apple/internal/rule_attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ visibility([
"//test/...",
])

# The name of the execution group used to run j2objc linking actions.
_J2OBJC_LINKING_EXEC_GROUP = "j2objc"

def _common_attrs():
"""Private attributes on all rules; these should be included in all rule attributes."""
return dicts.add(
Expand Down Expand Up @@ -172,13 +175,14 @@ def _j2objc_binary_linking_attrs(*, deps_cfg):
cfg = deps_cfg,
default = Label("@bazel_tools//tools/objc:dummy_lib"),
),
# TODO(b/292086564): Remove once j2objc dead code prunder action is removed.
"_j2objc_dead_code_pruner": attr.label(
executable = True,
# Setting `allow_single_file=True` would be more correct. Unfortunately,
# doing so prevents using py_binary as the underlying target because py_binary
# produces at least _two_ output files (the executable plus any files in srcs)
allow_files = True,
cfg = "exec",
cfg = config.exec(_J2OBJC_LINKING_EXEC_GROUP),
default = Label("@bazel_tools//tools/objc:j2objc_dead_code_pruner_binary"),
),
# xcrunwrapper is no longer used by rules_apple, but the underlying implementation of
Expand Down
15 changes: 15 additions & 0 deletions apple/internal/rule_factory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ AppleTestRunnerInfo provider.
),
}

# The name of the execution group used to run j2objc linking actions.
_J2OBJC_LINKING_EXEC_GROUP = "j2objc"

def _create_apple_rule(
*,
cfg = transition_support.apple_rule_transition,
Expand Down Expand Up @@ -127,6 +130,12 @@ def _create_apple_rule(
cfg = cfg,
doc = doc,
executable = is_executable,
# TODO(b/292086564): Remove once j2objc dead code prunder action is removed.
exec_groups = {
_J2OBJC_LINKING_EXEC_GROUP: exec_group(
exec_compatible_with = ["@platforms//os:osx"],
),
},
fragments = ["apple", "cpp", "objc"],
toolchains = toolchains,
**extra_args
Expand Down Expand Up @@ -157,6 +166,12 @@ def _create_apple_test_rule(*, doc, implementation, platform_type):
*ide_visible_attrs
),
doc = doc,
# TODO(b/292086564): Remove once j2objc dead code prunder action is removed.
exec_groups = {
_J2OBJC_LINKING_EXEC_GROUP: exec_group(
exec_compatible_with = ["@platforms//os:osx"],
),
},
test = True,
toolchains = use_cpp_toolchain(),
)
Expand Down

1 comment on commit c97983d

@keith
Copy link
Member

@keith keith commented on c97983d Aug 28, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.