Skip to content

Commit 6f5d2e1

Browse files
Fix "multiple Swift SDKs match target triple <target-triple>" error
1 parent aaccede commit 6f5d2e1

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

tools/build/package-toolchain

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33
import sys
44
import os
55
import argparse
6-
import json
76
import datetime
87
import re
9-
from typing import Optional
108
from build_support.actions import Action, ActionRunner, DownloadBaseSnapshotAction, derive_options_from_args
119
from build_support.platform import PlatformInfo
1210

1311

12+
SDK_GENERATOR_PKG_PATH = os.path.join(
13+
os.path.dirname(__file__), "..", "..", "..", "swift-sdk-generator")
14+
15+
1416
class SnapshotInfo:
1517
def __init__(self, year: int, month: int, day: int, swift_version: str, artifact_name: str, daily_snapshot: bool):
1618
self.year = year
@@ -117,11 +119,9 @@ class PackageSwiftSDKAction(Action):
117119
WebAssembly.
118120
:param wasi_sysroot_path: The path to the WASI sysroot.
119121
"""
120-
sdk_generator_pkg_path = os.path.join(
121-
os.path.dirname(__file__), "..", "..", "..", "swift-sdk-generator")
122122
sdk_generator_args = [
123123
"swift",
124-
"run", "--package-path", sdk_generator_pkg_path,
124+
"run", "--package-path", SDK_GENERATOR_PKG_PATH,
125125
"--", "swift-sdk-generator", "make-wasm-sdk",
126126
"--target-swift-package-path", target_toolchain_path,
127127
"--wasi-sysroot", wasi_sysroot_path,
@@ -134,7 +134,7 @@ class PackageSwiftSDKAction(Action):
134134
self.system(*sdk_generator_args)
135135

136136
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")
138138
zip_path = os.path.join(
139139
os.getcwd(), "..", self.snapshot_info.artifactbundle_zip_name)
140140

@@ -254,6 +254,14 @@ def main():
254254
triples += [
255255
["wasm32-unknown-wasip1-threads", "wasm32-wasip1-threads"]
256256
]
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+
257265
for target_triple, short_triple in triples:
258266
snapshot_info = SnapshotInfo(
259267
now.year, now.month, now.day,

0 commit comments

Comments
 (0)