@@ -132,6 +132,40 @@ class BuildScriptInvocation(object):
132
132
"--legacy-impl is incompatible with building packages needing "
133
133
"a toolchain (%s)" % ", " .join (targets_needing_toolchain ))
134
134
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
+
135
169
@staticmethod
136
170
def apply_default_arguments (toolchain , args ):
137
171
# Infer if ninja is required
@@ -144,7 +178,7 @@ class BuildScriptInvocation(object):
144
178
# Set the default stdlib-deployment-targets, if none were provided.
145
179
if args .stdlib_deployment_targets is None :
146
180
stdlib_targets = \
147
- StdlibDeploymentTarget .default_stdlib_deployment_targets ()
181
+ BuildScriptInvocation .default_stdlib_deployment_targets (args )
148
182
args .stdlib_deployment_targets = [
149
183
target .name for target in stdlib_targets ]
150
184
0 commit comments