Skip to content

Commit

Permalink
Drop support for Swift 5.3 & 5.4. (#494)
Browse files Browse the repository at this point in the history
  • Loading branch information
ileitch authored May 8, 2022
1 parent 57b576f commit 6ff0426
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 81 deletions.
16 changes: 2 additions & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@ jobs:
strategy:
fail-fast: false
matrix:
xcode: ["13.3.1", "13.2.1", "13.1", "12.5.1", "12.4"]
xcode: ["13.3.1", "13.2.1"]
include:
- xcode: "13.3.1"
macos: macOS-12
- xcode: "13.2.1"
macos: macOS-11
- xcode: "13.1"
macos: macOS-11
- xcode: "12.5.1"
macos: macOS-11
- xcode: "12.4"
macos: macOS-11
runs-on: ${{ matrix.macos }}
name: macOS
steps:
Expand Down Expand Up @@ -61,20 +55,14 @@ jobs:
strategy:
fail-fast: false
matrix:
swift: ["5.6", "5.5", "5.4", "5.3"]
swift: ["5.6", "5.5"]
include:
- swift: "5.6"
container: "swift:5.6"
cache-version: 2
- swift: "5.5"
container: "swift:5.5"
cache-version: 2
- swift: "5.4"
container: "swift:5.4"
cache-version: 2
- swift: "5.3"
container: "swift:5.3"
cache-version: 2
runs-on: ubuntu-20.04
container: ${{ matrix.container }}
name: Linux
Expand Down
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@

##### Breaking

- None.
- Swift 5.5 or later is now required.

##### Enhancements

- Add support for Swift 5.6.
- Output is now line buffered when writing to a fifo/pipe.

##### Bug Fixes

- None.
- IBSegueAction annotated functions are now retained.

## 2.8.6 (2022-01-06)

Expand Down
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"repositoryURL": "https://github.com/apple/swift-argument-parser",
"state": {
"branch": null,
"revision": "e1465042f195f374b94f915ba8ca49de24300a0d",
"version": "1.0.2"
"revision": "f3c9084a71ef4376f2fabbdf1d3d90a49f1fabdb",
"version": "1.1.2"
}
},
{
Expand Down Expand Up @@ -69,17 +69,17 @@
"repositoryURL": "https://github.com/tuist/xcodeproj",
"state": {
"branch": null,
"revision": "aa2a42c7a744ca18b5918771fdd6cf40f9753db5",
"version": "8.6.0"
"revision": "c75c3acc25460195cfd203a04dde165395bf00e0",
"version": "8.7.1"
}
},
{
"package": "Yams",
"repositoryURL": "https://github.com/jpsim/Yams",
"state": {
"branch": null,
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa",
"version": "4.0.6"
"revision": "01835dc202670b5bb90d07f3eae41867e9ed29f6",
"version": "5.0.1"
}
}
]
Expand Down
8 changes: 2 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@ import PackageDescription
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50600.1-static")
#elseif compiler(>=5.5)
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50500.0-static")
#elseif compiler(>=5.4)
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50400.0")
#elseif compiler(>=5.3)
let swiftSyntaxVersion: Package.Dependency.Requirement = .exact("0.50300.0")
#else
fatalError("This version of Periphery does not support Swift <= 5.2.")
fatalError("This version of Periphery requires Swift >= 5.5.")
#endif

var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-system", from: "1.0.0"),
.package(url: "https://github.com/jpsim/Yams", from: "4.0.0"),
.package(url: "https://github.com/jpsim/Yams", from: "5.0.0"),
.package(url: "https://github.com/tadija/AEXML", from: "4.0.0"),
.package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"),
.package(name: "SwiftIndexStore", url: "https://github.com/kateinoigakukun/swift-indexstore", from: "0.0.0"),
Expand Down
5 changes: 1 addition & 4 deletions Sources/Frontend/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ final class Project {
let logger: Logger = inject()

logger.debug(SwiftVersion.current.fullVersion)

if SwiftVersion.current.version.isVersion(lessThanOrEqualTo: "5.2") {
throw PeripheryError.swiftVersionUnsupportedError(version: SwiftVersion.current.fullVersion)
}
try SwiftVersion.current.validateVersion()

switch kind {
case .xcode:
Expand Down
1 change: 0 additions & 1 deletion Sources/PeripheryKit/Analyzer/Analyzer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ public final class Analyzer {
EncodablePropertyRetainer.self,
StringInterpolationAppendInterpolationRetainer.self,
PropertyWrapperRetainer.self,
OptionalProtocolMemberRetainer.self,
ResultBuilderRetainer.self,

PlainExtensionEliminator.self,
Expand Down

This file was deleted.

7 changes: 1 addition & 6 deletions Sources/PeripheryKit/SPM/SPM.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,7 @@ public struct SPM {

func build(additionalArguments: [String]) throws {
let shell: Shell = inject()
var args: [String] = ["swift", "build", "--target", name] + additionalArguments

if SwiftVersion.current.version.isVersion(lessThan: "5.4") {
args.append("--enable-test-discovery")
}

let args: [String] = ["swift", "build", "--target", name] + additionalArguments
try shell.exec(args)
}
}
Expand Down
6 changes: 1 addition & 5 deletions Sources/PeripheryKit/SPM/SPMProjectDriver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ extension SPMProjectDriver: ProjectDriver {
// MARK: - Private

private func absolutePath(for target: SPM.Target) -> FilePath {
if SwiftVersion.current.version.isVersion(greaterThanOrEqualTo: "5.4") {
return FilePath(package.path).appending(target.path)
} else {
return FilePath(target.path)
}
FilePath(package.path).appending(target.path)
}
}
10 changes: 10 additions & 0 deletions Sources/PeripheryKit/SwiftVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import Shared
public struct SwiftVersion {
public static let current = Self()

static let minimumVersion = "5.5"

public let version: VersionString
public let fullVersion: String

Expand All @@ -12,4 +14,12 @@ public struct SwiftVersion {
self.fullVersion = try! shell.exec(["swift", "-version"]).trimmed
self.version = try! SwiftVersionParser.parse(fullVersion)
}

public func validateVersion() throws {
if Self.current.version.isVersion(lessThan: Self.minimumVersion) {
throw PeripheryError.swiftVersionUnsupportedError(
version: SwiftVersion.current.fullVersion,
minimumVersion: Self.minimumVersion)
}
}
}
6 changes: 3 additions & 3 deletions Sources/Shared/PeripheryError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public enum PeripheryError: Error, LocalizedError, CustomStringConvertible {
case foundIssues(count: Int)
case packageError(message: String)
case swiftVersionParseError(fullVersion: String)
case swiftVersionUnsupportedError(version: String)
case swiftVersionUnsupportedError(version: String, minimumVersion: String)
case unindexedTargetsError(targets: Set<String>, indexStorePath: String)
case jsonDeserializationError(error: Error, json: String)

Expand Down Expand Up @@ -61,8 +61,8 @@ public enum PeripheryError: Error, LocalizedError, CustomStringConvertible {
case let .unindexedTargetsError(targets, indexStorePath):
let joinedTargets = targets.sorted().joined(separator: ", ")
return "The index store at '\(indexStorePath)' does not contain data for the following targets: \(joinedTargets). Either the index store is outdated, or you have requested to scan targets that have not been built."
case let .swiftVersionUnsupportedError(version):
return "This version of Periphery only supports Swift >= 5.3, you're using \(version)."
case let .swiftVersionUnsupportedError(version, minimumVersion):
return "This version of Periphery only supports Swift >= \(minimumVersion), you're using \(version)."
case let .jsonDeserializationError(error, json):
return "JSON deserialization failed: \(describe(error))\nJSON:\n\(json)"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if swift(>=5.4)
import Foundation

@resultBuilder
Expand Down Expand Up @@ -41,4 +40,3 @@ public class FixtureClass130Retainer {
content()
}
}
#endif
2 changes: 0 additions & 2 deletions Tests/PeripheryTests/RetentionTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,6 @@ final class RetentionTest: SourceGraphTestCase {
}
}

#if swift(>=5.4)
func testRetainsResultBuilderMethods() {
analyze(retainPublic: true) {
assertReferenced(.class("FixtureClass130")) {
Expand All @@ -969,7 +968,6 @@ final class RetentionTest: SourceGraphTestCase {
}
}
}
#endif

func testRetainsCallAsFunction() {
analyze(retainPublic: true) {
Expand Down
3 changes: 0 additions & 3 deletions scripts/inject_swift_syntax_for_testing.sh

This file was deleted.

3 changes: 1 addition & 2 deletions scripts/release
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ rm -rf "$bin_path"
make build_release
rm -rf .release
mkdir .release
cp "$(xcode-select -p)/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx/lib_InternalSwiftSyntaxParser.dylib" .release
cp "$bin_path" .release/
cp LICENSE.md .release/
cp scripts/release_notes.md.template .release/release_notes.md
Expand All @@ -51,7 +50,7 @@ cp scripts/release_notes.md.template .release/release_notes.md
cd .release
codesign --force --options=runtime --sign "$signature" periphery
zip_filename="periphery-v${version}.zip"
zip "${zip_filename}" periphery LICENSE.md lib_InternalSwiftSyntaxParser.dylib
zip "${zip_filename}" periphery LICENSE.md
codesign --force --options=runtime --sign "$signature" "${zip_filename}"
xcrun altool --notarize-app --primary-bundle-id "${bundle_id}" --password "${password}" --file "${zip_filename}"

Expand Down

0 comments on commit 6ff0426

Please sign in to comment.