From ae16dbfc2fef2d7fc07f317fab2145a782c973c4 Mon Sep 17 00:00:00 2001 From: giginet Date: Tue, 28 May 2024 19:26:41 +0900 Subject: [PATCH 1/5] Drop 5.8 support --- .github/workflows/tests.yml | 2 +- Package@swift-5.8.swift | 77 ------------------- .../PIF/BuildParametersGenerator.swift | 2 - .../ScipioKit/Producer/PIF/PIFCompiler.swift | 12 +-- .../Producer/PIF/ToolchainGenerator.swift | 2 - 5 files changed, 2 insertions(+), 93 deletions(-) delete mode 100644 Package@swift-5.8.swift diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 02ae52eb..05ab44c3 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: xcode_version: ["15.3"] - swift: ["5.8.1", "5.9.2", "5.10.0"] + swift: ["5.9.2", "5.10.0"] env: DEVELOPER_DIR: "/Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer" runs-on: macos-14 diff --git a/Package@swift-5.8.swift b/Package@swift-5.8.swift deleted file mode 100644 index 730ee5c5..00000000 --- a/Package@swift-5.8.swift +++ /dev/null @@ -1,77 +0,0 @@ -// swift-tools-version: 5.8 -// The swift-tools-version declares the minimum version of Swift required to build this package. - -import PackageDescription -import Foundation - -let package = Package( - name: "Scipio", - platforms: [ - .macOS(.v13), - ], - products: [ - .executable(name: "scipio", - targets: ["scipio"]), - .library( - name: "ScipioKit", - targets: ["ScipioKit"]), - ], - dependencies: [ - .package(url: "https://github.com/giginet/swift-package-manager.git", - revision: "99575e7a3eb8e66112ec45e2f11ef23a1828b110"), - .package(url: "https://github.com/apple/swift-log.git", - .upToNextMinor(from: "1.4.2")), - .package(url: "https://github.com/apple/swift-collections", - from: "1.0.4"), - .package(url: "https://github.com/apple/swift-argument-parser.git", - from: "1.1.0"), - .package(url: "https://github.com/apple/swift-algorithms.git", - from: "1.0.0"), - .package(url: "https://github.com/onevcat/Rainbow", - .upToNextMinor(from: "4.0.1")), - .package(url: "https://github.com/giginet/scipio-cache-storage.git", - from: "1.0.0"), - ], - targets: [ - .executableTarget(name: "scipio", - dependencies: [ - .target(name: "ScipioKit"), - .product(name: "ArgumentParser", package: "swift-argument-parser"), - ]), - .target( - name: "ScipioKit", - dependencies: [ - .product(name: "SwiftPMDataModel-auto", package: "swift-package-manager"), - .product(name: "XCBuildSupport", package: "swift-package-manager"), - .product(name: "Logging", package: "swift-log"), - .product(name: "Collections", package: "swift-collections"), - .product(name: "Algorithms", package: "swift-algorithms"), - .product(name: "Rainbow", package: "Rainbow"), - .product(name: "ScipioStorage", package: "scipio-cache-storage"), - ], - plugins: [ - .plugin(name: "GenerateScipioVersion") - ] - ), - .plugin( - name: "GenerateScipioVersion", - capability: .buildTool() - ), - .testTarget( - name: "ScipioKitTests", - dependencies: [ - .target(name: "ScipioKit"), - ], - exclude: ["Resources/Fixtures/"], - resources: [.copy("Resources/Fixtures")]), - ] -) - -let isDevelopment = ProcessInfo.processInfo.environment["SCIPIO_DEVELOPMENT"] == "1" - -// swift-docs is not needed for package users -if isDevelopment { - package.dependencies += [ - .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.3.0"), - ] -} diff --git a/Sources/ScipioKit/Producer/PIF/BuildParametersGenerator.swift b/Sources/ScipioKit/Producer/PIF/BuildParametersGenerator.swift index a4d5e018..042e89d3 100644 --- a/Sources/ScipioKit/Producer/PIF/BuildParametersGenerator.swift +++ b/Sources/ScipioKit/Producer/PIF/BuildParametersGenerator.swift @@ -40,8 +40,6 @@ struct BuildParametersGenerator { let targetArchitecture = buildParameters.targetTriple.arch?.rawValue ?? "arm64" #elseif swift(>=5.9) let targetArchitecture = buildParameters.triple.arch?.rawValue ?? "arm64" - #else - let targetArchitecture = buildParameters.triple.arch.rawValue #endif // Generate the run destination parameters. diff --git a/Sources/ScipioKit/Producer/PIF/PIFCompiler.swift b/Sources/ScipioKit/Producer/PIF/PIFCompiler.swift index 3e0aa618..0fe88404 100644 --- a/Sources/ScipioKit/Producer/PIF/PIFCompiler.swift +++ b/Sources/ScipioKit/Producer/PIF/PIFCompiler.swift @@ -124,7 +124,7 @@ struct PIFCompiler: Compiler { isXcodeBuildSystemEnabled: true, driverParameters: BuildParameters.Driver(enableParseableModuleInterfaces: buildOptions.enableLibraryEvolution) ) - #elseif swift(>=5.9) + #else try .init( dataPath: descriptionPackage.buildDirectory.spmAbsolutePath, configuration: buildOptions.buildConfiguration.spmConfiguration, @@ -134,16 +134,6 @@ struct PIFCompiler: Compiler { enableParseableModuleInterfaces: buildOptions.enableLibraryEvolution, isXcodeBuildSystemEnabled: true ) - #else - .init( - dataPath: descriptionPackage.buildDirectory, - configuration: buildOptions.buildConfiguration.spmConfiguration, - toolchain: toolchain, - destinationTriple: toolchain.triple, - flags: .init(), - enableParseableModuleInterfaces: buildOptions.enableLibraryEvolution, - isXcodeBuildSystemEnabled: true - ) #endif } } diff --git a/Sources/ScipioKit/Producer/PIF/ToolchainGenerator.swift b/Sources/ScipioKit/Producer/PIF/ToolchainGenerator.swift index c6accbab..1889d451 100644 --- a/Sources/ScipioKit/Producer/PIF/ToolchainGenerator.swift +++ b/Sources/ScipioKit/Producer/PIF/ToolchainGenerator.swift @@ -2,9 +2,7 @@ import Foundation import TSCUtility import PackageModel import TSCBasic -#if swift(>=5.9) import struct Basics.Triple -#endif struct ToolchainGenerator { private let toolchainDirPath: AbsolutePath From 97506bfce6f4d8fb5bc94ae6bf0c722eca8065de Mon Sep 17 00:00:00 2001 From: giginet Date: Tue, 28 May 2024 19:07:39 +0900 Subject: [PATCH 2/5] Fix all latest SwiftLint violations --- Sources/ScipioKit/Executor.swift | 4 ++-- Tests/ScipioKitTests/CacheSystemTests.swift | 2 +- Tests/ScipioKitTests/RunnerTests.swift | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Sources/ScipioKit/Executor.swift b/Sources/ScipioKit/Executor.swift index ccff2826..1a1cde07 100644 --- a/Sources/ScipioKit/Executor.swift +++ b/Sources/ScipioKit/Executor.swift @@ -145,7 +145,7 @@ extension ExecutorResult { func unwrapOutput() throws -> String { switch output { case .success(let data): - return String(data: Data(data), encoding: .utf8)! + return String(decoding: Data(data), as: UTF8.self) case .failure(let error): throw error } @@ -154,7 +154,7 @@ extension ExecutorResult { func unwrapStdErrOutput() throws -> String { switch stderrOutput { case .success(let data): - return String(data: Data(data), encoding: .utf8)! + return String(decoding: Data(data), as: UTF8.self) case .failure(let error): throw error } diff --git a/Tests/ScipioKitTests/CacheSystemTests.swift b/Tests/ScipioKitTests/CacheSystemTests.swift index 31faa6ca..66eeca6e 100644 --- a/Tests/ScipioKitTests/CacheSystemTests.swift +++ b/Tests/ScipioKitTests/CacheSystemTests.swift @@ -36,7 +36,7 @@ InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault let encoder = JSONEncoder() encoder.outputFormatting = [.sortedKeys, .prettyPrinted] let data = try encoder.encode(cacheKey) - let rawString = try XCTUnwrap(String(data: data, encoding: .utf8)) + let rawString = try XCTUnwrap(String(decoding: data, as: UTF8.self)) let expected = """ { "buildOptions" : { diff --git a/Tests/ScipioKitTests/RunnerTests.swift b/Tests/ScipioKitTests/RunnerTests.swift index 650d1ea6..4d6d5786 100644 --- a/Tests/ScipioKitTests/RunnerTests.swift +++ b/Tests/ScipioKitTests/RunnerTests.swift @@ -34,7 +34,7 @@ final class RunnerTests: XCTestCase { private let plistDecoder: PropertyListDecoder = .init() - override class func setUp() { + override static func setUp() { LoggingSystem.bootstrap { _ in SwiftLogNoOpLogHandler() } super.setUp() @@ -136,7 +136,7 @@ final class RunnerTests: XCTestCase { fileManager.fileExists(atPath: moduleMapPath), "Should exist a modulemap" ) - let moduleMapContents = try XCTUnwrap(fileManager.contents(atPath: moduleMapPath).flatMap { String(data: $0, encoding: .utf8) }) + let moduleMapContents = try XCTUnwrap(fileManager.contents(atPath: moduleMapPath).flatMap { String(decoding: $0, as: .UTF8.self) }) XCTAssertEqual( moduleMapContents, """ @@ -186,7 +186,7 @@ final class RunnerTests: XCTestCase { fileManager.fileExists(atPath: moduleMapPath), "Should exist a modulemap" ) - let moduleMapContents = try XCTUnwrap(fileManager.contents(atPath: moduleMapPath).flatMap { String(data: $0, encoding: .utf8) }) + let moduleMapContents = try XCTUnwrap(fileManager.contents(atPath: moduleMapPath).flatMap { String(decoding: $0, as: UTF8.self) }) XCTAssertEqual( moduleMapContents, """ @@ -630,7 +630,7 @@ final class RunnerTests: XCTestCase { XCTAssertTrue(fileManager.fileExists(atPath: moduleMapPath.path)) let generatedModuleMapData = try XCTUnwrap(fileManager.contents(atPath: moduleMapPath.path)) - let generatedModuleMapContents = String(data: generatedModuleMapData, encoding: .utf8) + let generatedModuleMapContents = String(decoding: generatedModuleMapData, as: UTF8.self) let expectedModuleMap = """ framework module MyTarget { From 226237c54aab0c8ca3f62f965565dd3aa74e58be Mon Sep 17 00:00:00 2001 From: giginet Date: Tue, 28 May 2024 19:12:15 +0900 Subject: [PATCH 3/5] Fix build --- Tests/ScipioKitTests/RunnerTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/ScipioKitTests/RunnerTests.swift b/Tests/ScipioKitTests/RunnerTests.swift index 4d6d5786..4454e548 100644 --- a/Tests/ScipioKitTests/RunnerTests.swift +++ b/Tests/ScipioKitTests/RunnerTests.swift @@ -136,7 +136,7 @@ final class RunnerTests: XCTestCase { fileManager.fileExists(atPath: moduleMapPath), "Should exist a modulemap" ) - let moduleMapContents = try XCTUnwrap(fileManager.contents(atPath: moduleMapPath).flatMap { String(decoding: $0, as: .UTF8.self) }) + let moduleMapContents = try XCTUnwrap(fileManager.contents(atPath: moduleMapPath).flatMap { String(decoding: $0, as: UTF8.self) }) XCTAssertEqual( moduleMapContents, """ From de53252090c1357157703cf944c6bc0e254997d9 Mon Sep 17 00:00:00 2001 From: giginet Date: Wed, 29 May 2024 01:05:45 +0900 Subject: [PATCH 4/5] Remove 5.8 badge --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index cab1b23b..411b5af8 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,8 @@ ![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/giginet/Scipio/tests.yml?style=flat-square&logo=github) ![Swift 5.10](https://img.shields.io/badge/Swift-5.10-FA7343?logo=swift&style=flat-square) ![Swift 5.9](https://img.shields.io/badge/Swift-5.9-FA7343?logo=swift&style=flat-square) -![Swift 5.8](https://img.shields.io/badge/Swift-5.8-FA7343?logo=swift&style=flat-square) [![Xcode 15.3](https://img.shields.io/badge/Xcode-15.3-147EFB?style=flat-square&logo=xcode&link=https%3A%2F%2Fdeveloper.apple.com%2Fxcode%2F)](https://developer.apple.com/xcode/) [![Xcode 15.2](https://img.shields.io/badge/Xcode-15.2-147EFB?style=flat-square&logo=xcode&link=https%3A%2F%2Fdeveloper.apple.com%2Fxcode%2F)](https://developer.apple.com/xcode/) -[![Xcode 14.3](https://img.shields.io/badge/Xcode-14.3-147EFB?style=flat-square&logo=xcode&link=https%3A%2F%2Fdeveloper.apple.com%2Fxcode%2F)](https://developer.apple.com/xcode/) [![SwiftPM](https://img.shields.io/badge/SwiftPM-compatible-green?logo=swift&style=flat-square)](https://swift.org/package-manager/) [![Documentation](https://img.shields.io/badge/Documentation-available-green?style=flat-square)](https://giginet.github.io/Scipio/documentation/scipio/) ![Platforms](https://img.shields.io/badge/Platform-iOS%7CmacOS%7CwatchOS%7CtvOS%7CvisionOS-lightgray?logo=apple&style=flat-square) From 556d782fa264a4d70a081f3c3a1d88afb7a05d25 Mon Sep 17 00:00:00 2001 From: giginet Date: Wed, 29 May 2024 01:06:25 +0900 Subject: [PATCH 5/5] Remove 5.8 from README --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 411b5af8..591c611a 100644 --- a/README.md +++ b/README.md @@ -134,15 +134,12 @@ See [Convert Single Swift Package to XCFramework](https://giginet.github.io/Scip ## Supported Xcode and Swift version -Currently, we support Swift 5.8, 5.9, and 5.10. - -Swift 5.8 support will be dropped in the future. +Currently, we support Swift 5.9, and 5.10. | | Xcode | Swift | |----|------------|-------| | ✅ | 15.3 | 5.10 | | ✅ | 15.0<=15.2 | 5.9 | -| ✅ | 14.3 | 5.8 | ## Reliability