Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Take upstream j2objc change #2205

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion apple/internal/rule_attrs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ load(
"dicts",
)

# 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 @@ -167,13 +170,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
11 changes: 11 additions & 0 deletions apple/internal/rule_factory.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ of the target will be used instead.
),
}

# 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 @@ -136,6 +139,10 @@ 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(),
},
fragments = ["apple", "cpp", "objc"],
toolchains = toolchains,
**extra_args
Expand Down Expand Up @@ -166,6 +173,10 @@ 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(),
},
test = True,
toolchains = use_cpp_toolchain(),
)
Expand Down