Skip to content

Commit 532d7ea

Browse files
luispadronbrentleyjones
authored andcommitted
Unconditionally pass -file-prefix-map to the compiler to remove nondeterministic paths.
Simplified the `debug_settings` tests since the rules unconditionally pass `-file-prefix-map` now. We may want to remove the support for `-debug-prefix-map` in the future since it's redundant. Cherry-pick: a440c7e
1 parent a4bbb84 commit 532d7ea

File tree

3 files changed

+14
-57
lines changed

3 files changed

+14
-57
lines changed

swift/internal/features.bzl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ load(
2222
"SWIFT_FEATURE_CHECKED_EXCLUSIVITY",
2323
"SWIFT_FEATURE_COVERAGE",
2424
"SWIFT_FEATURE_COVERAGE_PREFIX_MAP",
25-
"SWIFT_FEATURE_DEBUG_PREFIX_MAP",
2625
"SWIFT_FEATURE_DISABLE_CLANG_SPI",
2726
"SWIFT_FEATURE_DISABLE_SYSTEM_INDEX",
2827
"SWIFT_FEATURE_EMIT_SWIFTDOC",
@@ -250,7 +249,6 @@ def default_features_for_toolchain(target_triple):
250249
SWIFT_FEATURE_CACHEABLE_SWIFTMODULES,
251250
SWIFT_FEATURE_CHECKED_EXCLUSIVITY,
252251
SWIFT_FEATURE_COVERAGE_PREFIX_MAP,
253-
SWIFT_FEATURE_DEBUG_PREFIX_MAP,
254252
SWIFT_FEATURE_DISABLE_CLANG_SPI,
255253
SWIFT_FEATURE_DISABLE_SYSTEM_INDEX,
256254
SWIFT_FEATURE_EMIT_SWIFTDOC,

swift/toolchains/config/compile_config.bzl

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@ def compile_action_configs(
538538
],
539539
configurators = [
540540
add_arg("-Xwrapped-swift=-file-prefix-pwd-is-dot"),
541+
add_arg("-file-prefix-map", "__BAZEL_XCODE_DEVELOPER_DIR__=/PLACEHOLDER_DEVELOPER_DIR"),
541542
],
542543
features = [SWIFT_FEATURE_FILE_PREFIX_MAP],
543544
),
@@ -1140,17 +1141,6 @@ def compile_action_configs(
11401141
],
11411142
configurators = [_module_name_configurator],
11421143
),
1143-
ActionConfigInfo(
1144-
actions = [
1145-
SWIFT_ACTION_COMPILE,
1146-
SWIFT_ACTION_DERIVE_FILES,
1147-
SWIFT_ACTION_PRECOMPILE_C_MODULE,
1148-
],
1149-
configurators = [
1150-
add_arg("-file-prefix-map", "__BAZEL_XCODE_DEVELOPER_DIR__=/PLACEHOLDER_DEVELOPER_DIR"),
1151-
],
1152-
features = [SWIFT_FEATURE_FILE_PREFIX_MAP],
1153-
),
11541144

11551145
# Set the package name.
11561146
ActionConfigInfo(

test/debug_settings_tests.bzl

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -23,43 +23,27 @@ DBG_CONFIG_SETTINGS = {
2323
"//command_line_option:compilation_mode": "dbg",
2424
"//command_line_option:features": [
2525
"-swift.cacheable_swiftmodules",
26-
"swift.debug_prefix_map",
27-
"-swift.file_prefix_map",
28-
],
29-
}
30-
31-
FILE_PREFIX_MAP_CONFIG_SETTINGS = {
32-
"//command_line_option:compilation_mode": "dbg",
33-
"//command_line_option:features": [
34-
"swift.debug_prefix_map",
35-
"swift.file_prefix_map",
3626
],
3727
}
3828

3929
CACHEABLE_DBG_CONFIG_SETTINGS = {
4030
"//command_line_option:compilation_mode": "dbg",
4131
"//command_line_option:features": [
4232
"swift.cacheable_swiftmodules",
43-
"swift.debug_prefix_map",
44-
"-swift.file_prefix_map",
4533
],
4634
}
4735

4836
FASTBUILD_CONFIG_SETTINGS = {
4937
"//command_line_option:compilation_mode": "fastbuild",
5038
"//command_line_option:features": [
5139
"-swift.cacheable_swiftmodules",
52-
"swift.debug_prefix_map",
53-
"-swift.file_prefix_map",
5440
],
5541
}
5642

5743
FASTBUILD_FULL_DI_CONFIG_SETTINGS = {
5844
"//command_line_option:compilation_mode": "fastbuild",
5945
"//command_line_option:features": [
6046
"-swift.cacheable_swiftmodules",
61-
"swift.debug_prefix_map",
62-
"-swift.file_prefix_map",
6347
"swift.full_debug_info",
6448
],
6549
}
@@ -68,9 +52,6 @@ OPT_CONFIG_SETTINGS = {
6852
"//command_line_option:compilation_mode": "opt",
6953
"//command_line_option:features": [
7054
"-swift.cacheable_swiftmodules",
71-
# This feature indicates *support*, not unconditional enablement, which
72-
# is why it is present for `opt` mode as well.
73-
"swift.debug_prefix_map",
7455
],
7556
}
7657

@@ -86,10 +67,6 @@ dbg_action_command_line_test = make_action_command_line_test_rule(
8667
config_settings = DBG_CONFIG_SETTINGS,
8768
)
8869

89-
file_prefix_map_command_line_test = make_action_command_line_test_rule(
90-
config_settings = FILE_PREFIX_MAP_CONFIG_SETTINGS,
91-
)
92-
9370
cacheable_dbg_action_command_line_test = make_action_command_line_test_rule(
9471
config_settings = CACHEABLE_DBG_CONFIG_SETTINGS,
9572
)
@@ -136,26 +113,13 @@ def debug_settings_test_suite(name, tags = []):
136113
expected_argv = [
137114
"-DDEBUG",
138115
"-Xfrontend -serialize-debugging-options",
139-
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
116+
"-Xwrapped-swift=-file-prefix-pwd-is-dot",
140117
"-g",
141118
],
142119
not_expected_argv = [
143120
"-DNDEBUG",
144121
"-Xfrontend -no-serialize-debugging-options",
145122
"-gline-tables-only",
146-
],
147-
mnemonic = "SwiftCompile",
148-
tags = all_tags,
149-
target_under_test = "//test/fixtures/debug_settings:simple",
150-
)
151-
152-
# Verify that the build is remapping paths with a file prefix map.
153-
file_prefix_map_command_line_test(
154-
name = "{}_file_prefix_map_build".format(name),
155-
expected_argv = [
156-
"-Xwrapped-swift=-file-prefix-pwd-is-dot",
157-
],
158-
not_expected_argv = [
159123
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
160124
],
161125
mnemonic = "SwiftCompile",
@@ -171,13 +135,14 @@ def debug_settings_test_suite(name, tags = []):
171135
expected_argv = [
172136
"-DDEBUG",
173137
"-Xfrontend -no-serialize-debugging-options",
174-
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
138+
"-Xwrapped-swift=-file-prefix-pwd-is-dot",
175139
"-g",
176140
],
177141
not_expected_argv = [
178142
"-DNDEBUG",
179143
"-Xfrontend -serialize-debugging-options",
180144
"-gline-tables-only",
145+
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
181146
],
182147
mnemonic = "SwiftCompile",
183148
tags = all_tags,
@@ -191,13 +156,14 @@ def debug_settings_test_suite(name, tags = []):
191156
expected_argv = [
192157
"-DDEBUG",
193158
"-Xfrontend -serialize-debugging-options",
194-
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
159+
"-Xwrapped-swift=-file-prefix-pwd-is-dot",
195160
"-gline-tables-only",
196161
],
197162
not_expected_argv = [
198163
"-DNDEBUG",
199164
"-Xfrontend -no-serialize-debugging-options",
200165
"-g",
166+
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
201167
],
202168
mnemonic = "SwiftCompile",
203169
tags = all_tags,
@@ -211,25 +177,27 @@ def debug_settings_test_suite(name, tags = []):
211177
expected_argv = [
212178
"-DDEBUG",
213179
"-Xfrontend -serialize-debugging-options",
214-
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
180+
"-Xwrapped-swift=-file-prefix-pwd-is-dot",
215181
"-g",
216182
],
217183
not_expected_argv = [
218184
"-DNDEBUG",
219185
"-Xfrontend -no-serialize-debugging-options",
220186
"-gline-tables-only",
187+
"-Xwrapped-swift=-debug-prefix-pwd-is-dot",
221188
],
222189
mnemonic = "SwiftCompile",
223190
tags = all_tags,
224191
target_under_test = "//test/fixtures/debug_settings:simple",
225192
)
226193

227-
# Verify that `-c opt` builds do not serialize debugging options or remap
228-
# paths, and have appropriate flags otherwise.
194+
# Verify that `-c opt` builds do not serialize debugging options, but have
195+
# appropriate flags otherwise.
229196
opt_action_command_line_test(
230197
name = "{}_opt_build".format(name),
231198
expected_argv = [
232199
"-DNDEBUG",
200+
"-Xwrapped-swift=-file-prefix-pwd-is-dot",
233201
],
234202
not_expected_argv = [
235203
"-DDEBUG",
@@ -243,13 +211,14 @@ def debug_settings_test_suite(name, tags = []):
243211
target_under_test = "//test/fixtures/debug_settings:simple",
244212
)
245213

246-
# Verify that `-c opt` builds do not serialize debugging options or remap
247-
# paths, and have appropriate flags otherwise.
214+
# Verify that `-c opt` builds do not serialize debugging options, but have
215+
# appropriate flags otherwise.
248216
cacheable_opt_action_command_line_test(
249217
name = "{}_cacheable_opt_build".format(name),
250218
expected_argv = [
251219
"-DNDEBUG",
252220
"-Xfrontend -no-serialize-debugging-options",
221+
"-Xwrapped-swift=-file-prefix-pwd-is-dot",
253222
],
254223
not_expected_argv = [
255224
"-Xfrontend -serialize-debugging-options",

0 commit comments

Comments
 (0)