@@ -15,6 +15,31 @@ def get_immediate_subdirectories(a_dir):
15
15
if os .path .isdir (os .path .join (a_dir , name ))]
16
16
17
17
18
+ def collect_catalyst_frameworks (frameworks_path ):
19
+ names = []
20
+ for frame in os .listdir (frameworks_path ):
21
+ if frame .endswith (".framework" ):
22
+ name = frame [:- len (".framework" )]
23
+ # using the existence of this interface file as a sign of catalyst
24
+ # being supported
25
+ macabi_interface_path = \
26
+ os .path .join (frameworks_path , frame ,
27
+ 'Modules' , name + '.swiftmodule' ,
28
+ 'x86_64-apple-ios-macabi.swiftinterface' )
29
+ if os .path .exists (macabi_interface_path ):
30
+ if name not in blacklist :
31
+ names .append (name )
32
+ return names
33
+
34
+
35
+ def get_catalyst_frameworks (sdk_path ):
36
+ frameworks_path = sdk_path + "/System/Library/Frameworks"
37
+ ios_support_path = sdk_path + \
38
+ '/System/iOSSupport/System/Library/Frameworks/'
39
+ return collect_catalyst_frameworks (frameworks_path ) + \
40
+ collect_catalyst_frameworks (ios_support_path )
41
+
42
+
18
43
def get_frameworks (sdk_path , swift_frameworks_only ):
19
44
frameworks_path = sdk_path + "/System/Library/Frameworks"
20
45
names = []
@@ -113,6 +138,7 @@ def main():
113
138
parser .add_option ("--swift-frameworks-only" , action = "store_true" )
114
139
parser .add_option ("--swift-overlay-only" , action = "store_true" )
115
140
parser .add_option ("--v" , action = "store_true" )
141
+ parser .add_option ("--catalyst" , action = "store_true" )
116
142
(opts , cmd ) = parser .parse_args ()
117
143
118
144
if not opts .sdk :
@@ -125,7 +151,14 @@ def main():
125
151
if opts .swift_overlay_only :
126
152
frames = get_overlays (opts .sdk )
127
153
else :
128
- frames = get_frameworks (opts .sdk , opts .swift_frameworks_only )
154
+ if opts .catalyst :
155
+ if opts .swift_frameworks_only :
156
+ frames = get_catalyst_frameworks (opts .sdk )
157
+ else :
158
+ parser .error ("only support find catalyst frameworks "
159
+ "with --swift-frameworks-only" )
160
+ else :
161
+ frames = get_frameworks (opts .sdk , opts .swift_frameworks_only )
129
162
if opts .v :
130
163
for name in frames :
131
164
print >> sys .stderr , 'Including: ' , name
0 commit comments