Skip to content

Commit

Permalink
Support prerelease versions of Swift Syntax (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
liamnichols authored Jul 16, 2024
1 parent ad243ad commit b83ecd8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ jobs:
runs-on: macOS-14
env:
DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer
SWIFT_SYNTAX_REVISION: ${{ matrix.revision }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Update Package Pins
run: |
jq '(.pins[] | select(.identity == "swift-syntax") | .state.revision) = "${{ matrix.revision }}" | (.pins[] | select(.identity == "swift-syntax") | .state.version) = "${{ matrix.swift-syntax }}"' Package.resolved | sed 's/": /" : /g' > Package.resolved.tmp && mv Package.resolved.tmp Package.resolved
git diff Package.resolved
- name: Run Tests
run: xcodebuild clean test -scheme XCStringsTool-Package -destination platform=macOS
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/swiftlang/swift-syntax",
"state" : {
"revision" : "303e5c5c36d6a558407d364878df131c3546fad8",
"version" : "510.0.2"
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
"version" : "600.0.0-prerelease-2024-06-12"
}
}
],
Expand Down
11 changes: 1 addition & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ let package = Package(
],
dependencies: [
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.2.3"),
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0" ..< "601.0.0"),
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0" ..< "601.0.0-prerelease"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing", from: "1.13.0"),
.package(url: "https://github.com/swiftlang/swift-docc-plugin", from: "1.0.0"),
],
Expand Down Expand Up @@ -170,12 +170,3 @@ if ProcessInfo.processInfo.environment.keys.contains("BENCHMARK_PACKAGE") {
)
)
}

// Support testing different versions of Swift Syntax
if let revision = ProcessInfo.processInfo.environment["SWIFT_SYNTAX_REVISION"] {
// TODO: The `kind` symbol isn't available in Xcode 15.2? Check newer versions.
package.dependencies.removeAll(where: { $0.url == "https://github.com/swiftlang/swift-syntax" })
package.dependencies.append(
.package(url: "https://github.com/swiftlang/swift-syntax", revision: revision)
)
}

0 comments on commit b83ecd8

Please sign in to comment.