Skip to content

Commit

Permalink
Use xcframeworks for swift-syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
hassila committed Dec 10, 2024
1 parent ca4f25d commit 4de90db
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 70 deletions.
41 changes: 0 additions & 41 deletions Package.resolved

This file was deleted.

84 changes: 55 additions & 29 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
import PackageDescription
import CompilerPluginSupport

let swiftSyntaxVersion = Version("510.0.3")
#if os(macOS) || os(iOS)
let swiftSyntaxRepo = "https://github.com/ordo-one/swift-syntax-xcf"
#else
let swiftSyntaxRepo = "https://github.com/apple/swift-syntax"
#endif

let package = Package(
name: "StateMachine",
platforms: [
Expand All @@ -17,34 +24,53 @@ let package = Package(
targets: ["StateMachine"]),
],
dependencies: [
.package(
url: "https://github.com/apple/swift-syntax.git",
from: "510.0.3"),
.package(
url: "https://github.com/Quick/Nimble.git",
from: "13.2.0"),
.package(url: swiftSyntaxRepo, from: swiftSyntaxVersion),
.package(url: "https://github.com/Quick/Nimble.git", from: "13.2.0"),
],
targets: [
.target(
name: "StateMachine",
dependencies: ["StateMachineMacros"],
path: "Swift/Sources/StateMachine"),
.macro(
name: "StateMachineMacros",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
],
path: "Swift/Sources/StateMachineMacros"),
.testTarget(
name: "StateMachineTests",
dependencies: [
"StateMachine",
"StateMachineMacros",
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"),
"Nimble",
],
path: "Swift/Tests/StateMachineTests"),
]
targets: {
var targets: [Target] = [
.target(
name: "StateMachine",
dependencies: ["StateMachineMacros"],
path: "Swift/Sources/StateMachine"),
.macro(
name: "StateMachineMacros",
dependencies: makeSwiftSyntaxTargetDependencies(),
path: "Swift/Sources/StateMachineMacros")
]

#if os(Linux)
targets.append(
.testTarget(
name: "StateMachineTests",
dependencies: {
var deps: [Target.Dependency] = [
"StateMachine",
"StateMachineMacros",
"Nimble"
]
#if !os(macOS) && !os(iOS)
deps.append(.product(name: "SwiftSyntaxMacrosTestSupport", package: "swift-syntax"))
#endif
return deps
}(),
path: "Swift/Tests/StateMachineTests")
)
#endif

return targets
}()
)

func makeSwiftSyntaxTargetDependencies() -> [PackageDescription.Target.Dependency] {
#if os(macOS) || os(iOS)
[
.product(name: "SwiftSyntaxWrapper", package: "swift-syntax-xcf")
]
#else
[
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]
#endif
}

0 comments on commit 4de90db

Please sign in to comment.