Skip to content
This repository was archived by the owner on Jan 25, 2024. It is now read-only.

Commit 575b819

Browse files
allevatoswiple-rules-gardener
authored andcommitted
Remove the swift.implicit_modules feature.
This feature permitted an odd three-state situation around the way the implicit module cache is handled: 1. The so-called "global module cache", which is placed in `bazel-out` 2. The ephemeral module cache, which is created and destroyed around each compile action 3. A state where no flags related to the implicit module cache are passed to the compiler, meaning "do whatever the compiler does by default". This third state is the one we want to get rid of, since the default is to place the module cache in a temp location outside the sandbox. PiperOrigin-RevId: 344942165
1 parent 5167ae9 commit 575b819

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

swift/internal/compiling.bzl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ load(
4141
"SWIFT_FEATURE_ENABLE_TESTING",
4242
"SWIFT_FEATURE_FASTBUILD",
4343
"SWIFT_FEATURE_FULL_DEBUG_INFO",
44-
"SWIFT_FEATURE_IMPLICIT_MODULES",
4544
"SWIFT_FEATURE_INDEX_WHILE_BUILDING",
4645
"SWIFT_FEATURE_MINIMAL_DEPS",
4746
"SWIFT_FEATURE_MODULE_MAP_HOME_IS_CWD",
@@ -350,10 +349,8 @@ def compile_action_configs():
350349
swift_toolchain_config.action_config(
351350
actions = [swift_action_names.COMPILE],
352351
configurators = [_global_module_cache_configurator],
353-
features = [
354-
SWIFT_FEATURE_IMPLICIT_MODULES,
355-
SWIFT_FEATURE_USE_GLOBAL_MODULE_CACHE,
356-
],
352+
features = [SWIFT_FEATURE_USE_GLOBAL_MODULE_CACHE],
353+
not_features = [SWIFT_FEATURE_USE_C_MODULES],
357354
),
358355
swift_toolchain_config.action_config(
359356
actions = [swift_action_names.COMPILE],
@@ -362,8 +359,10 @@ def compile_action_configs():
362359
"-Xwrapped-swift=-ephemeral-module-cache",
363360
),
364361
],
365-
features = [SWIFT_FEATURE_IMPLICIT_MODULES],
366-
not_features = [SWIFT_FEATURE_USE_GLOBAL_MODULE_CACHE],
362+
not_features = [
363+
[SWIFT_FEATURE_USE_C_MODULES],
364+
[SWIFT_FEATURE_USE_GLOBAL_MODULE_CACHE],
365+
],
367366
),
368367
swift_toolchain_config.action_config(
369368
actions = [

swift/internal/feature_names.bzl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,6 @@ SWIFT_FEATURE_ENABLE_TESTING = "swift.enable_testing"
9494
# warnings otherwise.
9595
SWIFT_FEATURE_FULL_DEBUG_INFO = "swift.full_debug_info"
9696

97-
# If enabled, ClangImporter will perform implicit search for module maps and
98-
# compile modules in the implicit module cache for any that were not provided
99-
# explicitly on the command line. Otherwise, all modules must be provided
100-
# explicitly.
101-
SWIFT_FEATURE_IMPLICIT_MODULES = "swift.implicit_modules"
102-
10397
# If enabled, the compilation action for a target will produce an index store.
10498
SWIFT_FEATURE_INDEX_WHILE_BUILDING = "swift.index_while_building"
10599

swift/internal/swift_autoconfiguration.bzl

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ load(
2828
"@build_bazel_rules_swift//swift/internal:feature_names.bzl",
2929
"SWIFT_FEATURE_DEBUG_PREFIX_MAP",
3030
"SWIFT_FEATURE_ENABLE_BATCH_MODE",
31-
"SWIFT_FEATURE_IMPLICIT_MODULES",
3231
"SWIFT_FEATURE_MODULE_MAP_NO_PRIVATE_HEADERS",
3332
"SWIFT_FEATURE_SUPPORTS_PRIVATE_DEPS",
3433
"SWIFT_FEATURE_USE_RESPONSE_FILES",
@@ -207,12 +206,6 @@ def _create_linux_toolchain(repository_ctx):
207206
feature_values = _compute_feature_values(repository_ctx, path_to_swiftc)
208207
version_file = _write_swift_version(repository_ctx, path_to_swiftc)
209208

210-
# TODO: This is being enabled here, rather than in the toolchain rule
211-
# implementations, so that we can provide a way to optionally turn it off
212-
# later when we have a way to model modules from outside Bazel workspaces
213-
# (i.e., from the Swift toolchain) as explicit modules.
214-
feature_values.append(SWIFT_FEATURE_IMPLICIT_MODULES)
215-
216209
# TODO: This should be removed so that private headers can be used with
217210
# explicit modules, but the build targets for CgRPC need to be cleaned up
218211
# first because they contain C++ code.
@@ -253,12 +246,6 @@ def _create_xcode_toolchain(repository_ctx):
253246
repository_ctx: The repository rule context.
254247
"""
255248
feature_values = [
256-
# TODO: This is being enabled here, rather than in the toolchain rule
257-
# implementations, so that we can provide a way to optionally turn it
258-
# off later when we have a way to model modules from outside Bazel
259-
# workspaces (i.e., from the Swift toolchain and Xcode SDKs) as explicit
260-
# modules.
261-
SWIFT_FEATURE_IMPLICIT_MODULES,
262249
# TODO: This should be removed so that private headers can be used with
263250
# explicit modules, but the build targets for CgRPC need to be cleaned
264251
# up first because they contain C++ code.

0 commit comments

Comments
 (0)