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

Remove checks for Xcode versions prior to 14.0 and unconditionally enable features that require 14.0 or greater #1353

Merged
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
5 changes: 0 additions & 5 deletions swift/internal/feature_names.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ SWIFT_FEATURE_USE_GLOBAL_MODULE_CACHE = "swift.use_global_module_cache"
# This feature requires `swift.use_global_module_cache` to be enabled.
SWIFT_FEATURE_GLOBAL_MODULE_CACHE_USES_TMPDIR = "swift.global_module_cache_uses_tmpdir"

# If enabled, actions invoking the Swift driver will use the legacy driver
# instead of the new driver (https://github.com/apple/swift-driver) that
# launched in Xcode 13/Swift 5.5.
SWIFT_FEATURE_USE_OLD_DRIVER = "swift.use_old_driver"

# If enabled, Swift linking actions will use `swift-autolink-extract` to extract
# the linker arguments. This is required for ELF targets. This is used
# internally to determine the behaviour of the actions across different
Expand Down
5 changes: 1 addition & 4 deletions swift/internal/swift_autoconfiguration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ load(
"SWIFT_FEATURE_SUPPORTS_BARE_SLASH_REGEX",
"SWIFT_FEATURE_USE_AUTOLINK_EXTRACT",
"SWIFT_FEATURE_USE_MODULE_WRAP",
"SWIFT_FEATURE_USE_OLD_DRIVER",
)
load(":toolchain_utils.bzl", "SWIFT_TOOLCHAIN_TYPE")

Expand Down Expand Up @@ -368,9 +367,7 @@ def _create_windows_toolchain(repository_ctx):
SWIFT_FEATURE_NO_EMBED_DEBUG_MODULE,
SWIFT_FEATURE_MODULE_MAP_NO_PRIVATE_HEADERS,
]
disabled_features = [
SWIFT_FEATURE_USE_OLD_DRIVER,
]
disabled_features = []

version_file = _write_swift_version(repository_ctx, path_to_swiftc)
xctest_version = repository_ctx.execute([
Expand Down
19 changes: 1 addition & 18 deletions swift/toolchains/config/compile_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ load(
"SWIFT_FEATURE_USE_EXPLICIT_SWIFT_MODULE_MAP",
"SWIFT_FEATURE_USE_GLOBAL_INDEX_STORE",
"SWIFT_FEATURE_USE_GLOBAL_MODULE_CACHE",
"SWIFT_FEATURE_USE_OLD_DRIVER",
"SWIFT_FEATURE_USE_PCH_OUTPUT_DIR",
"SWIFT_FEATURE_VFSOVERLAY",
"SWIFT_FEATURE__NUM_THREADS_0_IN_SWIFTCOPTS",
Expand Down Expand Up @@ -120,24 +119,8 @@ def compile_action_configs(
The list of action configs needed to perform compilation.
"""

#### Flags that control the driver
action_configs = [
# Use the legacy driver if requested.
ActionConfigInfo(
actions = [
SWIFT_ACTION_COMPILE,
SWIFT_ACTION_COMPILE_MODULE_INTERFACE,
SWIFT_ACTION_DERIVE_FILES,
SWIFT_ACTION_DUMP_AST,
SWIFT_ACTION_PRECOMPILE_C_MODULE,
],
configurators = [add_arg("-disallow-use-new-driver")],
features = [SWIFT_FEATURE_USE_OLD_DRIVER],
),
]

#### Flags that control compilation outputs
action_configs += [
action_configs = [
# Emit object file(s).
ActionConfigInfo(
actions = [SWIFT_ACTION_COMPILE],
Expand Down
4 changes: 3 additions & 1 deletion swift/toolchains/swift_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,9 @@ def _swift_toolchain_impl(ctx):
generated_header_module_implicit_deps_providers = (
collect_implicit_deps_providers([])
),
module_aliases = ctx.attr._module_mapping[SwiftModuleAliasesInfo].aliases,
module_aliases = (
ctx.attr._module_mapping[SwiftModuleAliasesInfo].aliases
),
implicit_deps_providers = collect_implicit_deps_providers(
[],
additional_cc_infos = [swift_linkopts_cc_info],
Expand Down
25 changes: 4 additions & 21 deletions swift/toolchains/xcode_swift_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,7 @@ def _all_tool_configs(
execution_requirements,
generated_header_rewriter,
swift_executable,
toolchain_root,
xcode_config):
toolchain_root):
"""Returns the tool configurations for the Swift toolchain.

Args:
Expand All @@ -501,7 +500,6 @@ 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 @@ -514,15 +512,6 @@ def _all_tool_configs(
env = dict(env)
env["TOOLCHAINS"] = custom_toolchain

# 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 {
"mode": mode,
Expand Down Expand Up @@ -747,7 +736,6 @@ 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 Expand Up @@ -786,13 +774,6 @@ def _xcode_swift_toolchain_impl(ctx):
),
)

module_aliases = ctx.attr._module_mapping[SwiftModuleAliasesInfo].aliases
if module_aliases and not _is_xcode_at_least_version(xcode_config, "14.0"):
fail(
"Module mappings are only supported by Swift 5.7 (Xcode 14.0) " +
"and higher.",
)

swift_toolchain_info = SwiftToolchainInfo(
action_configs = all_action_configs,
cc_toolchain_info = cc_toolchain,
Expand Down Expand Up @@ -820,7 +801,9 @@ def _xcode_swift_toolchain_impl(ctx):
additional_cc_infos = [swift_linkopts_providers.cc_info],
additional_objc_infos = [swift_linkopts_providers.objc_info],
),
module_aliases = module_aliases,
module_aliases = (
ctx.attr._module_mapping[SwiftModuleAliasesInfo].aliases
),
package_configurations = [
target[SwiftPackageConfigurationInfo]
for target in ctx.attr.package_configurations
Expand Down