Static consumer product + internal dynamic for LiveCompile
The Lyrebird product was forced type: .dynamic, forcing an SPM dynamic framework on consumers and hitting the Xcode 26 regression (PackageFrameworks/Lyrebird.framework binary missing). Split into two products vending the same LyrebirdSynth target: • Lyrebird (automatic → static): consumer-facing, no framework, no workarounds. • LyrebirdDynamic (.dynamic): internal-only, consumed by LiveCompile. LiveCompile repointed to LyrebirdDynamic with linker refs updated (libLyrebirdDynamic.dylib). README + GettingStarted updated: consumers link static and need no disable-library-validation entitlement or driver override. Verified: core + LiveCompile (34/34) build/test clean; external consumer links the static product with no dynamic dylib. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+23
-14
@@ -5,14 +5,22 @@ let package = Package(
|
||||
name: "Lyrebird",
|
||||
platforms: [.macOS(.v15), .iOS(.v18)],
|
||||
products: [
|
||||
// Product name stays `Lyrebird` (external API), but it vends the
|
||||
// renamed `LyrebirdSynth` target/module. Product name ≠ target name is
|
||||
// required: a forced-`.dynamic` product cannot share a name with its
|
||||
// target when a downstream project's graph also static-links that
|
||||
// target ("linked as a static library … but cannot be built
|
||||
// dynamically because there is a package product with the same name").
|
||||
// Consumers add the `Lyrebird` product and write `import LyrebirdSynth`.
|
||||
.library(name: "Lyrebird", type: .dynamic, targets: ["LyrebirdSynth"]),
|
||||
// Consumer-facing product. Automatic linkage → SwiftPM/Xcode link the
|
||||
// `LyrebirdSynth` module statically into the downstream target. No
|
||||
// dynamic framework is produced, so the Xcode 26 regression where the
|
||||
// `PackageFrameworks/Lyrebird.framework` binary is never built (and the
|
||||
// app fails to link / launch) cannot affect external consumers.
|
||||
// Product name ≠ target name (`Lyrebird` vends `LyrebirdSynth`) so there
|
||||
// is also no static-vs-dynamic same-name collision. Consumers add the
|
||||
// `Lyrebird` product and write `import LyrebirdSynth`.
|
||||
.library(name: "Lyrebird", targets: ["LyrebirdSynth"]),
|
||||
// Internal-only DYNAMIC product — consumed solely by the nested
|
||||
// `LiveCompile/` dev sub-package. LiveCompile needs a single shared
|
||||
// `libLyrebirdDynamic.dylib` on disk so the host and each live-compiled
|
||||
// snippet dylib resolve to ONE copy of every Lyrebird class (the ObjC
|
||||
// double-registration crash fixed in Phase 167). External consumers
|
||||
// never reference this product — they use `Lyrebird` (static) above.
|
||||
.library(name: "LyrebirdDynamic", type: .dynamic, targets: ["LyrebirdSynth"]),
|
||||
.library(name: "LyrebirdUI", targets: ["LyrebirdUI"]),
|
||||
.executable(name: "LyrebirdCLI", targets: ["LyrebirdCLI"]),
|
||||
],
|
||||
@@ -94,12 +102,13 @@ let package = Package(
|
||||
),
|
||||
// Phase 167 — `LyrebirdLiveCompile` (and its SwiftUI host
|
||||
// `LyrebirdLiveCompileUI`) moved to the `LiveCompile/` nested SwiftPM
|
||||
// package. The cross-package `.product(name: "Lyrebird", package: "Lyrebird")`
|
||||
// dependency there forces SwiftPM to dynamic-link the live-compile dylib
|
||||
// against `libLyrebird.dylib` instead of statically embedding the core
|
||||
// module's classes, which was the root cause of an ObjC class
|
||||
// double-registration crash during `swift test` in the single-package
|
||||
// layout. See `LiveCompile/Package.swift`.
|
||||
// package. It depends on the internal `.product(name: "LyrebirdDynamic",
|
||||
// package: "Lyrebird")` (the dynamic product above) so SwiftPM
|
||||
// dynamic-links the live-compile dylib against `libLyrebirdDynamic.dylib`
|
||||
// instead of statically embedding the core module's classes — the root
|
||||
// cause of an ObjC class double-registration crash during `swift test`
|
||||
// in the single-package layout. The consumer-facing `Lyrebird` product
|
||||
// stays static (see products list). See `LiveCompile/Package.swift`.
|
||||
.executableTarget(
|
||||
name: "LyrebirdBenchmark",
|
||||
dependencies: ["LyrebirdSynth"],
|
||||
|
||||
Reference in New Issue
Block a user