-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for -file-prefix-map $PWD=. (#904)
This is a new flag in Swift 5.7, that mirrors the flag with the same name in clang, meaning that it implies both -debug-prefix-map, and -coverage-prefix map. Currently it is also the only flag that applies to indexing info if you want to produce hermetic indexes. Ideally going forward users should prefer this flag if they want their builds to be hermetic instead of picking the other flags as needed, since this will potentially also apply to new absolute paths in the future. swiftlang/swift#58946
- Loading branch information
Showing
6 changed files
with
121 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
"""Tests for various features that aren't large enough to need their own tests file.""" | ||
|
||
load( | ||
"@build_bazel_rules_swift//test/rules:action_command_line_test.bzl", | ||
"make_action_command_line_test_rule", | ||
) | ||
|
||
default_test = make_action_command_line_test_rule() | ||
|
||
file_prefix_map_test = make_action_command_line_test_rule( | ||
config_settings = { | ||
"//command_line_option:features": [ | ||
"swift.file_prefix_map", | ||
], | ||
}, | ||
) | ||
|
||
file_prefix_xcode_remap_test = make_action_command_line_test_rule( | ||
config_settings = { | ||
"//command_line_option:features": [ | ||
"swift.file_prefix_map", | ||
"swift.remap_xcode_path", | ||
], | ||
}, | ||
) | ||
|
||
def features_test_suite(name): | ||
"""Test suite for various features. | ||
Args: | ||
name: the base name to be used in things created by this macro | ||
""" | ||
default_test( | ||
name = "{}_default_test".format(name), | ||
tags = [name], | ||
expected_argv = ["-emit-object"], | ||
not_expected_argv = [ | ||
"-file-prefix-map", | ||
"-Xwrapped-swift=-file-prefix-pwd-is-dot", | ||
], | ||
mnemonic = "SwiftCompile", | ||
target_under_test = "@build_bazel_rules_swift//test/fixtures/debug_settings:simple", | ||
) | ||
|
||
file_prefix_map_test( | ||
name = "{}_file_prefix_map_test".format(name), | ||
tags = [name], | ||
expected_argv = [ | ||
"-Xwrapped-swift=-file-prefix-pwd-is-dot", | ||
], | ||
mnemonic = "SwiftCompile", | ||
target_under_test = "@build_bazel_rules_swift//test/fixtures/debug_settings:simple", | ||
) | ||
|
||
file_prefix_xcode_remap_test( | ||
name = "{}_file_prefix_xcode_remap_test".format(name), | ||
tags = [name], | ||
expected_argv = [ | ||
"-Xwrapped-swift=-file-prefix-pwd-is-dot", | ||
"-file-prefix-map", | ||
"__BAZEL_XCODE_DEVELOPER_DIR__=DEVELOPER_DIR", | ||
], | ||
target_compatible_with = ["@platforms//os:macos"], | ||
mnemonic = "SwiftCompile", | ||
target_under_test = "@build_bazel_rules_swift//test/fixtures/debug_settings:simple", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters