diff --git a/Package.resolved b/Package.resolved index a7bacb9f7..104b819ea 100644 --- a/Package.resolved +++ b/Package.resolved @@ -48,11 +48,11 @@ }, { "package": "SwiftSyntax", - "repositoryURL": "https://github.com/apple/swift-syntax", + "repositoryURL": "https://github.com/peripheryapp/swift-syntax", "state": { "branch": null, - "revision": "0b6c22b97f8e9320bca62e82cdbee601cf37ad3f", - "version": "0.50600.1" + "revision": "8a82bdb5d1558d130f732ef9f27dc1cd6f6696ea", + "version": "0.50600.1-static" } }, { diff --git a/Package.swift b/Package.swift index 71f623f68..fbe169500 100644 --- a/Package.swift +++ b/Package.swift @@ -1,48 +1,26 @@ -// swift-tools-version:5.2 +// swift-tools-version:5.3 import PackageDescription +#if compiler(>=5.6) +let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50600.1-static") +#elseif compiler(>=5.5) +let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50500.0-static") +#elseif compiler(>=5.4) +let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50400.0") +#elseif compiler(>=5.3) +let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50300.0") +#else +fatalError("This version of Periphery does not support Swift <= 5.2.") +#endif + var dependencies: [Package.Dependency] = [ .package(url: "https://github.com/apple/swift-system", from: "1.0.0"), .package(url: "https://github.com/jpsim/Yams", from: "4.0.0"), .package(url: "https://github.com/tadija/AEXML", from: "4.0.0"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"), - .package(name: "SwiftIndexStore", url: "https://github.com/kateinoigakukun/swift-indexstore", from: "0.0.0") + .package(name: "SwiftIndexStore", url: "https://github.com/kateinoigakukun/swift-indexstore", from: "0.0.0"), + .package(name: "SwiftSyntax", url: "https://github.com/peripheryapp/swift-syntax", swiftSyntaxVersion) ] -#if swift(>=5.6) -dependencies.append( - .package( - name: "SwiftSyntax", - url: "https://github.com/apple/swift-syntax", - .exact("0.50600.1") - ) -) -#elseif swift(>=5.5) -dependencies.append( - .package( - name: "SwiftSyntax", - url: "https://github.com/apple/swift-syntax", - .exact("0.50500.0") - ) -) -#elseif swift(>=5.4) -dependencies.append( - .package( - name: "SwiftSyntax", - url: "https://github.com/apple/swift-syntax", - .exact("0.50400.0") - ) -) -#elseif swift(>=5.3) -dependencies.append( - .package( - name: "SwiftSyntax", - url: "https://github.com/apple/swift-syntax", - .exact("0.50300.0") - ) -) -#else -fatalError("This version of Periphery does not support Swift <= 5.2.") -#endif #if os(macOS) dependencies.append( @@ -72,13 +50,8 @@ var peripheryKitDependencies: [PackageDescription.Target.Dependency] = [ .product(name: "SwiftIndexStore", package: "SwiftIndexStore") ] -#if swift(>=5.6) -peripheryKitDependencies.append( - .product( - name: "SwiftSyntaxParser", - package: "SwiftSyntax" - ) -) +#if compiler(>=5.6) +peripheryKitDependencies.append(.product(name: "SwiftSyntaxParser", package: "SwiftSyntax")) #endif var targets: [PackageDescription.Target] = [ diff --git a/Sources/PeripheryKit/Syntax/MultiplexingSyntaxVisitor.swift b/Sources/PeripheryKit/Syntax/MultiplexingSyntaxVisitor.swift index f89d41161..f6a8eea15 100644 --- a/Sources/PeripheryKit/Syntax/MultiplexingSyntaxVisitor.swift +++ b/Sources/PeripheryKit/Syntax/MultiplexingSyntaxVisitor.swift @@ -1,7 +1,7 @@ import Foundation import SystemPackage import SwiftSyntax -#if swift(>=5.6) +#if canImport(SwiftSyntaxParser) import SwiftSyntaxParser #endif diff --git a/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift b/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift index 1d58e54f4..61cdbf0eb 100644 --- a/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift +++ b/Sources/PeripheryKit/Syntax/UnusedParameterParser.swift @@ -1,7 +1,7 @@ import Foundation import SystemPackage import SwiftSyntax -#if swift(>=5.6) +#if canImport(SwiftSyntaxParser) import SwiftSyntaxParser #endif diff --git a/Tests/PeripheryTests/Syntax/TypeSyntaxInspectorTest.swift b/Tests/PeripheryTests/Syntax/TypeSyntaxInspectorTest.swift index 996d6e690..dc1a63c8d 100644 --- a/Tests/PeripheryTests/Syntax/TypeSyntaxInspectorTest.swift +++ b/Tests/PeripheryTests/Syntax/TypeSyntaxInspectorTest.swift @@ -1,7 +1,7 @@ import Foundation import XCTest import SwiftSyntax -#if swift(>=5.6) +#if canImport(SwiftSyntaxParser) import SwiftSyntaxParser #endif @testable import TestShared