Skip to content

Commit fcc54ff

Browse files
committed
Merge branch 'main' of github.com:swiftwasm/WasmKit into maxd/noncopyable-translator
# Conflicts: # Sources/WasmParser/BinaryInstructionDecoder.swift # Sources/WasmParser/InstructionVisitor.swift # Utilities/Sources/WasmGen.swift
2 parents c6a99f8 + 6edd77e commit fcc54ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3379
-1231
lines changed

.github/workflows/main.yml

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,22 @@ concurrency:
1010
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1111

1212
jobs:
13+
check-autogen-diff:
14+
runs-on: ubuntu-latest
15+
container:
16+
image: swift:6.2-noble
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Re-generate auto-generated code checks
20+
run: |
21+
swift run -q --package-path Utilities WasmKitDevUtils
22+
- name: Check for changes
23+
run: |
24+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
25+
git diff --exit-code || {
26+
echo "::error::The auto-generated code utilities changed some files. Please see \`Utilities/README.md\`, re-run the tools, and commit the changes."
27+
exit 1
28+
}
1329
build-macos:
1430
strategy:
1531
matrix:
@@ -29,15 +45,15 @@ jobs:
2945
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
3046
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
3147
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
32-
test-args: "--sanitize address"
48+
test-args: "--sanitize address --traits WasmDebuggingSupport"
3349
# Swift 6.2
3450
- os: macos-15
35-
xcode: Xcode_26.0
51+
xcode: Xcode_26.1
3652
development-toolchain-tag: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a
3753
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
3854
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
3955
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
40-
test-args: "--sanitize address"
56+
test-args: "--sanitize address --traits WasmDebuggingSupport"
4157

4258
runs-on: ${{ matrix.os }}
4359
name: "build-macos (${{ matrix.xcode }})"
@@ -107,27 +123,38 @@ jobs:
107123
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
108124
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
109125
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
126+
test-args: "--traits WasmDebuggingSupport"
110127
- swift: "swift:6.2-amazonlinux2"
111128
development-toolchain-download: "https://download.swift.org/development/amazonlinux2/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-amazonlinux2.tar.gz"
112129
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
113130
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
114131
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
132+
test-args: "--traits WasmDebuggingSupport"
115133
- swift: "swift:6.2-noble"
116134
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
117135
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
118136
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
119137
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
120-
test-args: "--enable-code-coverage"
138+
test-args: "--traits WasmDebuggingSupport --enable-code-coverage"
121139
build-dev-dashboard: true
140+
# Disabled until a toolchain containing https://github.com/swiftlang/swift/commit/b219d4089c922ceb8b700424236ca97f6087a9a1
141+
# is tagged.
122142
- swift: "swiftlang/swift:nightly-main-noble"
123143
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
124144
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
125145
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
126146
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
127-
test-args: "-Xswiftc -DWASMKIT_CI_TOOLCHAIN_NIGHTLY"
147+
test-args: "--traits WasmDebuggingSupport -Xswiftc -DWASMKIT_CI_TOOLCHAIN_NIGHTLY"
148+
- swift: "swiftlang/swift:nightly-main-noble"
149+
development-toolchain-download: "https://download.swift.org/development/ubuntu2404/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a-ubuntu24.04.tar.gz"
150+
wasi-swift-sdk-download: "https://download.swift.org/development/wasm-sdk/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a/swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm.artifactbundle.tar.gz"
151+
wasi-swift-sdk-id: swift-DEVELOPMENT-SNAPSHOT-2025-10-02-a_wasm
152+
wasi-swift-sdk-checksum: "b64dfad9e1c9ccdf06f35cf9b1a00317e000df0c0de0b3eb9f49d6db0fcba4d9"
153+
test-args: "--traits WasmDebuggingSupport -Xswiftc -DWASMKIT_CI_TOOLCHAIN_NIGHTLY --build-system swiftbuild"
154+
label: " --build-system swiftbuild"
128155

129156
runs-on: ubuntu-24.04
130-
name: "build-linux (${{ matrix.swift }})"
157+
name: "build-linux (${{ matrix.swift }}${{ matrix.label }})"
131158

132159
steps:
133160
- uses: actions/checkout@v4
@@ -168,7 +195,7 @@ jobs:
168195
run: sudo chown -R $USER .build/html
169196
- if: matrix.build-dev-dashboard
170197
id: deployment
171-
uses: actions/upload-pages-artifact@v3
198+
uses: actions/upload-pages-artifact@v4
172199
with:
173200
path: .build/html
174201

@@ -206,16 +233,26 @@ jobs:
206233
run: ./build-exec swift sdk install "${{ matrix.musl-swift-sdk-download }}" --checksum "${{ matrix.musl-swift-sdk-checksum }}"
207234

208235
- name: Build (x86_64-swift-linux-musl)
209-
run: ./build-exec swift build --swift-sdk x86_64-swift-linux-musl
236+
run: ./build-exec swift build --swift-sdk x86_64-swift-linux-musl --traits WasmDebuggingSupport
210237
- name: Build (aarch64-swift-linux-musl)
211-
run: ./build-exec swift build --swift-sdk aarch64-swift-linux-musl
238+
run: ./build-exec swift build --swift-sdk aarch64-swift-linux-musl --traits WasmDebuggingSupport
212239

213240
build-android:
214241
runs-on: ubuntu-24.04
242+
timeout-minutes: 10
243+
strategy:
244+
matrix:
245+
include:
246+
- swift-version: "6.2"
247+
- swift-version: nightly-main
248+
215249
steps:
216250
- uses: actions/checkout@v4
217251
- name: Run Tests on Android emulator
218252
uses: skiptools/swift-android-action@v2
253+
with:
254+
android-api-level: 30
255+
swift-version: "${{ matrix.swift-version }}"
219256

220257
build-windows:
221258
runs-on: windows-latest
@@ -264,7 +301,7 @@ jobs:
264301
- name: Install jq
265302
run: apt-get update && apt-get install -y jq
266303
- name: Install Swift SDK
267-
run: swift sdk install https://download.swift.org/swift-6.2-release/wasm/swift-6.2-RELEASE/swift-6.2-RELEASE_wasm.artifactbundle.tar.gz --checksum fe4e8648309fce86ea522e9e0d1dc48e82df6ba6e5743dbf0c53db8429fb5224
304+
run: swift sdk install https://download.swift.org/swift-6.2.1-release/wasm-sdk/swift-6.2.1-RELEASE/swift-6.2.1-RELEASE_wasm.artifactbundle.tar.gz --checksum 482b9f95462b87bedfafca94a092cf9ec4496671ca13b43745097122d20f18af
268305
- name: Build with the Swift SDK
269-
run: swift build --swift-sdk "$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm"
270-
306+
run: swift build --swift-sdk "$(swiftc -print-target-info | jq -r '.swiftCompilerTag')_wasm" --product wasmkit-cli
307+

.github/workflows/release.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,16 @@ jobs:
1313
runs-on: macos-15
1414
steps:
1515
- uses: actions/checkout@v4
16-
- run: ./Utilities/build-release.py -o wasmkit-x86_64-apple-macos.tar.gz -- --triple x86_64-apple-macos
17-
- run: ./Utilities/build-release.py -o wasmkit-arm64-apple-macos.tar.gz -- --triple arm64-apple-macos
18-
- uses: actions/upload-artifact@v4
16+
- run: |
17+
VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
18+
echo "{WASMKIT_VERSION}={$VERSION}" >> "$GITHUB_ENV"
19+
- run: ./Utilities/build-release.py -o wasmkit-x86_64-apple-macos.tar.gz -s $WASMKIT_VERSION -- --triple x86_64-apple-macos
20+
- run: ./Utilities/build-release.py -o wasmkit-arm64-apple-macos.tar.gz -s $WASMKIT_VERSION -- --triple arm64-apple-macos
21+
- uses: actions/upload-artifact@v5
1922
with:
2023
name: release-wasmkit-x86_64-apple-macos
2124
path: wasmkit-x86_64-apple-macos.tar.gz
22-
- uses: actions/upload-artifact@v4
25+
- uses: actions/upload-artifact@v5
2326
with:
2427
name: release-wasmkit-arm64-apple-macos
2528
path: wasmkit-arm64-apple-macos.tar.gz
@@ -41,13 +44,16 @@ jobs:
4144
./build-exec apt-get install -y llvm-15
4245
./build-exec ln -s /usr/bin/llvm-strip-15 /usr/bin/llvm-strip
4346
44-
- run: ./build-exec ./Utilities/build-release.py -o wasmkit-x86_64-swift-linux-musl.tar.gz -- --swift-sdk x86_64-swift-linux-musl
45-
- run: ./build-exec ./Utilities/build-release.py -o wasmkit-aarch64-swift-linux-musl.tar.gz -- --swift-sdk aarch64-swift-linux-musl
46-
- uses: actions/upload-artifact@v4
47+
- run: |
48+
VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')
49+
echo "{WASMKIT_VERSION}={$VERSION}" >> "$GITHUB_ENV"
50+
- run: ./build-exec ./Utilities/build-release.py -o wasmkit-x86_64-swift-linux-musl.tar.gz -s $WASMKIT_VERSION -- --swift-sdk x86_64-swift-linux-musl
51+
- run: ./build-exec ./Utilities/build-release.py -o wasmkit-aarch64-swift-linux-musl.tar.gz -s $WASMKIT_VERSION -- --swift-sdk aarch64-swift-linux-musl
52+
- uses: actions/upload-artifact@v5
4753
with:
4854
name: release-wasmkit-x86_64-swift-linux-musl
4955
path: wasmkit-x86_64-swift-linux-musl.tar.gz
50-
- uses: actions/upload-artifact@v4
56+
- uses: actions/upload-artifact@v5
5157
with:
5258
name: release-wasmkit-aarch64-swift-linux-musl
5359
path: wasmkit-aarch64-swift-linux-musl.tar.gz
@@ -59,7 +65,7 @@ jobs:
5965
runs-on: ubuntu-24.04
6066
steps:
6167
- uses: actions/checkout@v4
62-
- uses: actions/download-artifact@v5
68+
- uses: actions/download-artifact@v6
6369
with:
6470
pattern: release-wasmkit-*
6571
path: ./release/

.sourcekit-lsp/config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"swiftPM": {
3+
"traits": ["WasmDebuggingSupport"]
4+
}
5+
}

[email protected]

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
// swift-tools-version:6.1
2+
3+
import PackageDescription
4+
5+
import class Foundation.ProcessInfo
6+
7+
let DarwinPlatforms: [Platform] = [.macOS, .iOS, .watchOS, .tvOS, .visionOS]
8+
9+
let cliTarget = Target.executableTarget(
10+
name: "CLI",
11+
dependencies: [
12+
"WAT",
13+
"WasmKit",
14+
"WasmKitWASI",
15+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
16+
.product(name: "SystemPackage", package: "swift-system"),
17+
],
18+
exclude: ["CMakeLists.txt"]
19+
)
20+
21+
let package = Package(
22+
name: "WasmKit",
23+
platforms: [.macOS(.v15), .iOS(.v17)],
24+
products: [
25+
.executable(name: "wasmkit-cli", targets: ["CLI"]),
26+
.library(name: "WasmKit", targets: ["WasmKit"]),
27+
.library(name: "WasmKitWASI", targets: ["WasmKitWASI"]),
28+
.library(name: "WASI", targets: ["WASI"]),
29+
.library(name: "WasmParser", targets: ["WasmParser"]),
30+
.library(name: "WAT", targets: ["WAT"]),
31+
.library(name: "WIT", targets: ["WIT"]),
32+
.library(name: "_CabiShims", targets: ["_CabiShims"]),
33+
],
34+
traits: [
35+
.default(enabledTraits: []),
36+
"WasmDebuggingSupport",
37+
],
38+
targets: [
39+
cliTarget,
40+
.target(
41+
name: "WasmKit",
42+
dependencies: [
43+
"_CWasmKit",
44+
"WasmParser",
45+
"WasmTypes",
46+
"SystemExtras",
47+
.product(name: "SystemPackage", package: "swift-system"),
48+
],
49+
exclude: ["CMakeLists.txt"]
50+
),
51+
.target(name: "_CWasmKit"),
52+
.target(
53+
name: "WasmKitFuzzing",
54+
dependencies: ["WasmKit"],
55+
path: "FuzzTesting/Sources/WasmKitFuzzing"
56+
),
57+
.testTarget(
58+
name: "WasmKitTests",
59+
dependencies: ["WasmKit", "WAT", "WasmKitFuzzing"],
60+
exclude: ["ExtraSuite"]
61+
),
62+
63+
.target(
64+
name: "WAT",
65+
dependencies: ["WasmParser"],
66+
exclude: ["CMakeLists.txt"]
67+
),
68+
.testTarget(name: "WATTests", dependencies: ["WAT"]),
69+
70+
.target(
71+
name: "WasmParser",
72+
dependencies: [
73+
"WasmTypes",
74+
.product(name: "SystemPackage", package: "swift-system"),
75+
],
76+
exclude: ["CMakeLists.txt"]
77+
),
78+
.testTarget(name: "WasmParserTests", dependencies: ["WasmParser"]),
79+
80+
.target(name: "WasmTypes", exclude: ["CMakeLists.txt"]),
81+
82+
.target(
83+
name: "WasmKitWASI",
84+
dependencies: ["WasmKit", "WASI"],
85+
exclude: ["CMakeLists.txt"]
86+
),
87+
.target(
88+
name: "WASI",
89+
dependencies: ["WasmTypes", "SystemExtras"],
90+
exclude: ["CMakeLists.txt"]
91+
),
92+
.testTarget(name: "WASITests", dependencies: ["WASI", "WasmKitWASI"]),
93+
94+
.target(
95+
name: "SystemExtras",
96+
dependencies: [
97+
.product(name: "SystemPackage", package: "swift-system"),
98+
.target(name: "CSystemExtras", condition: .when(platforms: [.wasi])),
99+
],
100+
exclude: ["CMakeLists.txt"],
101+
swiftSettings: [
102+
.define("SYSTEM_PACKAGE_DARWIN", .when(platforms: DarwinPlatforms))
103+
]
104+
),
105+
106+
.target(name: "CSystemExtras"),
107+
108+
.executableTarget(
109+
name: "WITTool",
110+
dependencies: [
111+
"WIT",
112+
"WITOverlayGenerator",
113+
"WITExtractor",
114+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
115+
]
116+
),
117+
118+
.target(name: "WIT"),
119+
.testTarget(name: "WITTests", dependencies: ["WIT"]),
120+
121+
.target(name: "WITOverlayGenerator", dependencies: ["WIT"]),
122+
.target(name: "_CabiShims"),
123+
124+
.target(name: "WITExtractor"),
125+
.testTarget(name: "WITExtractorTests", dependencies: ["WITExtractor", "WIT"]),
126+
127+
.target(
128+
name: "GDBRemoteProtocol",
129+
dependencies: [
130+
.product(name: "Logging", package: "swift-log"),
131+
.product(name: "NIOCore", package: "swift-nio"),
132+
]
133+
),
134+
.testTarget(name: "GDBRemoteProtocolTests", dependencies: ["GDBRemoteProtocol"]),
135+
],
136+
)
137+
138+
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
139+
package.dependencies += [
140+
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.5.1"),
141+
.package(url: "https://github.com/apple/swift-system", from: "1.5.0"),
142+
.package(url: "https://github.com/apple/swift-nio", from: "2.86.2"),
143+
.package(url: "https://github.com/apple/swift-log", from: "1.6.4"),
144+
]
145+
} else {
146+
package.dependencies += [
147+
.package(path: "../swift-argument-parser"),
148+
.package(path: "../swift-system"),
149+
.package(path: "../swift-nio"),
150+
.package(path: "../swift-log"),
151+
]
152+
}
153+
154+
#if !os(Windows)
155+
// Add build tool plugins only for non-Windows platforms
156+
package.products.append(contentsOf: [
157+
.plugin(name: "WITOverlayPlugin", targets: ["WITOverlayPlugin"]),
158+
.plugin(name: "WITExtractorPlugin", targets: ["WITExtractorPlugin"]),
159+
])
160+
161+
package.targets.append(contentsOf: [
162+
.plugin(name: "WITOverlayPlugin", capability: .buildTool(), dependencies: ["WITTool"]),
163+
.plugin(name: "GenerateOverlayForTesting", capability: .buildTool(), dependencies: ["WITTool"]),
164+
.testTarget(
165+
name: "WITOverlayGeneratorTests",
166+
dependencies: ["WITOverlayGenerator", "WasmKit", "WasmKitWASI"],
167+
exclude: ["Fixtures", "Compiled", "Generated", "EmbeddedSupport"],
168+
plugins: [.plugin(name: "GenerateOverlayForTesting")]
169+
),
170+
.plugin(
171+
name: "WITExtractorPlugin",
172+
capability: .command(
173+
intent: .custom(verb: "extract-wit", description: "Extract WIT definition from Swift module"),
174+
permissions: []
175+
),
176+
dependencies: ["WITTool"]
177+
),
178+
.testTarget(
179+
name: "WITExtractorPluginTests",
180+
exclude: ["Fixtures"]
181+
),
182+
183+
.target(
184+
name: "WasmKitGDBHandler",
185+
dependencies: [
186+
.product(name: "_NIOFileSystem", package: "swift-nio"),
187+
.product(name: "NIOCore", package: "swift-nio"),
188+
.product(name: "SystemPackage", package: "swift-system"),
189+
"WasmKit",
190+
"WasmKitWASI",
191+
"GDBRemoteProtocol",
192+
],
193+
),
194+
])
195+
196+
cliTarget.dependencies.append(contentsOf: [
197+
.product(name: "Logging", package: "swift-log", condition: .when(traits: ["WasmDebuggingSupport"])),
198+
.product(name: "NIOCore", package: "swift-nio", condition: .when(traits: ["WasmDebuggingSupport"])),
199+
.product(name: "NIOPosix", package: "swift-nio", condition: .when(traits: ["WasmDebuggingSupport"])),
200+
.target(name: "GDBRemoteProtocol", condition: .when(traits: ["WasmDebuggingSupport"])),
201+
.target(name: "WasmKitGDBHandler", condition: .when(traits: ["WasmDebuggingSupport"])),
202+
])
203+
#endif

0 commit comments

Comments
 (0)