Skip to content

Adding Swift 6 lang and language mode support #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Oct 22, 2024
Merged
56 changes: 49 additions & 7 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
Expand All @@ -23,7 +22,25 @@ on:
- '*' # Push events to every tag

jobs:
swift_tests:
swift_tests_latest:
name: Latest Swift Version
runs-on: macos-15
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.0"
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: .build
key: macos-latest-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
macos-latest-spm-
- name: Build
run: swift build
- name: Run tests
run: swift test
swift_tests_previous:
name: Swift Version ${{ matrix.swift }}
strategy:
matrix:
Expand All @@ -41,26 +58,51 @@ jobs:
- uses: actions/cache@v3
with:
path: .build
key: ${{ matrix.os }}-spm-${{ hashFiles('**/Package.resolved') }}
key: ${{ matrix.os }}-${{ matrix.swift }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ matrix.os }}-spm-
- name: Build
run: swift build
- name: Run tests
run: swift test

ios_tests:
ios_tests_latest:
name: iOS Unit Tests - Latest Swift
runs-on: macos-15
steps:
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.0"
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: .build
key: macos-15-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
macos-15-spm-

- name: Build
run: xcodebuild build -scheme SyntaxSparrow -destination "OS=18.1,name=iPhone 16"

- name: Test
run: xcodebuild test -scheme SyntaxSparrow -destination "OS=18.1,name=iPhone 16" -enableCodeCoverage YES

ios_tests_previous:
name: iOS Unit Tests
runs-on: macos-13
strategy:
matrix:
os: [macos-13]
swift: ["5.9", "5.8"]
runs-on: ${{ matrix.os }}
steps:
- uses: swift-actions/setup-swift@v1
with:
swift-version: 5.9
swift-version: ${{ matrix.swift }}
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: .build
key: ${{ matrix.os }}-spm-${{ hashFiles('**/Package.resolved') }}
key: ${{ matrix.os }}-${{ matrix.swift }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ matrix.os }}-spm-

Expand Down
5 changes: 4 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.9
// swift-tools-version: 6.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down Expand Up @@ -31,6 +31,9 @@ let package = Package(
],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy")
],
swiftSettings: [
.swiftLanguageMode(.v6)
]
),
.testTarget(
Expand Down
48 changes: 48 additions & 0 deletions Package@swift-5.9.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SyntaxSparrow",
platforms: [
.macOS(.v10_15),
.iOS(.v13),
.tvOS(.v13),
.watchOS(.v6),
.macCatalyst(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SyntaxSparrow",
targets: ["SyntaxSparrow"]
),
],
dependencies: [
.package(url: "https://github.com/swiftlang/swift-syntax.git", from: "600.0.1"),
],
targets: [
.target(
name: "SyntaxSparrow",
dependencies: [
.product(name: "SwiftSyntax", package: "swift-syntax"),
.product(name: "SwiftParser", package: "swift-syntax"),
],
resources: [
.copy("Resources/PrivacyInfo.xcprivacy")
]
),
.testTarget(
name: "SyntaxSparrowTests",
dependencies: [
"SyntaxSparrow",
]
),
]
)

// Supplementary
package.dependencies.append(contentsOf: [
.package(url: "https://github.com/SwiftPackageIndex/SPIManifest.git", from: "0.12.0"),
])
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
import SwiftSyntax

public class SparrowSourceLocationConverter {
public class SparrowSourceLocationConverter: @unchecked Sendable {
// MARK: - Properties

var converter: SourceLocationConverter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import Foundation

public struct SyntaxSourceLocation: Equatable, Codable, Hashable {
public struct Position: Equatable, Codable, Hashable {
public struct SyntaxSourceLocation: Equatable, Codable, Hashable, Sendable {
public struct Position: Equatable, Codable, Hashable, Sendable {
/// The line number the declaration was made on.
///
/// Will be `nil` if unresolvable.
Expand Down
Loading