Skip to content

Commit 0f80215

Browse files
Adding Swift 6 lang and language mode support (#57)
* Adding Swift 6 lang and language mode support
1 parent 9a4485d commit 0f80215

5 files changed

Lines changed: 104 additions & 11 deletions

File tree

.github/workflows/unit-tests.yml

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# This workflow uses actions that are not certified by GitHub.
32
# They are provided by a third-party and are governed by
43
# separate terms of service, privacy policy, and support
@@ -23,7 +22,25 @@ on:
2322
- '*' # Push events to every tag
2423

2524
jobs:
26-
swift_tests:
25+
swift_tests_latest:
26+
name: Latest Swift Version
27+
runs-on: macos-15
28+
steps:
29+
- uses: maxim-lobanov/setup-xcode@v1
30+
with:
31+
xcode-version: "16.0"
32+
- uses: actions/checkout@v3
33+
- uses: actions/cache@v3
34+
with:
35+
path: .build
36+
key: macos-latest-spm-${{ hashFiles('**/Package.resolved') }}
37+
restore-keys: |
38+
macos-latest-spm-
39+
- name: Build
40+
run: swift build
41+
- name: Run tests
42+
run: swift test
43+
swift_tests_previous:
2744
name: Swift Version ${{ matrix.swift }}
2845
strategy:
2946
matrix:
@@ -41,26 +58,51 @@ jobs:
4158
- uses: actions/cache@v3
4259
with:
4360
path: .build
44-
key: ${{ matrix.os }}-spm-${{ hashFiles('**/Package.resolved') }}
61+
key: ${{ matrix.os }}-${{ matrix.swift }}-spm-${{ hashFiles('**/Package.resolved') }}
4562
restore-keys: |
4663
${{ matrix.os }}-spm-
4764
- name: Build
4865
run: swift build
4966
- name: Run tests
5067
run: swift test
5168

52-
ios_tests:
69+
ios_tests_latest:
70+
name: iOS Unit Tests - Latest Swift
71+
runs-on: macos-15
72+
steps:
73+
- uses: maxim-lobanov/setup-xcode@v1
74+
with:
75+
xcode-version: "16.0"
76+
- uses: actions/checkout@v3
77+
- uses: actions/cache@v3
78+
with:
79+
path: .build
80+
key: macos-15-spm-${{ hashFiles('**/Package.resolved') }}
81+
restore-keys: |
82+
macos-15-spm-
83+
84+
- name: Build
85+
run: xcodebuild build -scheme SyntaxSparrow -destination "OS=18.1,name=iPhone 16"
86+
87+
- name: Test
88+
run: xcodebuild test -scheme SyntaxSparrow -destination "OS=18.1,name=iPhone 16" -enableCodeCoverage YES
89+
90+
ios_tests_previous:
5391
name: iOS Unit Tests
54-
runs-on: macos-13
92+
strategy:
93+
matrix:
94+
os: [macos-13]
95+
swift: ["5.9", "5.8"]
96+
runs-on: ${{ matrix.os }}
5597
steps:
5698
- uses: swift-actions/setup-swift@v1
5799
with:
58-
swift-version: 5.9
100+
swift-version: ${{ matrix.swift }}
59101
- uses: actions/checkout@v3
60102
- uses: actions/cache@v3
61103
with:
62104
path: .build
63-
key: ${{ matrix.os }}-spm-${{ hashFiles('**/Package.resolved') }}
105+
key: ${{ matrix.os }}-${{ matrix.swift }}-spm-${{ hashFiles('**/Package.resolved') }}
64106
restore-keys: |
65107
${{ matrix.os }}-spm-
66108

Package.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.9
1+
// swift-tools-version: 6.0
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
@@ -31,6 +31,9 @@ let package = Package(
3131
],
3232
resources: [
3333
.copy("Resources/PrivacyInfo.xcprivacy")
34+
],
35+
swiftSettings: [
36+
.swiftLanguageMode(.v6)
3437
]
3538
),
3639
.testTarget(

Package@swift-5.9.swift

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// swift-tools-version: 5.9
2+
// The swift-tools-version declares the minimum version of Swift required to build this package.
3+
4+
import PackageDescription
5+
6+
let package = Package(
7+
name: "SyntaxSparrow",
8+
platforms: [
9+
.macOS(.v10_15),
10+
.iOS(.v13),
11+
.tvOS(.v13),
12+
.watchOS(.v6),
13+
.macCatalyst(.v13)
14+
],
15+
products: [
16+
// Products define the executables and libraries a package produces, and make them visible to other packages.
17+
.library(
18+
name: "SyntaxSparrow",
19+
targets: ["SyntaxSparrow"]
20+
),
21+
],
22+
dependencies: [
23+
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.1"),
24+
],
25+
targets: [
26+
.target(
27+
name: "SyntaxSparrow",
28+
dependencies: [
29+
.product(name: "SwiftSyntax", package: "swift-syntax"),
30+
.product(name: "SwiftParser", package: "swift-syntax"),
31+
],
32+
resources: [
33+
.copy("Resources/PrivacyInfo.xcprivacy")
34+
]
35+
),
36+
.testTarget(
37+
name: "SyntaxSparrowTests",
38+
dependencies: [
39+
"SyntaxSparrow",
40+
]
41+
),
42+
]
43+
)
44+
45+
// Supplementary
46+
package.dependencies.append(contentsOf: [
47+
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "0.12.0"),
48+
])

Sources/SyntaxSparrow/Public/Utilities/SparrowSourceLocationConverter.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import Foundation
99
import SwiftSyntax
1010

11-
public class SparrowSourceLocationConverter {
11+
public class SparrowSourceLocationConverter: @unchecked Sendable {
1212
// MARK: - Properties
1313

1414
var converter: SourceLocationConverter

Sources/SyntaxSparrow/Public/Utilities/SyntaxSourceLocation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
import Foundation
99

10-
public struct SyntaxSourceLocation: Equatable, Codable, Hashable {
11-
public struct Position: Equatable, Codable, Hashable {
10+
public struct SyntaxSourceLocation: Equatable, Codable, Hashable, Sendable {
11+
public struct Position: Equatable, Codable, Hashable, Sendable {
1212
/// The line number the declaration was made on.
1313
///
1414
/// Will be `nil` if unresolvable.

0 commit comments

Comments
 (0)