Skip to content

Commit 32812a3

Browse files
committed
Make the feature_configuration argument mandatory for swift_common APIs.
RELNOTES: The `feature_configuration` argument is now required for the `compile_as_objects`, `compile_as_library`, and `swiftc_command_line_and_inputs` methods in `swift_common`. PiperOrigin-RevId: 241370866
1 parent c36caa7 commit 32812a3

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

swift/internal/api.bzl

Lines changed: 9 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ def _cc_feature_configuration(feature_configuration):
445445
def _compile_as_objects(
446446
actions,
447447
arguments,
448+
feature_configuration,
448449
module_name,
449450
srcs,
450451
target_name,
@@ -457,7 +458,6 @@ def _compile_as_objects(
457458
copts = [],
458459
defines = [],
459460
deps = [],
460-
feature_configuration = None,
461461
genfiles_dir = None,
462462
objc_fragment = None,
463463
swift_fragment = None):
@@ -467,6 +467,8 @@ def _compile_as_objects(
467467
actions: The context's `actions` object.
468468
arguments: A list of `Args` objects that provide additional arguments to the
469469
compiler, not including the `copts` list.
470+
feature_configuration: A feature configuration obtained from
471+
`swift_common.configure_features`.
470472
module_name: The name of the Swift module being compiled. This must be
471473
present and valid; use `swift_common.derive_module_name` to generate a
472474
default from the target's label if needed.
@@ -494,10 +496,6 @@ def _compile_as_objects(
494496
deps: Dependencies of the target being compiled. These targets must
495497
propagate one of the following providers: `CcInfo`,
496498
`SwiftClangModuleInfo`, `SwiftInfo`, or `apple_common.Objc`.
497-
feature_configuration: A feature configuration obtained from
498-
`swift_common.configure_features`. If omitted, a default feature
499-
configuration will be used, but this argument will be required in the
500-
future.
501499
genfiles_dir: The Bazel `*-genfiles` directory root. If provided, its path
502500
is added to ClangImporter's header search paths for compatibility with
503501
Bazel's C++ and Objective-C rules which support inclusions of generated
@@ -531,10 +529,6 @@ def _compile_as_objects(
531529
"""
532530
_ignore = [allow_testing, compilation_mode, configuration, objc_fragment, swift_fragment]
533531

534-
# TODO(b/112900284): Make this a required argument.
535-
if not feature_configuration:
536-
feature_configuration = _configure_features(toolchain)
537-
538532
# Force threaded mode for WMO builds, using the same number of cores that is
539533
# on a Mac Pro for historical reasons.
540534
# TODO(b/32571265): Generalize this based on platform and core count when an
@@ -663,6 +657,7 @@ def _compile_as_objects(
663657
def _compile_as_library(
664658
actions,
665659
bin_dir,
660+
feature_configuration,
666661
label,
667662
module_name,
668663
srcs,
@@ -675,7 +670,6 @@ def _compile_as_library(
675670
copts = [],
676671
defines = [],
677672
deps = [],
678-
feature_configuration = None,
679673
genfiles_dir = None,
680674
library_name = None,
681675
linkopts = [],
@@ -694,6 +688,8 @@ def _compile_as_library(
694688
Args:
695689
actions: The rule context's `actions` object.
696690
bin_dir: The Bazel `*-bin` directory root.
691+
feature_configuration: A feature configuration obtained from
692+
`swift_common.configure_features`.
697693
label: The target label for which the code is being compiled, which is used
698694
to determine unique file paths for the outputs.
699695
module_name: The name of the Swift module being compiled. This must be
@@ -718,10 +714,6 @@ def _compile_as_library(
718714
deps: Dependencies of the target being compiled. These targets must
719715
propagate one of the following providers: `CcInfo`,
720716
`SwiftClangModuleInfo`, `SwiftInfo`, or `apple_common.Objc`.
721-
feature_configuration: A feature configuration obtained from
722-
`swift_common.configure_features`. If omitted, a default feature
723-
configuration will be used, but this argument will be required in the
724-
future.
725717
genfiles_dir: The Bazel `*-genfiles` directory root. If provided, its path
726718
is added to ClangImporter's header search paths for compatibility with
727719
Bazel's C++ and Objective-C rules which support inclusions of generated
@@ -763,10 +755,6 @@ def _compile_as_library(
763755
"""
764756
_ignore = [allow_testing, compilation_mode, configuration, objc_fragment, swift_fragment]
765757

766-
# TODO(b/112900284): Make this a required argument.
767-
if not feature_configuration:
768-
feature_configuration = _configure_features(toolchain)
769-
770758
if not module_name:
771759
fail("'module_name' must be provided. Use " +
772760
"'swift_common.derive_module_name' if necessary to derive one from " +
@@ -1180,6 +1168,7 @@ def _swift_runtime_linkopts(is_static, toolchain, is_test = False):
11801168

11811169
def _swiftc_command_line_and_inputs(
11821170
args,
1171+
feature_configuration,
11831172
module_name,
11841173
srcs,
11851174
toolchain,
@@ -1190,7 +1179,6 @@ def _swiftc_command_line_and_inputs(
11901179
copts = [],
11911180
defines = [],
11921181
deps = [],
1193-
feature_configuration = None,
11941182
genfiles_dir = None,
11951183
objc_fragment = None,
11961184
swift_fragment = None):
@@ -1207,6 +1195,8 @@ def _swiftc_command_line_and_inputs(
12071195
12081196
Args:
12091197
args: An `Args` object into which the command line arguments will be added.
1198+
feature_configuration: A feature configuration obtained from
1199+
`swift_common.configure_features`.
12101200
module_name: The name of the Swift module being compiled. This must be
12111201
present and valid; use `swift_common.derive_module_name` to generate a
12121202
default from the target's label if needed.
@@ -1230,10 +1220,6 @@ def _swiftc_command_line_and_inputs(
12301220
deps: Dependencies of the target being compiled. These targets must
12311221
propagate one of the following providers: `CcInfo`,
12321222
`SwiftClangModuleInfo`, `SwiftInfo`, or `apple_common.Objc`.
1233-
feature_configuration: A feature configuration obtained from
1234-
`swift_common.configure_features`. If omitted, a default feature
1235-
configuration will be used, but this argument will be required in the
1236-
future.
12371223
genfiles_dir: The Bazel `*-genfiles` directory root. If provided, its path
12381224
is added to ClangImporter's header search paths for compatibility with
12391225
Bazel's C++ and Objective-C rules which support inclusions of generated
@@ -1250,10 +1236,6 @@ def _swiftc_command_line_and_inputs(
12501236
"""
12511237
_ignore = [allow_testing, compilation_mode, configuration, objc_fragment, swift_fragment]
12521238

1253-
# TODO(b/112900284): Make this a required argument.
1254-
if not feature_configuration:
1255-
feature_configuration = _configure_features(toolchain)
1256-
12571239
all_deps = deps + toolchain.implicit_deps
12581240

12591241
args.add("-module-name")

0 commit comments

Comments
 (0)