3
3
import sys
4
4
import os
5
5
import argparse
6
- import json
7
6
import datetime
8
7
import re
9
- from typing import Optional
10
8
from build_support .actions import Action , ActionRunner , DownloadBaseSnapshotAction , derive_options_from_args
11
9
from build_support .platform import PlatformInfo
12
10
13
11
12
+ SDK_GENERATOR_PKG_PATH = os .path .join (
13
+ os .path .dirname (__file__ ), ".." , ".." , ".." , "swift-sdk-generator" )
14
+
15
+
14
16
class SnapshotInfo :
15
17
def __init__ (self , year : int , month : int , day : int , swift_version : str , artifact_name : str , daily_snapshot : bool ):
16
18
self .year = year
@@ -117,11 +119,9 @@ class PackageSwiftSDKAction(Action):
117
119
WebAssembly.
118
120
:param wasi_sysroot_path: The path to the WASI sysroot.
119
121
"""
120
- sdk_generator_pkg_path = os .path .join (
121
- os .path .dirname (__file__ ), ".." , ".." , ".." , "swift-sdk-generator" )
122
122
sdk_generator_args = [
123
123
"swift" ,
124
- "run" , "--package-path" , sdk_generator_pkg_path ,
124
+ "run" , "--package-path" , SDK_GENERATOR_PKG_PATH ,
125
125
"--" , "swift-sdk-generator" , "make-wasm-sdk" ,
126
126
"--target-swift-package-path" , target_toolchain_path ,
127
127
"--wasi-sysroot" , wasi_sysroot_path ,
@@ -134,7 +134,7 @@ class PackageSwiftSDKAction(Action):
134
134
self .system (* sdk_generator_args )
135
135
136
136
artifactbundle_path = os .path .join (
137
- sdk_generator_pkg_path , "Bundles" , swift_sdk_name + ".artifactbundle" )
137
+ SDK_GENERATOR_PKG_PATH , "Bundles" , swift_sdk_name + ".artifactbundle" )
138
138
zip_path = os .path .join (
139
139
os .getcwd (), ".." , self .snapshot_info .artifactbundle_zip_name )
140
140
@@ -254,6 +254,14 @@ def main():
254
254
triples += [
255
255
["wasm32-unknown-wasip1-threads" , "wasm32-wasip1-threads" ]
256
256
]
257
+
258
+ # FIXME: Clean up "Bundles" directory before packaging to avoid mixing
259
+ # artifacts from build-script. Eventually we should just use artifactbundles
260
+ # produced from build-script directly.
261
+ import shutil
262
+ shutil .rmtree (
263
+ os .path .join (SDK_GENERATOR_PKG_PATH , "Bundles" ), ignore_errors = True )
264
+
257
265
for target_triple , short_triple in triples :
258
266
snapshot_info = SnapshotInfo (
259
267
now .year , now .month , now .day ,
0 commit comments