Skip to content

Commit 25a2348

Browse files
Support Swift 6/Xcode 16 (#828)
* Support Swift/SourceKit 6 * Update Xcode/Swift versions to test * Define enough Windows types and objects to make SourceKit happy in testing * Add a reminder for future test failures --------- Co-authored-by: John Fairhurst <[email protected]>
1 parent 3db8072 commit 25a2348

21 files changed

+33036
-7
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ build --macos_minimum_os=12
33
build --repo_env=CC=clang
44
test --test_output=errors
55
test --spawn_strategy=standalone
6+
test --macos_minimum_os=13

.github/workflows/bazel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
MacOS:
1111
strategy:
1212
matrix:
13-
xcode_version: ['15.2', '15.3']
13+
xcode_version: ['15.3', '15.4', '16.1', '16.2']
1414
runs-on: macos-14
1515
steps:
1616
- uses: actions/checkout@v2
@@ -22,7 +22,7 @@ jobs:
2222
Linux:
2323
strategy:
2424
matrix:
25-
tag: ['5.8-focal', '5.9-focal', '5.10-focal']
25+
tag: ['5.8-focal', '5.9-focal', '5.10-focal', '6.0-focal']
2626
runs-on: ubuntu-latest
2727
container:
2828
image: swift:${{ matrix.tag }}

.github/workflows/swiftpm.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
Xcode:
1111
strategy:
1212
matrix:
13-
xcode_version: ['14.3.1', '15.2', '15.3']
13+
xcode_version: ['15.3', '15.4', '16.1', '16.2']
1414
runs-on: macos-14
1515
steps:
1616
- uses: actions/checkout@v3
@@ -24,7 +24,7 @@ jobs:
2424
Linux:
2525
strategy:
2626
matrix:
27-
tag: ['5.8', '5.9', '5.10']
27+
tag: ['5.8', '5.9', '5.10', '6.0']
2828
runs-on: ubuntu-latest
2929
container:
3030
image: swift:${{ matrix.tag }}

.github/workflows/xcodebuild.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
Xcode:
1111
strategy:
1212
matrix:
13-
xcode_version: ['14.3.1', '15.2', '15.3']
13+
xcode_version: ['15.3', '15.4', '16.1', '16.2']
1414
runs-on: macos-14
1515
steps:
1616
- uses: actions/checkout@v3
1717
- uses: maxim-lobanov/setup-xcode@v1
1818
with:
1919
xcode-version: ${{ matrix.xcode_version }}
2020
- run: xcodebuild -version
21-
- run: xcodebuild -scheme sourcekitten -parallel-testing-enabled NO test -destination platform=macOS
21+
- run: xcodebuild -scheme SourceKitten-Package -parallel-testing-enabled NO test -destination platform=macOS

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
[John Fairhurst](https://github.com/johnfairh)
1414
[#821]((https://github.com/realm/SourceKitten/issues/821)
1515

16+
* Added new syntax, attribute and declaration kinds introduced in Swift 6.0.
17+
[SimplyDanny](https://github.com/SimplyDanny)
18+
1619
#### Bug Fixes
1720

1821
* None.

Source/SourceKittenFramework/SwiftDeclarationAttributeKind.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,18 @@ public enum SwiftDeclarationAttributeKind: String, CaseIterable {
201201
case _rawLayout = "source.decl.attribute._rawLayout"
202202
case _section = "source.decl.attribute._section"
203203
case _used = "source.decl.attribute._used"
204+
205+
// Only available in Swift >= 6.0
206+
case _extern = "source.decl.attribute._extern"
207+
case _resultDependsOnSelf = "source.decl.attribute._resultDependsOnSelf"
208+
case _preInverseGenerics = "source.decl.attribute._preInverseGenerics"
209+
case implementation = "source.decl.attribute.implementation"
210+
case _allowFeatureSuppression = "source.decl.attribute._allowFeatureSuppression"
211+
case _noRuntime = "source.decl.attribute._noRuntime"
212+
case _staticExclusiveOnly = "source.decl.attribute._staticExclusiveOnly"
213+
case extractConstantsFromMembers = "source.decl.attribute.extractConstantsFromMembers"
214+
case _unsafeNonescapableResult = "source.decl.attribute._unsafeNonescapableResult"
215+
case _noExistentials = "source.decl.attribute._noExistentials"
216+
case _noObjCBridging = "source.decl.attribute._noObjCBridging"
217+
case _nonescapable = "source.decl.attribute._nonescapable"
204218
}

Source/SourceKittenFramework/WindowsError.swift

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
#if os(Windows)
22
import WinSDK
33

4+
#if !os(Windows)
5+
// Shims for !windows SourceKit - see LibraryWrapperGeneratorTests.testLibraryWrappersAreUpToDate
6+
private typealias WORD = UInt
7+
private typealias DWORD = WORD
8+
private typealias WCHAR = WORD
9+
private let FORMAT_MESSAGE_ALLOCATE_BUFFER = 0
10+
private let FORMAT_MESSAGE_FROM_SYSTEM = 0
11+
private let FORMAT_MESSAGE_IGNORE_INSERTS = 0
12+
13+
// swiftlint:disable:next function_parameter_count
14+
private func FormatMessageW(_ a: DWORD, _ b: Int?, _ c: DWORD, _ d: DWORD, _ e: Any?, _ f: Int, _ g: Int?) -> DWORD { 0 }
15+
#endif
16+
417
@_transparent
518
internal func MAKELANGID(_ p: WORD, _ s: WORD) -> DWORD {
619
return DWORD((s << 10) | p)

Tests/SourceKittenFrameworkTests/Fixtures/[email protected]

Lines changed: 888 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)