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:
@@ -37,7 +37,7 @@ let package = Package(
|
||||
.target(
|
||||
name: "LyrebirdLiveCompile",
|
||||
dependencies: [
|
||||
.product(name: "Lyrebird", package: "Lyrebird"),
|
||||
.product(name: "LyrebirdDynamic", package: "Lyrebird"),
|
||||
],
|
||||
path: "Sources/LyrebirdLiveCompile"
|
||||
),
|
||||
@@ -45,7 +45,7 @@ let package = Package(
|
||||
name: "LyrebirdLiveCompileUI",
|
||||
dependencies: [
|
||||
"LyrebirdLiveCompile",
|
||||
.product(name: "Lyrebird", package: "Lyrebird"),
|
||||
.product(name: "LyrebirdDynamic", package: "Lyrebird"),
|
||||
],
|
||||
path: "Sources/LyrebirdLiveCompileUI",
|
||||
swiftSettings: [.swiftLanguageMode(.v5)]
|
||||
@@ -54,7 +54,7 @@ let package = Package(
|
||||
name: "LyrebirdLiveCompileTests",
|
||||
dependencies: [
|
||||
"LyrebirdLiveCompile",
|
||||
.product(name: "Lyrebird", package: "Lyrebird"),
|
||||
.product(name: "LyrebirdDynamic", package: "Lyrebird"),
|
||||
],
|
||||
path: "Tests/LyrebirdLiveCompileTests"
|
||||
),
|
||||
@@ -63,7 +63,7 @@ let package = Package(
|
||||
dependencies: [
|
||||
"LyrebirdLiveCompile",
|
||||
"LyrebirdLiveCompileUI",
|
||||
.product(name: "Lyrebird", package: "Lyrebird"),
|
||||
.product(name: "LyrebirdDynamic", package: "Lyrebird"),
|
||||
],
|
||||
path: "Tests/LyrebirdLiveCompileUITests",
|
||||
swiftSettings: [.swiftLanguageMode(.v5)]
|
||||
|
||||
@@ -36,7 +36,7 @@ public final class LiveSession {
|
||||
public let libraries: [String]
|
||||
|
||||
/// `-Xlinker -rpath -Xlinker <path>` entries baked into the snippet dylib
|
||||
/// so `dlopen` resolves dependent dylibs (`libLyrebird.dylib` etc.) at
|
||||
/// so `dlopen` resolves dependent dylibs (`libLyrebirdDynamic.dylib` etc.) at
|
||||
/// runtime without `DYLD_LIBRARY_PATH` ceremony.
|
||||
public let rpaths: [URL]
|
||||
|
||||
@@ -57,7 +57,7 @@ public final class LiveSession {
|
||||
engine: SynthesisEngine,
|
||||
importPaths: [URL] = LiveSession.defaultImportPaths(),
|
||||
librarySearchPaths: [URL] = LiveSession.defaultLibrarySearchPaths(),
|
||||
libraries: [String] = ["Lyrebird", "LyrebirdLiveCompile"],
|
||||
libraries: [String] = ["LyrebirdDynamic", "LyrebirdLiveCompile"],
|
||||
rpaths: [URL] = LiveSession.defaultRpaths()
|
||||
) {
|
||||
self.engine = engine
|
||||
@@ -257,7 +257,7 @@ public final class LiveSession {
|
||||
// MARK: - Build-dir discovery
|
||||
|
||||
/// Best-effort discovery of the SPM `.build/<triple>/<config>` directory
|
||||
/// that contains `libLyrebird.dylib` and the swiftmodule directories. Used
|
||||
/// that contains `libLyrebirdDynamic.dylib` and the swiftmodule directories. Used
|
||||
/// as the default for `importPaths`/`librarySearchPaths`/`rpaths`. Hosts can
|
||||
/// override by passing explicit URLs.
|
||||
///
|
||||
@@ -277,9 +277,11 @@ public final class LiveSession {
|
||||
// LyrebirdSynth.swiftmodule (Xcode SPM static-linked into the host app).
|
||||
// The swiftmodule alone is enough for `-I` module resolution; linking
|
||||
// falls back to `-undefined dynamic_lookup` when no dylib is found.
|
||||
// Note: the product/dylib is named `Lyrebird` (libLyrebird.dylib); the
|
||||
// module/target is named `LyrebirdSynth` (LyrebirdSynth.swiftmodule).
|
||||
let markers: [String] = ["libLyrebird.dylib", "LyrebirdSynth.swiftmodule"]
|
||||
// Note: LiveCompile depends on the internal `LyrebirdDynamic` product
|
||||
// (→ libLyrebirdDynamic.dylib); the module/target is `LyrebirdSynth`
|
||||
// (LyrebirdSynth.swiftmodule). The consumer-facing `Lyrebird` product
|
||||
// is static and produces no dylib, so it is not a marker here.
|
||||
let markers: [String] = ["libLyrebirdDynamic.dylib", "LyrebirdSynth.swiftmodule"]
|
||||
for start: URL in candidates {
|
||||
var cur: URL = start
|
||||
for _ in 0..<maxWalk {
|
||||
@@ -297,13 +299,13 @@ public final class LiveSession {
|
||||
return nil
|
||||
}
|
||||
|
||||
/// `true` when a `libLyrebird.dylib` actually exists in `buildDir`. Used to
|
||||
/// decide whether to link against the dylib at compile time or fall back to
|
||||
/// `-undefined dynamic_lookup` so the snippet binds to symbols already
|
||||
/// resolved in the running process.
|
||||
/// `true` when a `libLyrebirdDynamic.dylib` actually exists in `buildDir`.
|
||||
/// Used to decide whether to link against the dylib at compile time or fall
|
||||
/// back to `-undefined dynamic_lookup` so the snippet binds to symbols
|
||||
/// already resolved in the running process.
|
||||
public static func hasLyrebirdDylib(in buildDir: URL) -> Bool {
|
||||
FileManager.default.fileExists(
|
||||
atPath: buildDir.appendingPathComponent("libLyrebird.dylib").path
|
||||
atPath: buildDir.appendingPathComponent("libLyrebirdDynamic.dylib").path
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ struct LiveSessionTests {
|
||||
@Test
|
||||
func buildDirDiscoveryFindsLyrebirdDylib() throws {
|
||||
let buildDir: URL = try #require(LiveSession.currentBuildDir())
|
||||
let dylib: URL = buildDir.appendingPathComponent("libLyrebird.dylib")
|
||||
let dylib: URL = buildDir.appendingPathComponent("libLyrebirdDynamic.dylib")
|
||||
#expect(FileManager.default.fileExists(atPath: dylib.path))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user