Skip to content

[build-script] Don't build stdlib for iOS if --skip-build-ios is passed #27840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 35 additions & 1 deletion utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,40 @@ class BuildScriptInvocation(object):
"--legacy-impl is incompatible with building packages needing "
"a toolchain (%s)" % ", ".join(targets_needing_toolchain))

@staticmethod
def default_stdlib_deployment_targets(args):
"""
Return targets for the Swift stdlib, based on the build machine.
If the build machine is not one of the recognized ones, return None.
"""

host_target = StdlibDeploymentTarget.host_target()
if host_target is None:
return None

# OS X build machines configure all Darwin platforms by default.
# Put iOS native targets last so that we test them last
# (it takes a long time).
if host_target == StdlibDeploymentTarget.OSX.x86_64:
targets = [host_target]
if args.build_ios and args.build_ios_simulator:
targets.extend(StdlibDeploymentTarget.iOSSimulator.targets)
if args.build_ios and args.build_ios_device:
targets.extend(StdlibDeploymentTarget.iOS.targets)
if args.build_tvos and args.build_tvos_simulator:
targets.extend(StdlibDeploymentTarget.AppleTVSimulator.targets)
if args.build_tvos and args.build_tvos_device:
targets.extend(StdlibDeploymentTarget.AppleTV.targets)
if args.build_watchos and args.build_watchos_simulator:
targets.extend(StdlibDeploymentTarget.AppleWatchSimulator.targets)
if args.build_watchos and args.build_watchos_device:
targets.extend(StdlibDeploymentTarget.AppleWatch.targets)
return targets
else:
# All other machines only configure their host stdlib by default.
return [host_target]


@staticmethod
def apply_default_arguments(toolchain, args):
# Infer if ninja is required
Expand All @@ -144,7 +178,7 @@ class BuildScriptInvocation(object):
# Set the default stdlib-deployment-targets, if none were provided.
if args.stdlib_deployment_targets is None:
stdlib_targets = \
StdlibDeploymentTarget.default_stdlib_deployment_targets()
BuildScriptInvocation.default_stdlib_deployment_targets(args)
args.stdlib_deployment_targets = [
target.name for target in stdlib_targets]

Expand Down
26 changes: 0 additions & 26 deletions utils/swift_build_support/swift_build_support/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,32 +228,6 @@ def host_target():
raise NotImplementedError('System "%s" with architecture "%s" is not '
'supported' % (system, machine))

@staticmethod
def default_stdlib_deployment_targets():
"""
Return targets for the Swift stdlib, based on the build machine.
If the build machine is not one of the recognized ones, return None.
"""

host_target = StdlibDeploymentTarget.host_target()
if host_target is None:
return None

# OS X build machines configure all Darwin platforms by default.
# Put iOS native targets last so that we test them last
# (it takes a long time).
if host_target == StdlibDeploymentTarget.OSX.x86_64:
return [host_target] + \
StdlibDeploymentTarget.iOSSimulator.targets + \
StdlibDeploymentTarget.AppleTVSimulator.targets + \
StdlibDeploymentTarget.AppleWatchSimulator.targets + \
StdlibDeploymentTarget.iOS.targets + \
StdlibDeploymentTarget.AppleTV.targets + \
StdlibDeploymentTarget.AppleWatch.targets
else:
# All other machines only configure their host stdlib by default.
return [host_target]

@classmethod
def get_target_for_name(cls, name):
return cls._targets_by_name.get(name)
Expand Down