Skip to content

Commit 778ab33

Browse files
pepicrftclaudemattt
authored
Replace compile-time directives with target platform conditions (#143)
* Replace compile-time directives with target platform conditions Use Package.swift target platform conditions instead of compile-time #if directives for EventSource dependency. This leverages Swift Package Manager's native dependency support for platform-specific targets at runtime rather than compile-time. * Update reference for EventSource package --------- Co-authored-by: Claude <[email protected]> Co-authored-by: Mattt <[email protected]>
1 parent e2afccd commit 778ab33

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

Package.swift

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,16 @@ import PackageDescription
77
var dependencies: [Package.Dependency] = [
88
.package(url: "https://github.com/apple/swift-system.git", from: "1.0.0"),
99
.package(url: "https://github.com/apple/swift-log.git", from: "1.5.0"),
10+
.package(url: "https://github.com/mattt/eventsource.git", from: "1.1.0")
1011
]
1112

1213
// Target dependencies needed on all platforms
1314
var targetDependencies: [Target.Dependency] = [
1415
.product(name: "SystemPackage", package: "swift-system"),
1516
.product(name: "Logging", package: "swift-log"),
17+
.product(name: "EventSource", package: "eventsource", condition: .when(platforms: [.macOS, .iOS, .tvOS, .visionOS, .watchOS]))
1618
]
1719

18-
// Add EventSource only on Apple platforms (non-Linux)
19-
#if !os(Linux)
20-
dependencies.append(
21-
.package(url: "https://github.com/loopwork-ai/eventsource.git", from: "1.1.0"))
22-
targetDependencies.append(.product(name: "EventSource", package: "eventsource"))
23-
#endif
24-
2520
let package = Package(
2621
name: "mcp-swift-sdk",
2722
platforms: [

0 commit comments

Comments
 (0)