Skip to content

Commit d3357c9

Browse files
committed
Modernize Package.swift.
We've been using an old tools-version for a while; bring it up to a modern state.
1 parent 459c23f commit d3357c9

File tree

1 file changed

+63
-33
lines changed

1 file changed

+63
-33
lines changed

Package.swift

Lines changed: 63 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.6
22
//===----------------------------------------------------------------------===//
33
//
44
// This source file is part of the Swift.org open source project
@@ -11,20 +11,30 @@
1111
//
1212
//===----------------------------------------------------------------------===//
1313

14-
import PackageDescription
1514
import Foundation
15+
import PackageDescription
1616

1717
let package = Package(
1818
name: "swift-format",
1919
platforms: [
20-
.macOS(.v10_11)
20+
.macOS("10.15")
2121
],
2222
products: [
23-
.executable(name: "swift-format", targets: ["swift-format"]),
24-
.library(name: "SwiftFormat", targets: ["SwiftFormat", "SwiftFormatConfiguration"]),
25-
.library(name: "SwiftFormatConfiguration", targets: ["SwiftFormatConfiguration"]),
23+
.executable(
24+
name: "swift-format",
25+
targets: ["swift-format"]
26+
),
27+
.library(
28+
name: "SwiftFormat",
29+
targets: ["SwiftFormat", "SwiftFormatConfiguration"]
30+
),
31+
.library(
32+
name: "SwiftFormatConfiguration",
33+
targets: ["SwiftFormatConfiguration"]
34+
),
2635
],
2736
dependencies: [
37+
// See the "Dependencies" section below.
2838
],
2939
targets: [
3040
.target(
@@ -35,12 +45,20 @@ let package = Package(
3545
"SwiftFormatPrettyPrint",
3646
"SwiftFormatRules",
3747
"SwiftFormatWhitespaceLinter",
38-
"SwiftSyntax",
39-
"SwiftSyntaxParser",
48+
.product(name: "SwiftSyntax", package: "swift-syntax"),
49+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
50+
]
51+
),
52+
.target(
53+
name: "SwiftFormatConfiguration"
54+
),
55+
.target(
56+
name: "SwiftFormatCore",
57+
dependencies: [
58+
"SwiftFormatConfiguration",
59+
.product(name: "SwiftSyntax", package: "swift-syntax"),
4060
]
4161
),
42-
.target(name: "SwiftFormatConfiguration"),
43-
.target(name: "SwiftFormatCore", dependencies: ["SwiftFormatConfiguration", "SwiftSyntax"]),
4462
.target(
4563
name: "SwiftFormatRules",
4664
dependencies: ["SwiftFormatCore", "SwiftFormatConfiguration"]
@@ -61,35 +79,37 @@ let package = Package(
6179
name: "SwiftFormatWhitespaceLinter",
6280
dependencies: [
6381
"SwiftFormatCore",
64-
"SwiftSyntax",
82+
.product(name: "SwiftSyntax", package: "swift-syntax"),
6583
]
6684
),
67-
.target(
85+
86+
.executableTarget(
6887
name: "generate-pipeline",
6988
dependencies: [
7089
"SwiftFormatCore",
7190
"SwiftFormatRules",
72-
"SwiftSyntax",
73-
"SwiftSyntaxParser",
91+
.product(name: "SwiftSyntax", package: "swift-syntax"),
92+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
7493
]
7594
),
76-
.target(
95+
.executableTarget(
7796
name: "swift-format",
7897
dependencies: [
79-
"ArgumentParser",
8098
"SwiftFormat",
8199
"SwiftFormatConfiguration",
82100
"SwiftFormatCore",
83-
"SwiftSyntax",
84-
"TSCBasic",
101+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
102+
.product(name: "SwiftSyntax", package: "swift-syntax"),
103+
.product(name: "TSCBasic", package: "swift-tools-support-core"),
85104
]
86105
),
106+
87107
.testTarget(
88108
name: "SwiftFormatTests",
89109
dependencies: [
90110
"SwiftFormat",
91-
"SwiftSyntax",
92-
"SwiftSyntaxParser",
111+
.product(name: "SwiftSyntax", package: "swift-syntax"),
112+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
93113
]
94114
),
95115
.testTarget(
@@ -101,17 +121,17 @@ let package = Package(
101121
dependencies: [
102122
"SwiftFormatConfiguration",
103123
"SwiftFormatCore",
104-
"SwiftSyntax",
105-
"SwiftSyntaxParser",
124+
.product(name: "SwiftSyntax", package: "swift-syntax"),
125+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
106126
]
107127
),
108128
.testTarget(
109129
name: "SwiftFormatPerformanceTests",
110130
dependencies: [
111131
"SwiftFormatTestSupport",
112132
"SwiftFormatWhitespaceLinter",
113-
"SwiftSyntax",
114-
"SwiftSyntaxParser",
133+
.product(name: "SwiftSyntax", package: "swift-syntax"),
134+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
115135
]
116136
),
117137
.testTarget(
@@ -122,8 +142,8 @@ let package = Package(
122142
"SwiftFormatPrettyPrint",
123143
"SwiftFormatRules",
124144
"SwiftFormatTestSupport",
125-
"SwiftSyntax",
126-
"SwiftSyntaxParser",
145+
.product(name: "SwiftSyntax", package: "swift-syntax"),
146+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
127147
]
128148
),
129149
.testTarget(
@@ -134,8 +154,8 @@ let package = Package(
134154
"SwiftFormatPrettyPrint",
135155
"SwiftFormatRules",
136156
"SwiftFormatTestSupport",
137-
"SwiftSyntax",
138-
"SwiftSyntaxParser",
157+
.product(name: "SwiftSyntax", package: "swift-syntax"),
158+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
139159
]
140160
),
141161
.testTarget(
@@ -145,20 +165,30 @@ let package = Package(
145165
"SwiftFormatCore",
146166
"SwiftFormatTestSupport",
147167
"SwiftFormatWhitespaceLinter",
148-
"SwiftSyntax",
149-
"SwiftSyntaxParser",
168+
.product(name: "SwiftSyntax", package: "swift-syntax"),
169+
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
150170
]
151171
),
152172
]
153173
)
154174

175+
// MARK: Dependencies
155176

156177
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
157178
// Building standalone.
158179
package.dependencies += [
159-
.package(url: "https://github.com/apple/swift-argument-parser.git", .branch("main")),
160-
.package(url: "https://github.com/apple/swift-syntax", .branch("main")),
161-
.package(url: "https://github.com/apple/swift-tools-support-core.git", .branch("main")),
180+
.package(
181+
url: "https://github.com/apple/swift-argument-parser.git",
182+
branch: "main"
183+
),
184+
.package(
185+
url: "https://github.com/apple/swift-syntax",
186+
branch: "main"
187+
),
188+
.package(
189+
url: "https://github.com/apple/swift-tools-support-core.git",
190+
branch: "main"
191+
),
162192
]
163193
} else {
164194
package.dependencies += [

0 commit comments

Comments
 (0)