Skip to content

Commit 339725a

Browse files
Override swift-syntax version via environment variable
1 parent b8edeeb commit 339725a

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

.github/workflows/test.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,14 @@ jobs:
6363
name: Test BridgeJS against Swift versions
6464
strategy:
6565
matrix:
66-
swift-image:
67-
- "swift:6.1.2" # Tests with SwiftSyntax 601.x (non-SwiftSyntax602 code path)
68-
- "swift:6.2" # Tests with SwiftSyntax 602.x (SwiftSyntax602 code path)
66+
entry:
67+
- image: "swift:6.1.2"
68+
swift-syntax-version: "601.0.0"
69+
- image: "swift:6.2"
70+
swift-syntax-version: "602.0.0"
6971
runs-on: ubuntu-latest
7072
container:
71-
image: ${{ matrix.swift-image }}
73+
image: ${{ matrix.entry.image }}
7274
steps:
7375
- uses: actions/checkout@v6
7476
- name: Setup Node.js
@@ -77,18 +79,12 @@ jobs:
7779
node-version: '20'
7880
- name: Install TypeScript
7981
run: npm install --prefix Plugins/BridgeJS/Sources/TS2Swift/JavaScript
80-
- name: Force SwiftSyntax 602 for Swift 6.2
81-
if: matrix.swift-image == 'swift:6.2'
82-
working-directory: Plugins/BridgeJS
83-
run: |
84-
# Force SwiftSyntax 602.x to test the SwiftSyntax602 code path
85-
sed -i 's/from: "600.0.1"/from: "602.0.0"/' Package.swift
86-
# Clean any cached resolution
87-
rm -rf .build Package.resolved
8882
- name: Run BridgeJS tests
8983
# NOTE: Seems like the prebuilt SwiftSyntax binaries are not compatible with
9084
# non-macro dependents, so disable experimental prebuilts for now.
9185
run: swift test --disable-experimental-prebuilts --package-path ./Plugins/BridgeJS
86+
env:
87+
BRIDGEJS_OVERRIDE_SWIFT_SYNTAX_VERSION: ${{ matrix.entry.swift-syntax-version }}
9288

9389
native-build:
9490
# Check native build to make it easy to develop applications by Xcode

Plugins/BridgeJS/Package.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import CompilerPluginSupport
44
import PackageDescription
55

6+
let swiftSyntaxVersion = Context.environment["BRIDGEJS_OVERRIDE_SWIFT_SYNTAX_VERSION"] ?? "600.0.1"
7+
68
let package = Package(
79
name: "BridgeJS",
810
platforms: [.macOS(.v13)],
911
dependencies: [
10-
.package(url: "https://github.com/swiftlang/swift-syntax", from: "600.0.1"),
12+
.package(url: "https://github.com/swiftlang/swift-syntax", from: Version(swiftSyntaxVersion)!),
1113
// Development dependencies
1214
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.7.0"),
1315
],

0 commit comments

Comments
 (0)