Skip to content

fix(build): resolve SwiftPM bin path instead of hardcoding it - #379

Merged
wxtsky merged 1 commit into
wxtsky:mainfrom
Naitellos:fix/build-swiftpm-bin-path
Oct 22, 2026
Merged

wxtsky merged 1 commit into
wxtsky:mainfrom
Naitellos:fix/build-swiftpm-bin-path

Conversation

@Naitellos

Copy link
Copy Markdown
Contributor

Problem

With Xcode 27 (SwiftPM 6.4, swift-build backend) ./build.sh compiles successfully and then fails while assembling the app bundle:

Build complete! (127.02 secs.)
Creating app bundle...
cp: .build/arm64-apple-macosx/release/CodeIsland: No such file or directory

The new build system places products in .build/out/Products/Release rather than .build/arm64-apple-macosx/release. The resource-bundle glob (.build/*/release/*.bundle) misses that path for the same reason.

Fix

Ask SwiftPM where it put the products (swift build -c release --arch arm64 --show-bin-path) and copy the binaries and the resource bundle from that directory. This works with both the legacy and the new build system, so older toolchains are unaffected.

Testing

  • Xcode 27.1 / Swift 6.4, macOS 26.6 (arm64): ./build.sh produces .build/release/CodeIsland.app containing the binary, codeisland-bridge, Sparkle.framework, and CodeIsland_CodeIsland.bundle; codesign --verify --deep --strict passes.
  • Not re-tested on an older Xcode; --show-bin-path returns .build/arm64-apple-macosx/release there, which is the previous hardcoded value.

🤖 Generated with Claude Code

Newer SwiftPM (swift-build backend, Xcode 27) puts products in
.build/out/Products/Release, so copying from
.build/arm64-apple-macosx/release failed after a successful compile.
Ask `swift build --show-bin-path` for the location and pick up the
resource bundle from the same directory.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wxtsky
wxtsky merged commit 3dcf36d into wxtsky:main Oct 22, 2026
wxtsky added a commit that referenced this pull request Oct 22, 2026
…fresh products

Swift 6.4 (Xcode 27) made swiftbuild SwiftPM's default. Its products land
in .build/out/Products/Release for every --arch, while build-dmg.sh kept
copying from .build/<arch>-apple-macosx/release, where the v1.0.35 build
was still sitting: the published v1.0.36, v1.0.37 and v1.0.38 DMGs carry
v1.0.35's app and bridge (identical LC_UUIDs for both architectures) with
only Info.plist bumped, and the resource bundle came from the same stale
directory.

Moving to swiftbuild is not an option yet: both architectures overwrite
each other in its one Products directory, and LC_BUILD_VERSION records the
14.0 deployment target as the SDK, which runs AppKit in its old-SDK
compatibility mode.

scripts/swiftpm-release.sh, shared by build.sh and build-dmg.sh, pins
--build-system native, asks SwiftPM for the bin path (as #379 did for
build.sh), deletes the previous products before building, and rejects a
binary that is missing, holds the wrong architecture, or records an SDK
other than the one that built it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wxtsky

wxtsky commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Thanks for this — merged as 3dcf36d, and it led straight to a bigger problem. scripts/build-dmg.sh had the same hardcoded path, so with the new build system it silently packaged stale products from an older native build. Follow-up in ea7ecfe: both scripts now share scripts/swiftpm-release.sh, which

  • pins --build-system native for release builds: swiftbuild also writes every --arch to the same out/Products/Release (the x86_64 build overwrites the arm64 one in a universal build), and its binaries record the 14.0 deployment target as their SDK in LC_BUILD_VERSION, which runs AppKit in its old-SDK compatibility mode;
  • asks SwiftPM for the bin path, as your change does;
  • deletes the previous products before building, and rejects a binary that's missing, has the wrong architecture, or records an SDK other than the one that built it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants