@@ -135,26 +135,27 @@ def export_sdk(tgt, swift_source_tree, swift_build_tree):
135
135
ignore = shutil .ignore_patterns ('CMakeLists.txt' ))
136
136
137
137
138
+ def export_toolchain (tgt , toolchain_dir ):
139
+ print ("assembling toolchain" )
140
+ shutil .copytree (toolchain_dir , tgt )
141
+
142
+
138
143
def export_stdlibs (exported_dir , swift_build_tree ):
139
144
ext = 'dylib'
140
- platform = 'macosx'
141
- if get_platform () == "linux" :
142
- platform = 'linux'
143
- ext = 'so'
145
+ platform = 'linux' if get_platform () == 'linux' else 'macosx'
144
146
lib_dir = swift_build_tree / 'lib/swift' / platform
145
- stdlibs = [
146
- f'libswiftCore.{ ext } ' ,
147
- 'libswiftCompatibility50.a' ,
148
- 'libswiftCompatibility51.a' ,
149
- 'libswiftCompatibilityConcurrency.a' ,
150
- 'libswiftCompatibilityDynamicReplacements.a' ]
151
- for stdlib in stdlibs :
152
- lib_path = lib_dir / stdlib
153
- if lib_path .exists ():
147
+ patterns = [f'lib{ dep } .*' for dep in (
148
+ "dispatch" ,
149
+ "BlocksRuntime" ,
150
+ "swiftCore" ,
151
+ "swift_*" ,
152
+ "swiftGlibc" ,
153
+ "swiftCompatibility*" ,
154
+ )]
155
+ for pattern in patterns :
156
+ for stdlib in lib_dir .glob (pattern ):
154
157
print (f'Copying { stdlib } ' )
155
- shutil .copy (lib_path , exported_dir )
156
- else :
157
- print (f'Skipping { stdlib } ' )
158
+ shutil .copy (stdlib , exported_dir )
158
159
159
160
160
161
def export_libs (exported_dir , libs , swift_build_tree ):
@@ -193,6 +194,7 @@ def main(opts):
193
194
os .mkdir (tmp )
194
195
llvm_build_tree = next (opts .build_tree .glob ("llvm-*" ))
195
196
swift_build_tree = next (opts .build_tree .glob ("swift-*" ))
197
+ toolchain_dir = next (opts .build_tree .glob ("toolchain-*/codeql-toolchain" ))
196
198
earlyswiftsyntax_build_tree = next (opts .build_tree .glob ("earlyswiftsyntax-*" ))
197
199
configured = configure_dummy_project (tmp , prefixes = [llvm_build_tree , swift_build_tree ,
198
200
earlyswiftsyntax_build_tree / "cmake" / "modules" ])
@@ -203,6 +205,7 @@ def main(opts):
203
205
export_libs (exported , libs , swift_build_tree )
204
206
export_headers (exported , opts .swift_source_tree , llvm_build_tree , swift_build_tree )
205
207
export_sdk (exported / "sdk" , opts .swift_source_tree , swift_build_tree )
208
+ export_toolchain (exported / "toolchain" , toolchain_dir )
206
209
207
210
zip_dir (exported , opts .output )
208
211
0 commit comments