Skip to content

Commit

Permalink
Support Swift 6/Xcode 16 (#828)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
SimplyDanny and johnfairh authored Feb 11, 2025
1 parent 3db8072 commit 25a2348
Show file tree
Hide file tree
Showing 21 changed files with 33,036 additions and 7 deletions.
1 change: 1 addition & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build --macos_minimum_os=12
build --repo_env=CC=clang
test --test_output=errors
test --spawn_strategy=standalone
test --macos_minimum_os=13
4 changes: 2 additions & 2 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
MacOS:
strategy:
matrix:
xcode_version: ['15.2', '15.3']
xcode_version: ['15.3', '15.4', '16.1', '16.2']
runs-on: macos-14
steps:
- uses: actions/checkout@v2
Expand All @@ -22,7 +22,7 @@ jobs:
Linux:
strategy:
matrix:
tag: ['5.8-focal', '5.9-focal', '5.10-focal']
tag: ['5.8-focal', '5.9-focal', '5.10-focal', '6.0-focal']
runs-on: ubuntu-latest
container:
image: swift:${{ matrix.tag }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/swiftpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
Xcode:
strategy:
matrix:
xcode_version: ['14.3.1', '15.2', '15.3']
xcode_version: ['15.3', '15.4', '16.1', '16.2']
runs-on: macos-14
steps:
- uses: actions/checkout@v3
Expand All @@ -24,7 +24,7 @@ jobs:
Linux:
strategy:
matrix:
tag: ['5.8', '5.9', '5.10']
tag: ['5.8', '5.9', '5.10', '6.0']
runs-on: ubuntu-latest
container:
image: swift:${{ matrix.tag }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/xcodebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ jobs:
Xcode:
strategy:
matrix:
xcode_version: ['14.3.1', '15.2', '15.3']
xcode_version: ['15.3', '15.4', '16.1', '16.2']
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: ${{ matrix.xcode_version }}
- run: xcodebuild -version
- run: xcodebuild -scheme sourcekitten -parallel-testing-enabled NO test -destination platform=macOS
- run: xcodebuild -scheme SourceKitten-Package -parallel-testing-enabled NO test -destination platform=macOS
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
[John Fairhurst](https://github.com/johnfairh)
[#821]((https://github.com/realm/SourceKitten/issues/821)

* Added new syntax, attribute and declaration kinds introduced in Swift 6.0.
[SimplyDanny](https://github.com/SimplyDanny)

#### Bug Fixes

* None.
Expand Down
14 changes: 14 additions & 0 deletions Source/SourceKittenFramework/SwiftDeclarationAttributeKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,18 @@ public enum SwiftDeclarationAttributeKind: String, CaseIterable {
case _rawLayout = "source.decl.attribute._rawLayout"
case _section = "source.decl.attribute._section"
case _used = "source.decl.attribute._used"

// Only available in Swift >= 6.0
case _extern = "source.decl.attribute._extern"
case _resultDependsOnSelf = "source.decl.attribute._resultDependsOnSelf"
case _preInverseGenerics = "source.decl.attribute._preInverseGenerics"
case implementation = "source.decl.attribute.implementation"
case _allowFeatureSuppression = "source.decl.attribute._allowFeatureSuppression"
case _noRuntime = "source.decl.attribute._noRuntime"
case _staticExclusiveOnly = "source.decl.attribute._staticExclusiveOnly"
case extractConstantsFromMembers = "source.decl.attribute.extractConstantsFromMembers"
case _unsafeNonescapableResult = "source.decl.attribute._unsafeNonescapableResult"
case _noExistentials = "source.decl.attribute._noExistentials"
case _noObjCBridging = "source.decl.attribute._noObjCBridging"
case _nonescapable = "source.decl.attribute._nonescapable"
}
13 changes: 13 additions & 0 deletions Source/SourceKittenFramework/WindowsError.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#if os(Windows)
import WinSDK

#if !os(Windows)
// Shims for !windows SourceKit - see LibraryWrapperGeneratorTests.testLibraryWrappersAreUpToDate
private typealias WORD = UInt
private typealias DWORD = WORD
private typealias WCHAR = WORD
private let FORMAT_MESSAGE_ALLOCATE_BUFFER = 0
private let FORMAT_MESSAGE_FROM_SYSTEM = 0
private let FORMAT_MESSAGE_IGNORE_INSERTS = 0

// swiftlint:disable:next function_parameter_count
private func FormatMessageW(_ a: DWORD, _ b: Int?, _ c: DWORD, _ d: DWORD, _ e: Any?, _ f: Int, _ g: Int?) -> DWORD { 0 }
#endif

@_transparent
internal func MAKELANGID(_ p: WORD, _ s: WORD) -> DWORD {
return DWORD((s << 10) | p)
Expand Down
888 changes: 888 additions & 0 deletions Tests/SourceKittenFrameworkTests/Fixtures/[email protected]

Large diffs are not rendered by default.

Loading

0 comments on commit 25a2348

Please sign in to comment.