File tree Expand file tree Collapse file tree 3 files changed +23
-14
lines changed
swift_build_support/swift_build_support Expand file tree Collapse file tree 3 files changed +23
-14
lines changed Original file line number Diff line number Diff line change 33
33
]
34
34
35
35
36
- _SDK_TARGETS = {
37
- 'OSX' : StdlibDeploymentTarget .OSX .targets ,
38
- 'IOS' : StdlibDeploymentTarget .iOS .targets ,
39
- 'IOS_SIMULATOR' : StdlibDeploymentTarget .iOSSimulator .targets ,
40
- 'TVOS' : StdlibDeploymentTarget .AppleTV .targets ,
41
- 'TVOS_SIMULATOR' : StdlibDeploymentTarget .AppleTVSimulator .targets ,
42
- 'WATCHOS' : StdlibDeploymentTarget .AppleWatch .targets ,
43
- 'WATCHOS_SIMULATOR' : StdlibDeploymentTarget .AppleWatchSimulator .targets ,
44
- }
45
-
46
-
47
36
# -----------------------------------------------------------------------------
48
37
49
38
class UnknownSDKError (Exception ):
@@ -70,7 +59,7 @@ def _flatten(iterable):
70
59
return itertools .chain .from_iterable (iterable )
71
60
72
61
def _swift_sdk_to_stdlib_targets (sdk ):
73
- targets = _SDK_TARGETS . get (sdk , None )
62
+ targets = StdlibDeploymentTarget . get_migrated_targets_for_sdk (sdk )
74
63
if targets is None :
75
64
raise UnknownSDKError (sdk )
76
65
Original file line number Diff line number Diff line change 18
18
19
19
import six
20
20
21
+ from swift_build_support .swift_build_support .targets import StdlibDeploymentTarget
22
+
21
23
22
24
# -----------------------------------------------------------------------------
23
25
# Helpers
24
26
25
27
def _get_sdk_targets (sdk_names ):
26
28
targets = []
27
29
for sdk_name in sdk_names :
28
- targets += migration . _SDK_TARGETS [ sdk_name ]
30
+ targets += StdlibDeploymentTarget . get_migrated_targets_for_sdk ( sdk_name )
29
31
30
32
return targets
31
33
@@ -43,7 +45,7 @@ class TestMigrateSwiftSDKsMeta(type):
43
45
44
46
def __new__ (cls , name , bases , attrs ):
45
47
# Generate tests for migrating each Swift SDK
46
- for sdk_name in migration . _SDK_TARGETS . keys ():
48
+ for sdk_name in StdlibDeploymentTarget . get_all_migrated_sdks ():
47
49
test_name = 'test_migrate_swift_sdk_{}' .format (sdk_name )
48
50
attrs [test_name ] = cls .generate_migrate_swift_sdks_test (sdk_name )
49
51
Original file line number Diff line number Diff line change @@ -227,6 +227,16 @@ class StdlibDeploymentTarget(object):
227
227
for platform in known_platforms
228
228
for target in platform .targets )
229
229
230
+ _sdk_targets = {
231
+ 'OSX' : OSX .targets ,
232
+ 'IOS' : iOS .targets ,
233
+ 'IOS_SIMULATOR' : iOSSimulator .targets ,
234
+ 'TVOS' : AppleTV .targets ,
235
+ 'TVOS_SIMULATOR' : AppleTVSimulator .targets ,
236
+ 'WATCHOS' : AppleWatch .targets ,
237
+ 'WATCHOS_SIMULATOR' : AppleWatchSimulator .targets ,
238
+ }
239
+
230
240
@staticmethod
231
241
def host_target ():
232
242
"""
@@ -308,6 +318,14 @@ def get_target_names(cls):
308
318
return sorted ([name for (name , target ) in
309
319
cls ._targets_by_name .items ()])
310
320
321
+ @classmethod
322
+ def get_migrated_targets_for_sdk (cls , sdk_name ):
323
+ return cls ._sdk_targets .get (sdk_name , None )
324
+
325
+ @classmethod
326
+ def get_all_migrated_sdks (cls ):
327
+ return cls ._sdk_targets .keys ()
328
+
311
329
312
330
def install_prefix ():
313
331
"""
You can’t perform that action at this time.
0 commit comments