@@ -60,11 +60,10 @@ class HostSpecificConfiguration(object):
60
60
61
61
"""Configuration information for an individual host."""
62
62
63
- def __init__ (self , host_target , invocation ):
63
+ def __init__ (self , host_target , args ):
64
64
"""Initialize for the given `host_target`."""
65
65
66
66
# Compute the set of deployment targets to configure/build.
67
- args = invocation .args
68
67
if host_target == args .host_target :
69
68
# This host is the user's desired product, so honor the requested
70
69
# set of targets to configure/build.
@@ -81,6 +80,17 @@ class HostSpecificConfiguration(object):
81
80
stdlib_targets_to_configure = [host_target ]
82
81
stdlib_targets_to_build = set (stdlib_targets_to_configure )
83
82
83
+ # Compute derived information from the arguments.
84
+ #
85
+ # FIXME: We should move the platform-derived arguments to be entirely
86
+ # data driven, so that we can eliminate this code duplication and just
87
+ # iterate over all supported platforms.
88
+ platforms_to_skip_build = self .__platforms_to_skip_build (args )
89
+ platforms_to_skip_test = self .__platforms_to_skip_test (args )
90
+ platforms_archs_to_skip_test = \
91
+ self .__platforms_archs_to_skip_test (args )
92
+ platforms_to_skip_test_host = self .__platforms_to_skip_test_host (args )
93
+
84
94
# Compute the lists of **CMake** targets for each use case (configure
85
95
# vs. build vs. run) and the SDKs to configure with.
86
96
self .sdks_to_configure = set ()
@@ -107,9 +117,9 @@ class HostSpecificConfiguration(object):
107
117
108
118
# Compute which actions are desired.
109
119
build = (
110
- deployment_platform not in invocation . platforms_to_skip_build )
120
+ deployment_platform not in platforms_to_skip_build )
111
121
test = (
112
- deployment_platform not in invocation . platforms_to_skip_test )
122
+ deployment_platform not in platforms_to_skip_test )
113
123
test_host_only = None
114
124
dt_supports_benchmark = deployment_target .supports_benchmark
115
125
build_benchmarks = build and dt_supports_benchmark
@@ -124,12 +134,12 @@ class HostSpecificConfiguration(object):
124
134
# the host (i.e., they do not attempt to execute).
125
135
if deployment_platform .uses_host_tests and \
126
136
deployment_platform not in \
127
- invocation . platforms_to_skip_test_host :
137
+ platforms_to_skip_test_host :
128
138
test_host_only = True
129
139
130
140
name = deployment_target .name
131
141
132
- for skip_test_arch in invocation . platforms_archs_to_skip_test :
142
+ for skip_test_arch in platforms_archs_to_skip_test :
133
143
if deployment_target .name == skip_test_arch .name :
134
144
test = False
135
145
@@ -192,6 +202,90 @@ class HostSpecificConfiguration(object):
192
202
"check-swift{}-optimize_none_implicit_dynamic-{}"
193
203
.format (subset_suffix , name ))
194
204
205
+ def __platforms_to_skip_build (self , args ):
206
+ platforms_to_skip_build = set ()
207
+ if not args .build_linux :
208
+ platforms_to_skip_build .add (StdlibDeploymentTarget .Linux )
209
+ if not args .build_freebsd :
210
+ platforms_to_skip_build .add (StdlibDeploymentTarget .FreeBSD )
211
+ if not args .build_cygwin :
212
+ platforms_to_skip_build .add (StdlibDeploymentTarget .Cygwin )
213
+ if not args .build_osx :
214
+ platforms_to_skip_build .add (StdlibDeploymentTarget .OSX )
215
+ if not args .build_ios_device :
216
+ platforms_to_skip_build .add (StdlibDeploymentTarget .iOS )
217
+ if not args .build_ios_simulator :
218
+ platforms_to_skip_build .add (StdlibDeploymentTarget .iOSSimulator )
219
+ if not args .build_tvos_device :
220
+ platforms_to_skip_build .add (StdlibDeploymentTarget .AppleTV )
221
+ if not args .build_tvos_simulator :
222
+ platforms_to_skip_build .add (
223
+ StdlibDeploymentTarget .AppleTVSimulator )
224
+ if not args .build_watchos_device :
225
+ platforms_to_skip_build .add (StdlibDeploymentTarget .AppleWatch )
226
+ if not args .build_watchos_simulator :
227
+ platforms_to_skip_build .add (
228
+ StdlibDeploymentTarget .AppleWatchSimulator )
229
+ if not args .build_android :
230
+ platforms_to_skip_build .add (StdlibDeploymentTarget .Android )
231
+ return platforms_to_skip_build
232
+
233
+ def __platforms_to_skip_test (self , args ):
234
+ platforms_to_skip_test = set ()
235
+ if not args .test_linux :
236
+ platforms_to_skip_test .add (StdlibDeploymentTarget .Linux )
237
+ if not args .test_freebsd :
238
+ platforms_to_skip_test .add (StdlibDeploymentTarget .FreeBSD )
239
+ if not args .test_cygwin :
240
+ platforms_to_skip_test .add (StdlibDeploymentTarget .Cygwin )
241
+ if not args .test_osx :
242
+ platforms_to_skip_test .add (StdlibDeploymentTarget .OSX )
243
+ if not args .test_ios_host :
244
+ platforms_to_skip_test .add (StdlibDeploymentTarget .iOS )
245
+ else :
246
+ exit_rejecting_arguments ("error: iOS device tests are not " +
247
+ "supported in open-source Swift." )
248
+ if not args .test_ios_simulator :
249
+ platforms_to_skip_test .add (StdlibDeploymentTarget .iOSSimulator )
250
+ if not args .test_tvos_host :
251
+ platforms_to_skip_test .add (StdlibDeploymentTarget .AppleTV )
252
+ else :
253
+ exit_rejecting_arguments ("error: tvOS device tests are not " +
254
+ "supported in open-source Swift." )
255
+ if not args .test_tvos_simulator :
256
+ platforms_to_skip_test .add (StdlibDeploymentTarget .AppleTVSimulator )
257
+ if not args .test_watchos_host :
258
+ platforms_to_skip_test .add (StdlibDeploymentTarget .AppleWatch )
259
+ else :
260
+ exit_rejecting_arguments ("error: watchOS device tests are not " +
261
+ "supported in open-source Swift." )
262
+ if not args .test_watchos_simulator :
263
+ platforms_to_skip_test .add (
264
+ StdlibDeploymentTarget .AppleWatchSimulator )
265
+ if not args .test_android :
266
+ platforms_to_skip_test .add (StdlibDeploymentTarget .Android )
267
+
268
+ return platforms_to_skip_test
269
+
270
+ def __platforms_archs_to_skip_test (self , args ):
271
+ platforms_archs_to_skip_test = set ()
272
+ if not args .test_ios_32bit_simulator :
273
+ platforms_archs_to_skip_test .add (
274
+ StdlibDeploymentTarget .iOSSimulator .i386 )
275
+ return platforms_archs_to_skip_test
276
+
277
+ def __platforms_to_skip_test_host (self , args ):
278
+ platforms_to_skip_test_host = set ()
279
+ if not args .test_android_host :
280
+ platforms_to_skip_test_host .add (StdlibDeploymentTarget .Android )
281
+ if not args .test_ios_host :
282
+ platforms_to_skip_test_host .add (StdlibDeploymentTarget .iOS )
283
+ if not args .test_tvos_host :
284
+ platforms_to_skip_test_host .add (StdlibDeploymentTarget .AppleTV )
285
+ if not args .test_watchos_host :
286
+ platforms_to_skip_test_host .add (StdlibDeploymentTarget .AppleWatch )
287
+ return platforms_to_skip_test_host
288
+
195
289
196
290
class BuildScriptInvocation (object ):
197
291
@@ -323,104 +417,8 @@ class BuildScriptInvocation(object):
323
417
source_root = SWIFT_SOURCE_ROOT ,
324
418
build_root = os .path .join (SWIFT_BUILD_ROOT , args .build_subdir ))
325
419
326
- # Compute derived information from the arguments.
327
- #
328
- # FIXME: We should move the platform-derived arguments to be entirely
329
- # data driven, so that we can eliminate this code duplication and just
330
- # iterate over all supported platforms.
331
- self .platforms_to_skip_build = self .__platforms_to_skip_build (args )
332
- self .platforms_to_skip_test = self .__platforms_to_skip_test (args )
333
- self .platforms_archs_to_skip_test = \
334
- self .__platforms_archs_to_skip_test (args )
335
- self .platforms_to_skip_test_host = \
336
- self .__platforms_to_skip_test_host (args )
337
-
338
420
self .build_libparser_only = args .build_libparser_only
339
421
340
- def __platforms_to_skip_build (self , args ):
341
- platforms_to_skip_build = set ()
342
- if not args .build_linux :
343
- platforms_to_skip_build .add (StdlibDeploymentTarget .Linux )
344
- if not args .build_freebsd :
345
- platforms_to_skip_build .add (StdlibDeploymentTarget .FreeBSD )
346
- if not args .build_cygwin :
347
- platforms_to_skip_build .add (StdlibDeploymentTarget .Cygwin )
348
- if not args .build_osx :
349
- platforms_to_skip_build .add (StdlibDeploymentTarget .OSX )
350
- if not args .build_ios_device :
351
- platforms_to_skip_build .add (StdlibDeploymentTarget .iOS )
352
- if not args .build_ios_simulator :
353
- platforms_to_skip_build .add (StdlibDeploymentTarget .iOSSimulator )
354
- if not args .build_tvos_device :
355
- platforms_to_skip_build .add (StdlibDeploymentTarget .AppleTV )
356
- if not args .build_tvos_simulator :
357
- platforms_to_skip_build .add (
358
- StdlibDeploymentTarget .AppleTVSimulator )
359
- if not args .build_watchos_device :
360
- platforms_to_skip_build .add (StdlibDeploymentTarget .AppleWatch )
361
- if not args .build_watchos_simulator :
362
- platforms_to_skip_build .add (
363
- StdlibDeploymentTarget .AppleWatchSimulator )
364
- if not args .build_android :
365
- platforms_to_skip_build .add (StdlibDeploymentTarget .Android )
366
- return platforms_to_skip_build
367
-
368
- def __platforms_to_skip_test (self , args ):
369
- platforms_to_skip_test = set ()
370
- if not args .test_linux :
371
- platforms_to_skip_test .add (StdlibDeploymentTarget .Linux )
372
- if not args .test_freebsd :
373
- platforms_to_skip_test .add (StdlibDeploymentTarget .FreeBSD )
374
- if not args .test_cygwin :
375
- platforms_to_skip_test .add (StdlibDeploymentTarget .Cygwin )
376
- if not args .test_osx :
377
- platforms_to_skip_test .add (StdlibDeploymentTarget .OSX )
378
- if not args .test_ios_host :
379
- platforms_to_skip_test .add (StdlibDeploymentTarget .iOS )
380
- else :
381
- exit_rejecting_arguments ("error: iOS device tests are not " +
382
- "supported in open-source Swift." )
383
- if not args .test_ios_simulator :
384
- platforms_to_skip_test .add (StdlibDeploymentTarget .iOSSimulator )
385
- if not args .test_tvos_host :
386
- platforms_to_skip_test .add (StdlibDeploymentTarget .AppleTV )
387
- else :
388
- exit_rejecting_arguments ("error: tvOS device tests are not " +
389
- "supported in open-source Swift." )
390
- if not args .test_tvos_simulator :
391
- platforms_to_skip_test .add (StdlibDeploymentTarget .AppleTVSimulator )
392
- if not args .test_watchos_host :
393
- platforms_to_skip_test .add (StdlibDeploymentTarget .AppleWatch )
394
- else :
395
- exit_rejecting_arguments ("error: watchOS device tests are not " +
396
- "supported in open-source Swift." )
397
- if not args .test_watchos_simulator :
398
- platforms_to_skip_test .add (
399
- StdlibDeploymentTarget .AppleWatchSimulator )
400
- if not args .test_android :
401
- platforms_to_skip_test .add (StdlibDeploymentTarget .Android )
402
-
403
- return platforms_to_skip_test
404
-
405
- def __platforms_archs_to_skip_test (self , args ):
406
- platforms_archs_to_skip_test = set ()
407
- if not args .test_ios_32bit_simulator :
408
- platforms_archs_to_skip_test .add (
409
- StdlibDeploymentTarget .iOSSimulator .i386 )
410
- return platforms_archs_to_skip_test
411
-
412
- def __platforms_to_skip_test_host (self , args ):
413
- platforms_to_skip_test_host = set ()
414
- if not args .test_android_host :
415
- platforms_to_skip_test_host .add (StdlibDeploymentTarget .Android )
416
- if not args .test_ios_host :
417
- platforms_to_skip_test_host .add (StdlibDeploymentTarget .iOS )
418
- if not args .test_tvos_host :
419
- platforms_to_skip_test_host .add (StdlibDeploymentTarget .AppleTV )
420
- if not args .test_watchos_host :
421
- platforms_to_skip_test_host .add (StdlibDeploymentTarget .AppleWatch )
422
- return platforms_to_skip_test_host
423
-
424
422
def initialize_runtime_environment (self ):
425
423
"""Change the program environment for building."""
426
424
@@ -838,7 +836,7 @@ class BuildScriptInvocation(object):
838
836
options = {}
839
837
for host_target in [args .host_target ] + args .cross_compile_hosts :
840
838
# Compute the host specific configuration.
841
- config = HostSpecificConfiguration (host_target , self )
839
+ config = HostSpecificConfiguration (host_target , args )
842
840
843
841
# Convert into `build-script-impl` style variables.
844
842
options [host_target ] = {
@@ -936,7 +934,7 @@ class BuildScriptInvocation(object):
936
934
# Build...
937
935
for host_target in all_hosts :
938
936
# FIXME: We should only compute these once.
939
- config = HostSpecificConfiguration (host_target .name , self )
937
+ config = HostSpecificConfiguration (host_target .name , self . args )
940
938
print ("Building the standard library for: {}" .format (
941
939
" " .join (config .swift_stdlib_build_targets )))
942
940
if config .swift_test_run_targets and (
0 commit comments