Update SwiftSyntax to 0.50600.0 (#3901)
Uses SwiftSyntax 5.5 on Linux when building with Swift 5.5. We use the 5.6 version of SwiftSyntax when building with Swift 5.5 and 5.6 on macOS because we statically link `lib_InternalSwiftSyntaxParser` thanks to https://github.com/keith/StaticInternalSwiftSyntaxParser/releases/tag/5.6. This keeps SwiftLint binaries portable across machines on macOS, regardless of _where_ or even _if_ `lib_InternalSwiftSyntaxParser` is installed. * Run TSan CI job with `--configuration release` to avoid stack overflows * Add Swift 5.6 CI job * Fix linker settings
This commit is contained in:
parent
ca2712aaee
commit
de3569cb3b
|
@ -21,10 +21,10 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"package": "SwiftSyntax",
|
"package": "SwiftSyntax",
|
||||||
"repositoryURL": "https://github.com/apple/swift-syntax.git",
|
"repositoryURL": "https://github.com/apple/swift-syntax",
|
||||||
"state": {
|
"state": {
|
||||||
"branch": null,
|
"branch": "0.50600.0",
|
||||||
"revision": "cf40be70deaf4ce7d44eb1a7e14299c391e2363f",
|
"revision": "0467d94e8123071e8e6c24039aadb405318f1838",
|
||||||
"version": null
|
"version": null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,18 +1,29 @@
|
||||||
// swift-tools-version:5.5
|
// swift-tools-version:5.5
|
||||||
import PackageDescription
|
import PackageDescription
|
||||||
|
|
||||||
#if canImport(CommonCrypto)
|
|
||||||
private let addCryptoSwift = false
|
|
||||||
#else
|
|
||||||
private let addCryptoSwift = true
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if os(macOS)
|
#if os(macOS)
|
||||||
|
private let addCryptoSwift = false
|
||||||
private let staticSwiftSyntax = true
|
private let staticSwiftSyntax = true
|
||||||
#else
|
#else
|
||||||
|
private let addCryptoSwift = true
|
||||||
private let staticSwiftSyntax = false
|
private let staticSwiftSyntax = false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if os(Linux) && compiler(<5.6)
|
||||||
|
private let swiftSyntaxFiveDotSix = false
|
||||||
|
#else
|
||||||
|
private let swiftSyntaxFiveDotSix = true
|
||||||
|
#endif
|
||||||
|
|
||||||
|
let frameworkDependencies: [Target.Dependency] = [
|
||||||
|
.product(name: "SourceKittenFramework", package: "SourceKitten"),
|
||||||
|
.product(name: "SwiftSyntax", package: "SwiftSyntax"),
|
||||||
|
"Yams",
|
||||||
|
]
|
||||||
|
+ (addCryptoSwift ? ["CryptoSwift"] : [])
|
||||||
|
+ (staticSwiftSyntax ? ["lib_InternalSwiftSyntaxParser"] : [])
|
||||||
|
+ (swiftSyntaxFiveDotSix ? [.product(name: "SwiftSyntaxParser", package: "SwiftSyntax")] : [])
|
||||||
|
|
||||||
let package = Package(
|
let package = Package(
|
||||||
name: "SwiftLint",
|
name: "SwiftLint",
|
||||||
platforms: [.macOS(.v10_12)],
|
platforms: [.macOS(.v10_12)],
|
||||||
|
@ -23,7 +34,7 @@ let package = Package(
|
||||||
dependencies: [
|
dependencies: [
|
||||||
.package(name: "swift-argument-parser", url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.0.3")),
|
.package(name: "swift-argument-parser", url: "https://github.com/apple/swift-argument-parser.git", .upToNextMinor(from: "1.0.3")),
|
||||||
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git",
|
.package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git",
|
||||||
.revision("cf40be70deaf4ce7d44eb1a7e14299c391e2363f")),
|
.revision(swiftSyntaxFiveDotSix ? "0467d94e8123071e8e6c24039aadb405318f1838" : "cf40be70deaf4ce7d44eb1a7e14299c391e2363f")),
|
||||||
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.32.0"),
|
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.32.0"),
|
||||||
.package(url: "https://github.com/jpsim/Yams.git", from: "4.0.2"),
|
.package(url: "https://github.com/jpsim/Yams.git", from: "4.0.2"),
|
||||||
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"),
|
.package(url: "https://github.com/scottrhoyt/SwiftyTextTable.git", from: "0.9.0"),
|
||||||
|
@ -39,13 +50,11 @@ let package = Package(
|
||||||
),
|
),
|
||||||
.target(
|
.target(
|
||||||
name: "SwiftLintFramework",
|
name: "SwiftLintFramework",
|
||||||
dependencies: [
|
dependencies: frameworkDependencies,
|
||||||
.product(name: "SourceKittenFramework", package: "SourceKitten"),
|
// Pass `-dead_strip_dylibs` to ignore the dynamic version of `lib_InternalSwiftSyntaxParser`
|
||||||
"SwiftSyntax",
|
// that ships with SwiftSyntax because we want the static version from
|
||||||
"Yams",
|
// `StaticInternalSwiftSyntaxParser`.
|
||||||
]
|
linkerSettings: staticSwiftSyntax ? [.unsafeFlags(["-Xlinker", "-dead_strip_dylibs"])] : []
|
||||||
+ (addCryptoSwift ? ["CryptoSwift"] : [])
|
|
||||||
+ (staticSwiftSyntax ? ["lib_InternalSwiftSyntaxParser"] : [])
|
|
||||||
),
|
),
|
||||||
.testTarget(
|
.testTarget(
|
||||||
name: "SwiftLintFrameworkTests",
|
name: "SwiftLintFrameworkTests",
|
||||||
|
@ -58,7 +67,7 @@ let package = Package(
|
||||||
),
|
),
|
||||||
] + (staticSwiftSyntax ? [.binaryTarget(
|
] + (staticSwiftSyntax ? [.binaryTarget(
|
||||||
name: "lib_InternalSwiftSyntaxParser",
|
name: "lib_InternalSwiftSyntaxParser",
|
||||||
url: "https://github.com/keith/StaticInternalSwiftSyntaxParser/releases/download/5.5.2/lib_InternalSwiftSyntaxParser.xcframework.zip",
|
url: "https://github.com/keith/StaticInternalSwiftSyntaxParser/releases/download/5.6/lib_InternalSwiftSyntaxParser.xcframework.zip",
|
||||||
checksum: "96bbc9ab4679953eac9ee46778b498cb559b8a7d9ecc658e54d6679acfbb34b8"
|
checksum: "88d748f76ec45880a8250438bd68e5d6ba716c8042f520998a438db87083ae9d"
|
||||||
)] : [])
|
)] : [])
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
import Foundation
|
import Foundation
|
||||||
import SourceKittenFramework
|
import SourceKittenFramework
|
||||||
import SwiftSyntax
|
import SwiftSyntax
|
||||||
|
#if canImport(SwiftSyntaxParser)
|
||||||
|
import SwiftSyntaxParser
|
||||||
|
#endif
|
||||||
|
|
||||||
private typealias FileCacheKey = UUID
|
private typealias FileCacheKey = UUID
|
||||||
private var responseCache = Cache({ file -> [String: SourceKitRepresentable]? in
|
private var responseCache = Cache({ file -> [String: SourceKitRepresentable]? in
|
||||||
|
|
|
@ -10,6 +10,8 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
swift55:
|
swift55:
|
||||||
containerImage: swift:5.5
|
containerImage: swift:5.5
|
||||||
|
swift56:
|
||||||
|
containerImage: swift:5.6
|
||||||
container: $[ variables['containerImage'] ]
|
container: $[ variables['containerImage'] ]
|
||||||
steps:
|
steps:
|
||||||
- script: swift test --parallel
|
- script: swift test --parallel
|
||||||
|
@ -84,9 +86,11 @@ jobs:
|
||||||
variables:
|
variables:
|
||||||
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
|
DEVELOPER_DIR: /Applications/Xcode_13.2.1.app
|
||||||
steps:
|
steps:
|
||||||
- script: swift run --sanitize=thread swiftlint lint --lenient
|
- script: swift build --configuration release --sanitize thread
|
||||||
|
displayName: Build SwiftLint
|
||||||
|
- script: swift run --configuration release --sanitize thread swiftlint lint --lenient
|
||||||
displayName: Pre-cache SwiftLint Run
|
displayName: Pre-cache SwiftLint Run
|
||||||
- script: swift run --sanitize=thread swiftlint lint --lenient
|
- script: swift run --configuration release --sanitize thread swiftlint lint --lenient
|
||||||
displayName: Post-cache SwiftLint Run
|
displayName: Post-cache SwiftLint Run
|
||||||
- script: make test_tsan
|
- script: make test_tsan
|
||||||
displayName: Test With TSan
|
displayName: Test With TSan
|
||||||
|
|
Loading…
Reference in New Issue