Skip to content

Commit 3ebb554

Browse files
authored
[build] Restore previous semantics of stdlib-deployment-targets test (swiftlang#38848)
For historical reasons, we configure and build standard library targets differently depending on whether `stdlib-deployment-targets` is no set or set to `[]`. Add a test to make this need more explicit. Addresses rdar://81651877
1 parent 06686a9 commit 3ebb554

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

utils/swift_build_support/swift_build_support/host_specific_configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def __init__(self, host_target, args, stage_dependent_args=None):
5555
else:
5656
stdlib_targets_to_build = set(stdlib_targets_to_configure)
5757

58-
if stage_dependent_args.stdlib_deployment_targets and \
58+
if hasattr(stage_dependent_args, 'stdlib_deployment_targets') and \
5959
stage_dependent_args.stdlib_deployment_targets == []:
6060
stdlib_targets_to_configure = []
6161
stdlib_targets_to_build = []

utils/swift_build_support/tests/test_host_specific_configuration.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ def test_should_only_configure_when_cross_compiling_different_stdlib_targets(sel
101101

102102
self.assertEqual(len(hsc.swift_stdlib_build_targets), 0)
103103

104+
def test_should_not_build_stdlib_when_targets_are_empty(self):
105+
args = self.default_args()
106+
args.host_target = 'macosx-x86_64'
107+
args.stdlib_deployment_targets = []
108+
109+
hsc = HostSpecificConfiguration('macosx-arm64', args)
110+
111+
self.assertEqual(len(hsc.sdks_to_configure), 0)
112+
113+
self.assertEqual(len(hsc.swift_stdlib_build_targets), 0)
114+
104115
def generate_should_skip_building_platform(
105116
host_target, sdk_name, build_target, build_arg_name):
106117
def test(self):

0 commit comments

Comments
 (0)