@@ -135,26 +135,27 @@ def export_sdk(tgt, swift_source_tree, swift_build_tree):
135135 ignore = shutil .ignore_patterns ('CMakeLists.txt' ))
136136
137137
138+ def export_toolchain (tgt , toolchain_dir ):
139+ print ("assembling toolchain" )
140+ shutil .copytree (toolchain_dir , tgt )
141+
142+
138143def export_stdlibs (exported_dir , swift_build_tree ):
139144 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'
144146 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 ):
154157 print (f'Copying { stdlib } ' )
155- shutil .copy (lib_path , exported_dir )
156- else :
157- print (f'Skipping { stdlib } ' )
158+ shutil .copy (stdlib , exported_dir )
158159
159160
160161def export_libs (exported_dir , libs , swift_build_tree ):
@@ -193,6 +194,7 @@ def main(opts):
193194 os .mkdir (tmp )
194195 llvm_build_tree = next (opts .build_tree .glob ("llvm-*" ))
195196 swift_build_tree = next (opts .build_tree .glob ("swift-*" ))
197+ toolchain_dir = next (opts .build_tree .glob ("toolchain-*/codeql-toolchain" ))
196198 earlyswiftsyntax_build_tree = next (opts .build_tree .glob ("earlyswiftsyntax-*" ))
197199 configured = configure_dummy_project (tmp , prefixes = [llvm_build_tree , swift_build_tree ,
198200 earlyswiftsyntax_build_tree / "cmake" / "modules" ])
@@ -203,6 +205,7 @@ def main(opts):
203205 export_libs (exported , libs , swift_build_tree )
204206 export_headers (exported , opts .swift_source_tree , llvm_build_tree , swift_build_tree )
205207 export_sdk (exported / "sdk" , opts .swift_source_tree , swift_build_tree )
208+ export_toolchain (exported / "toolchain" , toolchain_dir )
206209
207210 zip_dir (exported , opts .output )
208211
0 commit comments