Skip to content

Commit ea2d44e

Browse files
committed
[build-script] Don't build stdlib for iOS if --skip-build-ios is passed
1 parent cfae1a3 commit ea2d44e

File tree

2 files changed

+35
-27
lines changed

2 files changed

+35
-27
lines changed

utils/build-script

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,40 @@ class BuildScriptInvocation(object):
132132
"--legacy-impl is incompatible with building packages needing "
133133
"a toolchain (%s)" % ", ".join(targets_needing_toolchain))
134134

135+
@staticmethod
136+
def default_stdlib_deployment_targets(args):
137+
"""
138+
Return targets for the Swift stdlib, based on the build machine.
139+
If the build machine is not one of the recognized ones, return None.
140+
"""
141+
142+
host_target = StdlibDeploymentTarget.host_target()
143+
if host_target is None:
144+
return None
145+
146+
# OS X build machines configure all Darwin platforms by default.
147+
# Put iOS native targets last so that we test them last
148+
# (it takes a long time).
149+
if host_target == StdlibDeploymentTarget.OSX.x86_64:
150+
targets = [host_target]
151+
if args.build_ios and args.build_ios_simulator:
152+
targets.extend(StdlibDeploymentTarget.iOSSimulator.targets)
153+
if args.build_ios and args.build_ios_device:
154+
targets.extend(StdlibDeploymentTarget.iOS.targets)
155+
if args.build_tvos and args.build_tvos_simulator:
156+
targets.extend(StdlibDeploymentTarget.AppleTVSimulator.targets)
157+
if args.build_tvos and args.build_tvos_device:
158+
targets.extend(StdlibDeploymentTarget.AppleTV.targets)
159+
if args.build_watchos and args.build_watchos_simulator:
160+
targets.extend(StdlibDeploymentTarget.AppleWatchSimulator.targets)
161+
if args.build_watchos and args.build_watchos_device:
162+
targets.extend(StdlibDeploymentTarget.AppleWatch.targets)
163+
return targets
164+
else:
165+
# All other machines only configure their host stdlib by default.
166+
return [host_target]
167+
168+
135169
@staticmethod
136170
def apply_default_arguments(toolchain, args):
137171
# Infer if ninja is required
@@ -144,7 +178,7 @@ class BuildScriptInvocation(object):
144178
# Set the default stdlib-deployment-targets, if none were provided.
145179
if args.stdlib_deployment_targets is None:
146180
stdlib_targets = \
147-
StdlibDeploymentTarget.default_stdlib_deployment_targets()
181+
BuildScriptInvocation.default_stdlib_deployment_targets(args)
148182
args.stdlib_deployment_targets = [
149183
target.name for target in stdlib_targets]
150184

utils/swift_build_support/swift_build_support/targets.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -228,32 +228,6 @@ def host_target():
228228
raise NotImplementedError('System "%s" with architecture "%s" is not '
229229
'supported' % (system, machine))
230230

231-
@staticmethod
232-
def default_stdlib_deployment_targets():
233-
"""
234-
Return targets for the Swift stdlib, based on the build machine.
235-
If the build machine is not one of the recognized ones, return None.
236-
"""
237-
238-
host_target = StdlibDeploymentTarget.host_target()
239-
if host_target is None:
240-
return None
241-
242-
# OS X build machines configure all Darwin platforms by default.
243-
# Put iOS native targets last so that we test them last
244-
# (it takes a long time).
245-
if host_target == StdlibDeploymentTarget.OSX.x86_64:
246-
return [host_target] + \
247-
StdlibDeploymentTarget.iOSSimulator.targets + \
248-
StdlibDeploymentTarget.AppleTVSimulator.targets + \
249-
StdlibDeploymentTarget.AppleWatchSimulator.targets + \
250-
StdlibDeploymentTarget.iOS.targets + \
251-
StdlibDeploymentTarget.AppleTV.targets + \
252-
StdlibDeploymentTarget.AppleWatch.targets
253-
else:
254-
# All other machines only configure their host stdlib by default.
255-
return [host_target]
256-
257231
@classmethod
258232
def get_target_for_name(cls, name):
259233
return cls._targets_by_name.get(name)

0 commit comments

Comments
 (0)