Skip to content

Commit af9eb15

Browse files
authored
Fix index while building with derived files (bazelbuild#506)
The swiftmodule generation should not attempt to perform indexing.
1 parent d9d393c commit af9eb15

File tree

2 files changed

+37
-4
lines changed

2 files changed

+37
-4
lines changed

swift/internal/compiling.bzl

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,10 +693,7 @@ def compile_action_configs():
693693

694694
# Configure index-while-building.
695695
swift_toolchain_config.action_config(
696-
actions = [
697-
swift_action_names.COMPILE,
698-
swift_action_names.DERIVE_FILES,
699-
],
696+
actions = [swift_action_names.COMPILE],
700697
configurators = [_index_while_building_configurator],
701698
features = [SWIFT_FEATURE_INDEX_WHILE_BUILDING],
702699
),

test/split_derived_files_tests.bzl

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ split_swiftmodule_skip_function_bodies_test = make_action_command_line_test_rule
5656
],
5757
},
5858
)
59+
split_swiftmodule_indexing_test = make_action_command_line_test_rule(
60+
config_settings = {
61+
"//command_line_option:features": [
62+
"swift.index_while_building",
63+
"swift.split_derived_files_generation",
64+
],
65+
},
66+
)
5967

6068
def split_derived_files_test_suite(name = "split_derived_files"):
6169
"""Test suite for split derived files options.
@@ -220,6 +228,34 @@ def split_derived_files_test_suite(name = "split_derived_files"):
220228
target_under_test = "@build_bazel_rules_swift//test/fixtures/debug_settings:simple",
221229
)
222230

231+
split_swiftmodule_indexing_test(
232+
name = "{}_object_only_indexing".format(name),
233+
expected_argv = [
234+
"-emit-object",
235+
"-index-store-path",
236+
],
237+
mnemonic = "SwiftCompile",
238+
not_expected_argv = [
239+
"-emit-module-path",
240+
],
241+
tags = [name],
242+
target_under_test = "@build_bazel_rules_swift//test/fixtures/debug_settings:simple",
243+
)
244+
245+
split_swiftmodule_indexing_test(
246+
name = "{}_swiftmodule_only_indexing".format(name),
247+
expected_argv = [
248+
"-emit-module-path",
249+
],
250+
mnemonic = "SwiftDeriveFiles",
251+
not_expected_argv = [
252+
"-emit-object",
253+
"-index-store-path",
254+
],
255+
tags = [name],
256+
target_under_test = "@build_bazel_rules_swift//test/fixtures/debug_settings:simple",
257+
)
258+
223259
native.test_suite(
224260
name = name,
225261
tags = [name],

0 commit comments

Comments
 (0)