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

Add -enable-bare-slash-regex on Linux if supported #971

Merged
merged 3 commits into from
Jan 12, 2023
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
11 changes: 11 additions & 0 deletions swift/internal/swift_autoconfiguration.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ load(
"SWIFT_FEATURE_ENABLE_SKIP_FUNCTION_BODIES",
"SWIFT_FEATURE_MODULE_MAP_NO_PRIVATE_HEADERS",
"SWIFT_FEATURE_NO_EMBED_DEBUG_MODULE",
"SWIFT_FEATURE_SUPPORTS_BARE_SLASH_REGEX",
"SWIFT_FEATURE_SUPPORTS_PRIVATE_DEPS",
"SWIFT_FEATURE_USE_AUTOLINK_EXTRACT",
"SWIFT_FEATURE_USE_MODULE_WRAP",
Expand Down Expand Up @@ -99,6 +100,15 @@ def _check_debug_prefix_map(repository_ctx, swiftc_path, _temp_dir):
"foo=bar",
)

def _check_enable_bare_slash_regex(repository_ctx, swiftc_path, _temp_dir):
"""Returns True if `swiftc` supports debug prefix mapping."""
return _swift_succeeds(
repository_ctx,
swiftc_path,
"-version",
"-enable-bare-slash-regex",
)

def _check_supports_private_deps(repository_ctx, swiftc_path, temp_dir):
"""Returns True if `swiftc` supports implementation-only imports."""
source_file = _scratch_file(
Expand Down Expand Up @@ -202,6 +212,7 @@ _FEATURE_CHECKS = {
SWIFT_FEATURE_DEBUG_PREFIX_MAP: _check_debug_prefix_map,
SWIFT_FEATURE_ENABLE_BATCH_MODE: _check_enable_batch_mode,
SWIFT_FEATURE_ENABLE_SKIP_FUNCTION_BODIES: _check_skip_function_bodies,
SWIFT_FEATURE_SUPPORTS_BARE_SLASH_REGEX: _check_enable_bare_slash_regex,
SWIFT_FEATURE_SUPPORTS_PRIVATE_DEPS: _check_supports_private_deps,
SWIFT_FEATURE_USE_RESPONSE_FILES: _check_use_response_files,
}
Expand Down