Skip to content

Commit ce9a763

Browse files
committed
Relax dependency on SwiftFormat.
1 parent 4c8ed5c commit ce9a763

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ let package = Package(
5555
// Generate Swift code
5656
.package(
5757
url: "https://github.com/apple/swift-syntax.git",
58-
from: "508.0.1"
58+
"508.0.1"..<"510.0.0"
5959
),
6060

6161
// Format Swift code
6262
.package(
6363
url: "https://github.com/apple/swift-format.git",
64-
from: "508.0.1"
64+
"508.0.1"..<"510.0.0"
6565
),
6666

6767
// General algorithms

Sources/_OpenAPIGeneratorCore/Extensions/SwiftFormat.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,15 @@ extension String {
3939
assumingFileURL: nil,
4040
to: &formattedString
4141
) { diagnostic, sourceLocation in
42+
#if canImport(SwiftSyntax509)
43+
let location = "\(sourceLocation.line):\(sourceLocation.column)"
44+
#else
45+
let location = "\(sourceLocation.debugDescription)"
46+
#endif
4247
print(
4348
"""
4449
===
45-
Formatting the following code produced diagnostic at location \(sourceLocation.debugDescription) (see end):
50+
Formatting the following code produced diagnostic at location \(location) (see end):
4651
---
4752
\(self.withLineNumberPrefixes)
4853
---

Tests/OpenAPIGeneratorReferenceTests/FileBasedReferenceTests.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,11 @@ class FileBasedReferenceTests: XCTestCase {
4444
#endif
4545
}
4646

47-
func testPetstore() throws {
48-
try _test(referenceProject: .init(name: .petstore))
49-
}
47+
#if !canImport(SwiftSyntax509)
48+
func testPetstore() throws {
49+
try _test(referenceProject: .init(name: .petstore))
50+
}
51+
#endif
5052

5153
// MARK: - Private
5254

0 commit comments

Comments
 (0)