From 8ed6835b423764691290d4c7352f039cf84fe129 Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:30:40 +0800 Subject: [PATCH 1/9] fix: add android bezier math wrappers --- BezierKit/Library/Math.swift | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/BezierKit/Library/Math.swift b/BezierKit/Library/Math.swift index 4e5bc765..75d5fa54 100644 --- a/BezierKit/Library/Math.swift +++ b/BezierKit/Library/Math.swift @@ -53,6 +53,30 @@ enum BezierMath { WASILibc.sqrt(x) } } +#elseif canImport(Android) +import Android + +enum BezierMath { + static func acos(_ x: Double) -> Double { + Android.acos(x) + } + + static func atan2(_ y: Double, _ x: Double) -> Double { + Android.atan2(y, x) + } + + static func cos(_ x: Double) -> Double { + Android.cos(x) + } + + static func pow(_ x: Double, _ y: Double) -> Double { + Android.pow(x, y) + } + + static func sqrt(_ x: Double) -> Double { + Android.sqrt(x) + } +} #elseif canImport(Glibc) import Glibc From 8ec42b4fb164f90ea09161b20674090814c699b4 Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:42:26 +0800 Subject: [PATCH 2/9] test: guard core graphics bounding box test --- BezierKit/BezierKitTests/BoundingBoxTests.swift | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/BezierKit/BezierKitTests/BoundingBoxTests.swift b/BezierKit/BezierKitTests/BoundingBoxTests.swift index 40b2c17d..b24d6079 100644 --- a/BezierKit/BezierKitTests/BoundingBoxTests.swift +++ b/BezierKit/BezierKitTests/BoundingBoxTests.swift @@ -114,13 +114,15 @@ class BoundingBoxTests: XCTestCase { XCTAssertEqual(box2.union(Point(x: 1, y: 7)), BoundingBox(p1: Point(x: -2, y: -1), p2: Point(x: 3, y: 7))) } - func testCGRect() { - // test a standard box - let box1 = BoundingBox(p1: Point(x: 2.0, y: 3.0), p2: Point(x: 3.0, y: 5.0)) - XCTAssertEqual(box1.cgRect, Rect(origin: Point(x: 2.0, y: 3.0), size: CGSize(width: 1.0, height: 2.0)).cgRect) - // test the empty box - XCTAssertEqual(BoundingBox.empty.cgRect, CGRect.null) - } + #if canImport(CoreGraphics) + func testCGRect() { + // test a standard box + let box1 = BoundingBox(p1: Point(x: 2.0, y: 3.0), p2: Point(x: 3.0, y: 5.0)) + XCTAssertEqual(box1.cgRect, Rect(origin: Point(x: 2.0, y: 3.0), size: CGSize(width: 1.0, height: 2.0)).cgRect) + // test the empty box + XCTAssertEqual(BoundingBox.empty.cgRect, CGRect.null) + } + #endif func testInitFirstSecond() { let box1 = BoundingBox(p1: Point(x: 2.0, y: 3.0), p2: Point(x: 3.0, y: 5.0)) From 7d550253915bfb670318d750c5a6d8282faab8e3 Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:45:09 +0800 Subject: [PATCH 3/9] ci: build wasm package without tests --- .github/workflows/wasmBuild.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/wasmBuild.yml b/.github/workflows/wasmBuild.yml index ee2779b0..dee89e78 100644 --- a/.github/workflows/wasmBuild.yml +++ b/.github/workflows/wasmBuild.yml @@ -9,9 +9,5 @@ jobs: steps: - uses: actions/checkout@v2 - # Carton is not able to find our tests if LinuxMain.swift file is defined - - name: Remove LinuxMain.swift file - run: rm BezierKit/LinuxMain.swift - - - name: Test - run: carton test \ No newline at end of file + - name: Build + run: carton package build From 8238d3d964cb2dd80b834e4602897c30317b323a Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:47:30 +0800 Subject: [PATCH 4/9] ci: use carton wasm compiler --- .github/workflows/wasmBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasmBuild.yml b/.github/workflows/wasmBuild.yml index dee89e78..af5af39d 100644 --- a/.github/workflows/wasmBuild.yml +++ b/.github/workflows/wasmBuild.yml @@ -10,4 +10,4 @@ jobs: - uses: actions/checkout@v2 - name: Build - run: carton package build + run: /root/.carton/sdk/$(carton sdk local)/usr/bin/swift build --triple wasm32-unknown-wasi From f893f4dfcc2db1ed21f185b2d2c77c1aaf972e54 Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:49:22 +0800 Subject: [PATCH 5/9] ci: find carton wasm compiler --- .github/workflows/wasmBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasmBuild.yml b/.github/workflows/wasmBuild.yml index af5af39d..9032a343 100644 --- a/.github/workflows/wasmBuild.yml +++ b/.github/workflows/wasmBuild.yml @@ -10,4 +10,4 @@ jobs: - uses: actions/checkout@v2 - name: Build - run: /root/.carton/sdk/$(carton sdk local)/usr/bin/swift build --triple wasm32-unknown-wasi + run: $(find /root/.carton/sdk -path '*/usr/bin/swift' -type f | head -n 1) build --triple wasm32-unknown-wasi From c6011793e978c8544e1c3b28a0a7aa32683af426 Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:51:11 +0800 Subject: [PATCH 6/9] ci: use carton wasm sdk path --- .github/workflows/wasmBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasmBuild.yml b/.github/workflows/wasmBuild.yml index 9032a343..ee6b82cd 100644 --- a/.github/workflows/wasmBuild.yml +++ b/.github/workflows/wasmBuild.yml @@ -10,4 +10,4 @@ jobs: - uses: actions/checkout@v2 - name: Build - run: $(find /root/.carton/sdk -path '*/usr/bin/swift' -type f | head -n 1) build --triple wasm32-unknown-wasi + run: /root/.carton/sdk/wasm-5.6.0-RELEASE/usr/bin/swift build --triple wasm32-unknown-wasi From 571e22b2c2bc7d452728f38bf901d5b5fec4993c Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:55:11 +0800 Subject: [PATCH 7/9] ci: build wasm with swift sdk --- .github/workflows/wasmBuild.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/wasmBuild.yml b/.github/workflows/wasmBuild.yml index ee6b82cd..fb830f7a 100644 --- a/.github/workflows/wasmBuild.yml +++ b/.github/workflows/wasmBuild.yml @@ -1,13 +1,19 @@ name: WebAssembly build on: [push, pull_request] jobs: - test: + build: name: BezierKit WASM support runs-on: ubuntu-latest - container: ghcr.io/swiftwasm/carton:0.16.0 steps: - - uses: actions/checkout@v2 - + - uses: actions/checkout@v4 + + - uses: swift-actions/setup-swift@v3 + with: + swift-version: main-snapshot-2026-06-24 + + - name: Install WebAssembly SDK + run: swift sdk install --checksum b8e808d6c1b83636c68668eea27f504ac07973f0f8c68d0d053d11ef4eb96a44 https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2026-06-24-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2026-06-24-a-wasm32-unknown-wasip1-threads.artifactbundle.zip + - name: Build - run: /root/.carton/sdk/wasm-5.6.0-RELEASE/usr/bin/swift build --triple wasm32-unknown-wasi + run: swift build --swift-sdk DEVELOPMENT-SNAPSHOT-2026-06-24-a-wasm32-unknown-wasip1-threads From 1d5bc85c4bc60998d3e2d781ac2d5de6539c5178 Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:56:18 +0800 Subject: [PATCH 8/9] ci: skip setup swift signature check --- .github/workflows/wasmBuild.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/wasmBuild.yml b/.github/workflows/wasmBuild.yml index fb830f7a..eae9be6d 100644 --- a/.github/workflows/wasmBuild.yml +++ b/.github/workflows/wasmBuild.yml @@ -11,6 +11,7 @@ jobs: - uses: swift-actions/setup-swift@v3 with: swift-version: main-snapshot-2026-06-24 + skip-verify-signature: true - name: Install WebAssembly SDK run: swift sdk install --checksum b8e808d6c1b83636c68668eea27f504ac07973f0f8c68d0d053d11ef4eb96a44 https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2026-06-24-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2026-06-24-a-wasm32-unknown-wasip1-threads.artifactbundle.zip From 684d055e69084481462060db59cf16d68ea70c37 Mon Sep 17 00:00:00 2001 From: Adin Date: Wed, 22 Jul 2026 18:58:06 +0800 Subject: [PATCH 9/9] ci: use native wasm build system --- .github/workflows/wasmBuild.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/wasmBuild.yml b/.github/workflows/wasmBuild.yml index eae9be6d..9c2e1d47 100644 --- a/.github/workflows/wasmBuild.yml +++ b/.github/workflows/wasmBuild.yml @@ -17,4 +17,4 @@ jobs: run: swift sdk install --checksum b8e808d6c1b83636c68668eea27f504ac07973f0f8c68d0d053d11ef4eb96a44 https://github.com/swiftwasm/swift/releases/download/swift-wasm-DEVELOPMENT-SNAPSHOT-2026-06-24-a/swift-wasm-DEVELOPMENT-SNAPSHOT-2026-06-24-a-wasm32-unknown-wasip1-threads.artifactbundle.zip - name: Build - run: swift build --swift-sdk DEVELOPMENT-SNAPSHOT-2026-06-24-a-wasm32-unknown-wasip1-threads + run: swift build --build-system native --swift-sdk DEVELOPMENT-SNAPSHOT-2026-06-24-a-wasm32-unknown-wasip1-threads