Skip to content

Commit bfc8e0f

Browse files
Clean up no longer needed Foundation and XCTest build steps
1 parent 6a18680 commit bfc8e0f

File tree

7 files changed

+20
-150
lines changed

7 files changed

+20
-150
lines changed

schemes/main/build/build-foundation.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.

schemes/main/build/build-target-toolchain.sh

Lines changed: 7 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -40,48 +40,16 @@ build_target_toolchain() {
4040
env DESTDIR="$TRIPLE_DESTDIR" \
4141
cmake --install "$TARGET_BUILD_ROOT/$STDLIB_PRODUCT-$HOST_SUFFIX" --prefix /usr
4242

43-
local swift_testing_build_dir="$TARGET_BUILD_ROOT/wasmswiftsdk-$HOST_SUFFIX/swift-testing/$TRIPLE"
44-
# TODO: Remove this check once we build swift-testing for +threads target
45-
if [[ -d "$swift_testing_build_dir" ]]; then
46-
env DESTDIR="$TRIPLE_DESTDIR" \
47-
cmake --install "$swift_testing_build_dir" --prefix /usr
48-
fi
43+
env DESTDIR="$TRIPLE_DESTDIR" \
44+
cmake --install "$TARGET_BUILD_ROOT/wasmswiftsdk-$HOST_SUFFIX/swift-testing/$TRIPLE" --prefix /usr
45+
env DESTDIR="$TRIPLE_DESTDIR" \
46+
cmake --install "$TARGET_BUILD_ROOT/wasmswiftsdk-$HOST_SUFFIX/foundation/$TRIPLE" --prefix /usr
47+
env DESTDIR="$TRIPLE_DESTDIR" \
48+
cmake --install "$TARGET_BUILD_ROOT/wasmswiftsdk-$HOST_SUFFIX/xctest/$TRIPLE" --prefix /usr
4949

5050
rm -rf "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
5151
# XXX: Is this the right way to install compiler-rt?
5252
cp -R "$TARGET_BUILD_ROOT/wasi-sysroot/$CLANG_MULTIARCH_TRIPLE/lib/$COMPILER_RT_OS_DIR" "$TRIPLE_DESTDIR/usr/lib/swift_static/clang/lib/$COMPILER_RT_OS_DIR"
53-
54-
# FIXME: Clang resource directory installation is not the best way currently.
55-
# We currently have two copies of compiler headers copied from the base toolchain in
56-
# lib/swift/clang and lib/swift_static/clang. This is because the Swift CMake build
57-
# system installs the compiler headers from the native tools path when not building
58-
# tools including clang compiler. This is not ideal but then where should we bring
59-
# the compiler headers from? If we use the headers beside the base toolchain, clang
60-
# driver will not be able to find libclang_rt.builtins-wasm32.a because it is not
61-
# a part of the base toolchain. We need to find a better way to handle this.
62-
local CLANG_VERSION
63-
CLANG_VERSION="$(basename "$($CLANG_BIN_DIR/clang -print-resource-dir)")"
64-
mkdir -p "$TRIPLE_DESTDIR/usr/lib/clang/$CLANG_VERSION/lib"
65-
ln -sf "../../../swift_static/clang/lib/$COMPILER_RT_OS_DIR" "$TRIPLE_DESTDIR/usr/lib/clang/$CLANG_VERSION/lib/$COMPILER_RT_OS_DIR"
66-
}
67-
68-
build_target_corelibs() {
69-
local LLVM_BIN_DIR="$1"
70-
local CLANG_BIN_DIR="$2"
71-
local SWIFT_BIN_DIR="$3"
72-
local TRIPLE="$4"
73-
local SHORT_TRIPLE="$5"
74-
75-
local TRIPLE_DESTDIR="$TARGET_TOOLCHAIN_DESTDIR/$TRIPLE"
76-
local CORELIBS_ARGS=(
77-
"$TRIPLE_DESTDIR"
78-
"$LLVM_BIN_DIR"
79-
"$CLANG_BIN_DIR"
80-
"$SWIFT_BIN_DIR"
81-
"$WASI_SYSROOT_PATH/$SHORT_TRIPLE"
82-
)
83-
"$SCHEMES_BUILD_PATH/build-foundation.sh" "${CORELIBS_ARGS[@]}" "$TRIPLE"
84-
"$SCHEMES_BUILD_PATH/build-xctest.sh" "${CORELIBS_ARGS[@]}" "$TRIPLE"
8553
}
8654

8755
main() {
@@ -171,13 +139,10 @@ main() {
171139
"$OPTIONS_SWIFT_BIN"
172140
)
173141

174-
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasi" "wasi-wasm32" "wasm32-wasi" "wasmstdlib" "wasi"
142+
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1" "wasip1-wasm32" "wasm32-wasip1" "wasmstdlib" "wasip1"
175143
build_target_toolchain "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1-threads" "wasip1-threads-wasm32" "wasm32-wasip1-threads" "wasmthreadsstdlib" "wasip1"
176144

177145
rsync -av "$WASI_SYSROOT_PATH/" "$PACKAGING_DIR/wasi-sysroot/"
178-
179-
build_target_corelibs "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasi" "wasm32-wasi"
180-
build_target_corelibs "${BUILD_TOOLS_ARGS[@]}" "wasm32-unknown-wasip1-threads" "wasm32-wasip1-threads"
181146
}
182147

183148
main "$@"

schemes/main/build/build-xctest.sh

Lines changed: 0 additions & 39 deletions
This file was deleted.

schemes/main/build/run-test.sh

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@
22

33
set -euxo pipefail
44

5-
SOURCE_PATH="$(cd "$(dirname "$0")/../../../.." && pwd)"
6-
BUILD_DIR="$SOURCE_PATH/build"
7-
TARGET_BUILD_ROOT="$BUILD_DIR/WebAssembly"
8-
9-
HOST_SUFFIX=$(find "$TARGET_BUILD_ROOT" -name "wasmstdlib-*" -exec basename {} \; | sed 's/wasmstdlib-//')
10-
env "PATH=$TARGET_BUILD_ROOT/llvm-$HOST_SUFFIX/bin:$BUILD_DIR/llvm-tools/bin:$PATH" "LIT_FILTER_OUT=(IRGen/|embedded/)" ninja check-swift-wasi-wasm32-custom -C "$TARGET_BUILD_ROOT/wasmstdlib-$HOST_SUFFIX"
5+
echo "Skipping test because we now run tests in build-script"

schemes/main/manifest.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
{
22
"base-tag": "swift-DEVELOPMENT-SNAPSHOT-2025-07-23-a",
33
"icu4c": [],
4-
"libxml2": [
5-
"https://github.com/swiftwasm/libxml2-wasm/releases/download/2.0.0/libxml2-wasm32-unknown-wasi.tar.gz",
6-
"https://github.com/swiftwasm/libxml2-wasm/releases/download/2.0.0/libxml2-wasm32-unknown-wasip1-threads.tar.gz"
7-
],
4+
"libxml2": [],
85
"swift-org-download-channel": "development"
96
}

tools/build/package-toolchain

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ def copy_icu_libs(scheme, build_sdk_path, dist_toolchain_path, target_triple):
5151
shutil.copy(os.path.join(icu_lib_dir, lib), dest_path)
5252

5353

54-
def copy_libxml2_libs(build_sdk_path, dist_toolchain_path, target_triple):
54+
def copy_libxml2_libs(scheme, build_sdk_path, dist_toolchain_path, target_triple):
55+
if scheme not in ["release-6.0", "release-6.1"]:
56+
# Recent channels install libxml2 in wasi-sysroot by default
57+
return
5558
import shutil
5659
lib_dir = os.path.join(build_sdk_path, f"libxml2-{target_triple}", 'lib')
5760
if not os.path.exists(lib_dir):
@@ -83,7 +86,7 @@ class PackageSwiftSDKAction(Action):
8386
def run(self):
8487
build_sdk_path = os.path.join('..', 'build-sdk')
8588
copy_icu_libs(self.options.scheme, build_sdk_path, self.target_toolchain_path, self.target_triple)
86-
copy_libxml2_libs(build_sdk_path, self.target_toolchain_path, self.target_triple)
89+
copy_libxml2_libs(self.options.scheme, build_sdk_path, self.target_toolchain_path, self.target_triple)
8790
self.make_swift_sdk(
8891
self.target_toolchain_path,
8992
self.wasi_sysroot_path,
@@ -207,8 +210,12 @@ def main():
207210

208211
toolchain_channel = derive_toolchain_channel(options.scheme)
209212
triples = [
210-
["wasm32-unknown-wasi", "wasm32-wasi"],
213+
["wasm32-unknown-wasip1", "wasm32-wasip1"],
211214
]
215+
if options.scheme in ["release-6.0", "release-6.1"]:
216+
triples = [
217+
["wasm32-unknown-wasi", "wasm32-wasi"],
218+
]
212219
if options.scheme not in ["release-6.0"]:
213220
triples += [
214221
["wasm32-unknown-wasip1-threads", "wasm32-wasip1-threads"]

tools/build/run-e2e-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ from build_support.actions import derive_options_from_args, REPO_ROOT, DownloadB
1111
def main():
1212
parser = argparse.ArgumentParser(
1313
description='Run e2e integration tests for Swift SDK')
14-
parser.add_argument('--swift-sdk', default='wasm32-unknown-wasi',
14+
parser.add_argument('--swift-sdk', default='wasm32-unknown-wasip1',
1515
help='Swift SDK identifier (default: wasm32-unknown-wasi)')
1616
parser.add_argument('args', nargs=argparse.REMAINDER,
1717
help='Extra arguments to pass to lit.py')

0 commit comments

Comments
 (0)