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

Use the new driver on Xcode 14.x since it contains the fixes in https://github.com/apple/swift-driver/pull/1036 #1268

Merged
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
20 changes: 18 additions & 2 deletions swift/toolchains/xcode_swift_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ load(
"SWIFT_FEATURE_SUPPORTS_PRIVATE_DEPS",
"SWIFT_FEATURE_SUPPORTS_SYSTEM_MODULE_FLAG",
"SWIFT_FEATURE_USE_GLOBAL_MODULE_CACHE",
"SWIFT_FEATURE_USE_OLD_DRIVER",
"SWIFT_FEATURE_USE_RESPONSE_FILES",
"SWIFT_FEATURE__FORCE_ALWAYSLINK_TRUE",
"SWIFT_FEATURE__SUPPORTS_CONST_VALUE_EXTRACTION",
Expand Down Expand Up @@ -493,7 +494,8 @@ def _all_tool_configs(
execution_requirements,
generated_header_rewriter,
swift_executable,
toolchain_root):
toolchain_root,
xcode_config):
"""Returns the tool configurations for the Swift toolchain.

Args:
Expand All @@ -506,6 +508,7 @@ def _all_tool_configs(
swift_executable: A custom Swift driver executable to be used during the
build, if provided.
toolchain_root: The root directory of the toolchain, if provided.
xcode_config: The `apple_common.XcodeVersionConfig` provider.

Returns:
A dictionary mapping action name to tool configuration.
Expand All @@ -518,7 +521,14 @@ def _all_tool_configs(
env = dict(env)
env["TOOLCHAINS"] = custom_toolchain

env["SWIFT_AVOID_WARNING_USING_OLD_DRIVER"] = "1"
# In Xcode 13.3 and 13.4 (Swift 5.6), the legacy driver prints a warning
# if it is used. Suppress it, since we still have to use it on those
# specific versions due to response file bugs.
if (
_is_xcode_at_least_version(xcode_config, "13.3") and
not _is_xcode_at_least_version(xcode_config, "14.0")
):
env["SWIFT_AVOID_WARNING_USING_OLD_DRIVER"] = "1"

def _driver_config(*, mode):
return {
Expand Down Expand Up @@ -710,6 +720,11 @@ def _xcode_swift_toolchain_impl(ctx):
SWIFT_FEATURE_USE_RESPONSE_FILES,
])

# The new driver had response file bugs in Xcode 13.x that are fixed in
# Xcode 14.
if not _is_xcode_at_least_version(xcode_config, "14.0"):
requested_features.append(SWIFT_FEATURE_USE_OLD_DRIVER)

# Xcode 14 implies Swift 5.7.
if _is_xcode_at_least_version(xcode_config, "14.0"):
requested_features.append(SWIFT_FEATURE_FILE_PREFIX_MAP)
Expand All @@ -736,6 +751,7 @@ def _xcode_swift_toolchain_impl(ctx):
generated_header_rewriter = generated_header_rewriter,
swift_executable = swift_executable,
toolchain_root = toolchain_root,
xcode_config = xcode_config,
)
all_action_configs = _all_action_configs(
additional_objc_copts = _command_line_objc_copts(
Expand Down