Require Swift 5.3 or higher to build (#3553)

* Require Swift 5.3 or higher to build

* Remove Swift Version Support tables from readmes

These weren't exactly accurate because SwiftLint should still work with
older Swift versions long after we update the minimum version of Swift
needed to _build_ the tool. So I doubt this table was very helpful to
anyone.
This commit is contained in:
JP Simard 2021-03-04 13:07:04 -05:00 committed by GitHub
parent ca559c70df
commit 058869f446
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 74 deletions

View File

@ -2,7 +2,8 @@
#### Breaking #### Breaking
* None. * SwiftLint now requires Swift 5.3 or higher to build.
[JP Simard](https://github.com/jpsim)
#### Experimental #### Experimental

View File

@ -60,19 +60,7 @@ running it.
### Installing from source: ### Installing from source:
You can also build and install from source by cloning this project and running You can also build and install from source by cloning this project and running
`make install` (Xcode 11.4 or later). `make install` (Xcode 12 or later).
### Known Installation Issues On MacOS Before 10.14.4
Starting with [SwiftLint 0.32.0](https://github.com/realm/SwiftLint/releases/tag/0.32.0), if you get
an error similar to `dyld: Symbol not found: _$s11SubSequenceSlTl` when running SwiftLint,
you'll need to install the [Swift 5 Runtime Support for Command Line Tools](https://support.apple.com/kb/DL1998).
Alternatively, you can:
* Update to macOS 10.14.4 or later
* Install Xcode 11.4 or later at `/Applications/Xcode.app`
* Rebuild SwiftLint from source using Xcode 11.4 or later
## Usage ## Usage
@ -230,19 +218,6 @@ On Linux, SourceKit is expected to be located in
`/usr/lib/libsourcekitdInProc.so` or specified by the `LINUX_SOURCEKIT_LIB_PATH` `/usr/lib/libsourcekitdInProc.so` or specified by the `LINUX_SOURCEKIT_LIB_PATH`
environment variable. environment variable.
### Swift Version Support
Here's a reference of which SwiftLint version to use for a given Swift version.
| Swift version | Last supported SwiftLint release |
|:----------------|:---------------------------------|
| Swift 1.x | SwiftLint 0.1.2 |
| Swift 2.x | SwiftLint 0.18.1 |
| Swift 3.x | SwiftLint 0.25.1 |
| Swift 4.0-4.1.x | SwiftLint 0.28.2 |
| Swift 4.2.x | SwiftLint 0.35.0 |
| Swift 5.x | Latest |
## Rules ## Rules
Over 100 rules are included in SwiftLint and the Swift community (that's you!) Over 100 rules are included in SwiftLint and the Swift community (that's you!)

View File

@ -161,19 +161,6 @@ $ TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3 swiftlint autocorrect
在 Linux 上SourceKit 默认需要位于 `/usr/lib/libsourcekitdInProc.so` 或者通过 `LINUX_SOURCEKIT_LIB_PATH` 环境变量进行指定。 在 Linux 上SourceKit 默认需要位于 `/usr/lib/libsourcekitdInProc.so` 或者通过 `LINUX_SOURCEKIT_LIB_PATH` 环境变量进行指定。
### Swift Version Support
这里有一份 SwiftLint 版本和对应该 Swift 版本的对照表作为参考。
| Swift 版本 | 最后一个 SwiftLint 支持版本 |
|:----------------|:----------------------------|
| Swift 1.x | SwiftLint 0.1.2 |
| Swift 2.x | SwiftLint 0.18.1 |
| Swift 3.x | SwiftLint 0.25.1 |
| Swift 4.0-4.1.x | SwiftLint 0.28.2 |
| Swift 4.2.x | SwiftLint 0.35.0 |
| Swift 5.x | 最新的 |
## 规则 ## 规则
SwiftLint 已经包含了超过 75 条规则,并且我们希望 Swift 社区(就是你!)会在以后有更多的贡献,我们鼓励提交 [Pull Requests](CONTRIBUTING.md)。 SwiftLint 已经包含了超过 75 条规则,并且我们希望 Swift 社区(就是你!)会在以后有更多的贡献,我们鼓励提交 [Pull Requests](CONTRIBUTING.md)。

View File

@ -23,19 +23,3 @@ class CompilerProtocolInitRuleTests: XCTestCase {
) )
} }
} }
// https://bugs.swift.org/browse/SR-11501
#if SWIFT_PACKAGE && os(macOS) && compiler(<5.2)
private enum UnwrapError: Error {
case missingValue
}
private func XCTUnwrap<T>(_ expression: @autoclosure () throws -> T?,
_ message: @autoclosure () -> String = "") throws -> T {
if let value = try expression() {
return value
} else {
throw UnwrapError.missingValue
}
}
#endif

View File

@ -8,8 +8,6 @@ jobs:
strategy: strategy:
maxParallel: 10 maxParallel: 10
matrix: matrix:
swift52:
containerImage: swift:5.2
swift53: swift53:
containerImage: swift:5.3 containerImage: swift:5.3
container: $[ variables['containerImage'] ] container: $[ variables['containerImage'] ]
@ -23,14 +21,10 @@ jobs:
strategy: strategy:
maxParallel: 10 maxParallel: 10
matrix: matrix:
xcode114:
DEVELOPER_DIR: /Applications/Xcode_11.4.app
xcode115:
DEVELOPER_DIR: /Applications/Xcode_11.5.app
xcode116:
DEVELOPER_DIR: /Applications/Xcode_11.6.app
xcode12: xcode12:
DEVELOPER_DIR: /Applications/Xcode_12.app DEVELOPER_DIR: /Applications/Xcode_12.app
xcode124:
DEVELOPER_DIR: /Applications/Xcode_12.4.app
steps: steps:
- script: | - script: |
sw_vers sw_vers
@ -55,14 +49,10 @@ jobs:
strategy: strategy:
maxParallel: 10 maxParallel: 10
matrix: matrix:
xcode114:
DEVELOPER_DIR: /Applications/Xcode_11.4.app
xcode115:
DEVELOPER_DIR: /Applications/Xcode_11.5.app
xcode116:
DEVELOPER_DIR: /Applications/Xcode_11.6.app
xcode12: xcode12:
DEVELOPER_DIR: /Applications/Xcode_12.app DEVELOPER_DIR: /Applications/Xcode_12.app
xcode124:
DEVELOPER_DIR: /Applications/Xcode_12.4.app
steps: steps:
- script: | - script: |
sw_vers sw_vers
@ -77,7 +67,7 @@ jobs:
pool: pool:
vmImage: 'macOS-10.15' vmImage: 'macOS-10.15'
variables: variables:
DEVELOPER_DIR: /Applications/Xcode_12.app DEVELOPER_DIR: /Applications/Xcode_12.4.app
steps: steps:
- script: bundle install --path vendor/bundle - script: bundle install --path vendor/bundle
displayName: bundle install displayName: bundle install
@ -90,7 +80,7 @@ jobs:
pool: pool:
vmImage: 'macOS-10.15' vmImage: 'macOS-10.15'
variables: variables:
DEVELOPER_DIR: /Applications/Xcode_12.app DEVELOPER_DIR: /Applications/Xcode_12.4.app
steps: steps:
- script: make analyze - script: make analyze
displayName: Run SwiftLint Analyze displayName: Run SwiftLint Analyze
@ -99,7 +89,7 @@ jobs:
pool: pool:
vmImage: 'macOS-10.15' vmImage: 'macOS-10.15'
variables: variables:
DEVELOPER_DIR: /Applications/Xcode_12.app DEVELOPER_DIR: /Applications/Xcode_12.4.app
steps: steps:
- script: swift run --sanitize=thread swiftlint lint --lenient - script: swift run --sanitize=thread swiftlint lint --lenient
displayName: Pre-cache SwiftLint Run displayName: Pre-cache SwiftLint Run
@ -112,7 +102,7 @@ jobs:
pool: pool:
vmImage: 'macOS-10.15' vmImage: 'macOS-10.15'
variables: variables:
DEVELOPER_DIR: /Applications/Xcode_12.app DEVELOPER_DIR: /Applications/Xcode_12.4.app
steps: steps:
- script: swift run swiftlint generate-docs - script: swift run swiftlint generate-docs
displayName: Run swiftlint generate-docs displayName: Run swiftlint generate-docs