Skip to content

Commit 48f3e9b

Browse files
authored
Enable a more portable binary on macOS - Approach 2 (#480)
1 parent 689e1e0 commit 48f3e9b

File tree

5 files changed

+23
-50
lines changed

5 files changed

+23
-50
lines changed

Package.resolved

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Package.swift

Lines changed: 17 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,26 @@
1-
// swift-tools-version:5.2
1+
// swift-tools-version:5.3
22
import PackageDescription
33

4+
#if compiler(>=5.6)
5+
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50600.1-static")
6+
#elseif compiler(>=5.5)
7+
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50500.0-static")
8+
#elseif compiler(>=5.4)
9+
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50400.0")
10+
#elseif compiler(>=5.3)
11+
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50300.0")
12+
#else
13+
fatalError("This version of Periphery does not support Swift <= 5.2.")
14+
#endif
15+
416
var dependencies: [Package.Dependency] = [
517
.package(url: "https://github.com/apple/swift-system", from: "1.0.0"),
618
.package(url: "https://github.com/jpsim/Yams", from: "4.0.0"),
719
.package(url: "https://github.com/tadija/AEXML", from: "4.0.0"),
820
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
9-
.package(name: "SwiftIndexStore", url: "https://github.com/kateinoigakukun/swift-indexstore", from: "0.0.0")
21+
.package(name: "SwiftIndexStore", url: "https://github.com/kateinoigakukun/swift-indexstore", from: "0.0.0"),
22+
.package(name: "SwiftSyntax", url: "https://github.com/peripheryapp/swift-syntax", swiftSyntaxVersion)
1023
]
11-
#if swift(>=5.6)
12-
dependencies.append(
13-
.package(
14-
name: "SwiftSyntax",
15-
url: "https://github.com/apple/swift-syntax",
16-
.exact("0.50600.1")
17-
)
18-
)
19-
#elseif swift(>=5.5)
20-
dependencies.append(
21-
.package(
22-
name: "SwiftSyntax",
23-
url: "https://github.com/apple/swift-syntax",
24-
.exact("0.50500.0")
25-
)
26-
)
27-
#elseif swift(>=5.4)
28-
dependencies.append(
29-
.package(
30-
name: "SwiftSyntax",
31-
url: "https://github.com/apple/swift-syntax",
32-
.exact("0.50400.0")
33-
)
34-
)
35-
#elseif swift(>=5.3)
36-
dependencies.append(
37-
.package(
38-
name: "SwiftSyntax",
39-
url: "https://github.com/apple/swift-syntax",
40-
.exact("0.50300.0")
41-
)
42-
)
43-
#else
44-
fatalError("This version of Periphery does not support Swift <= 5.2.")
45-
#endif
4624

4725
#if os(macOS)
4826
dependencies.append(
@@ -72,13 +50,8 @@ var peripheryKitDependencies: [PackageDescription.Target.Dependency] = [
7250
.product(name: "SwiftIndexStore", package: "SwiftIndexStore")
7351
]
7452

75-
#if swift(>=5.6)
76-
peripheryKitDependencies.append(
77-
.product(
78-
name: "SwiftSyntaxParser",
79-
package: "SwiftSyntax"
80-
)
81-
)
53+
#if compiler(>=5.6)
54+
peripheryKitDependencies.append(.product(name: "SwiftSyntaxParser", package: "SwiftSyntax"))
8255
#endif
8356

8457
var targets: [PackageDescription.Target] = [

Sources/PeripheryKit/Syntax/MultiplexingSyntaxVisitor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import SystemPackage
33
import SwiftSyntax
4-
#if swift(>=5.6)
4+
#if canImport(SwiftSyntaxParser)
55
import SwiftSyntaxParser
66
#endif
77

Sources/PeripheryKit/Syntax/UnusedParameterParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import SystemPackage
33
import SwiftSyntax
4-
#if swift(>=5.6)
4+
#if canImport(SwiftSyntaxParser)
55
import SwiftSyntaxParser
66
#endif
77

Tests/PeripheryTests/Syntax/TypeSyntaxInspectorTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Foundation
22
import XCTest
33
import SwiftSyntax
4-
#if swift(>=5.6)
4+
#if canImport(SwiftSyntaxParser)
55
import SwiftSyntaxParser
66
#endif
77
@testable import TestShared

0 commit comments

Comments
 (0)