Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 43 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,24 +1,59 @@
// swift-tools-version:6.1
import CompilerPluginSupport
import PackageDescription
import typealias Foundation.ProcessInfo
import class Foundation.ProcessInfo

let useSwiftSyntaxXcf: Bool = ProcessInfo.processInfo.environment["ORDO_USE_SWIFT_SYNTAX_XCF"] ?? "true" == "true"

func makeSwiftSyntaxDependency() -> [Package.Dependency] {
let xcFrameworksRepo: String = "https://github.com/ordo-one/swift-syntax-xcframeworks"
let officialSyntaxRepo: String = "https://github.com/swiftlang/swift-syntax"

let syntaxUrl: String
#if os(iOS)
syntaxUrl = xcFrameworksRepo
#elseif os(Linux)
syntaxUrl = officialSyntaxRepo
#else
syntaxUrl = useSwiftSyntaxXcf ? xcFrameworksRepo : officialSyntaxRepo
#endif

return [.package(url: syntaxUrl, from: "601.0.1")]
}

func makeSwiftSyntaxTargetDependencies() -> [Target.Dependency] {
let xcFrameworkDependencies: [Target.Dependency] = [
.product(name: "SwiftSyntaxWrapper", package: "swift-syntax-xcframeworks")
]

let standardSyntaxDependencies: [Target.Dependency] = [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]

#if os(iOS)
return xcFrameworkDependencies
#elseif os(Linux)
return standardSyntaxDependencies
#else
if useSwiftSyntaxXcf {
return xcFrameworkDependencies
}
return standardSyntaxDependencies
#endif
}

let package: Package = .init(
name: "bijection",
platforms: [.macOS(.v15), .iOS(.v18), .tvOS(.v18), .visionOS(.v2), .watchOS(.v11)],
products: [
.library(name: "Bijection", targets: ["Bijection"]),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-syntax", from: "601.0.0"),
],
dependencies: makeSwiftSyntaxDependency(),
targets: [
.macro(
name: "BijectionMacro",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]
dependencies: makeSwiftSyntaxTargetDependencies(),
),
.target(
name: "Bijection",
Expand Down
3 changes: 3 additions & 0 deletions Sources/BijectionMacro/BijectionMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ public struct BijectionMacro: PeerMacro {
}
}

context[.error, accessors] = "accessor list contains no getter"
return []
@unknown default:
context[.error, accessors] = "accessor list contains no getter"
return []
}
Expand Down