diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 0b5e5e7..606b746 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -20,7 +20,7 @@ jobs: uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-generate-and-publish-docs.yml@main with: os: ubuntu - swift-version: '5.9' + swift-version: '5.10' organisation: ${{ github.repository_owner }} repository: ${{ github.event.repository.name }} pages-branch: gh-pages diff --git a/.github/workflows/swift-test.yml b/.github/workflows/swift-test.yml index 8c639b8..bd4118f 100644 --- a/.github/workflows/swift-test.yml +++ b/.github/workflows/swift-test.yml @@ -12,7 +12,7 @@ permissions: jobs: variables: outputs: - max-supported-swift-version: '5.9' + max-supported-swift-version: '5.10' xcode-scheme: path-wrangler-Package xcode-platform-version: latest fail-if-codecov-fails: true @@ -25,7 +25,7 @@ jobs: strategy: matrix: os: [ macOS, ubuntu ] - swift-version-offset: [ 0 ] + swift-version-offset: [ 0, 1 ] uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-spm.yml@main with: os: ${{ matrix.os }} @@ -45,7 +45,8 @@ jobs: - iPadOS - tvOS - watchOS - swift-version-offset: [ 0 ] + - visionOS + swift-version-offset: [ 0, 1 ] uses: sersoft-gmbh/oss-common-actions/.github/workflows/swift-test-xcode.yml@main with: xcode-scheme: ${{ needs.variables.outputs.xcode-scheme }} diff --git a/Package.swift b/Package.swift index 8d600bd..38e8512 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.9 +// swift-tools-version:5.10 // The swift-tools-version declares the minimum version of Swift required to build this package. import PackageDescription @@ -8,9 +8,12 @@ let swiftSettings: Array = [ .enableUpcomingFeature("ExistentialAny"), .enableUpcomingFeature("BareSlashRegexLiterals"), .enableUpcomingFeature("DisableOutwardActorInference"), + .enableUpcomingFeature("IsolatedDefaultValues"), + .enableUpcomingFeature("DeprecateApplicationMain"), + .enableExperimentalFeature("StrictConcurrency"), + .enableExperimentalFeature("GlobalConcurrency"), // .enableExperimentalFeature("AccessLevelOnImport"), // .enableExperimentalFeature("VariadicGenerics"), -// .unsafeFlags(["-warn-concurrency"], .when(configuration: .debug)), ] let package = Package( diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift new file mode 100644 index 0000000..f427576 --- /dev/null +++ b/Package@swift-5.9.swift @@ -0,0 +1,55 @@ +// swift-tools-version:5.9 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let swiftSettings: Array = [ + .enableUpcomingFeature("ConciseMagicFile"), + .enableUpcomingFeature("ExistentialAny"), + .enableUpcomingFeature("BareSlashRegexLiterals"), + .enableUpcomingFeature("DisableOutwardActorInference"), + .enableExperimentalFeature("StrictConcurrency"), +// .enableExperimentalFeature("AccessLevelOnImport"), +// .enableExperimentalFeature("VariadicGenerics"), +] + +let package = Package( + name: "path-wrangler", + products: [ + // Products define the executables and libraries produced by a package, and make them visible to other packages. + .library( + name: "CorePathWrangler", + targets: ["CorePathWrangler"]), + .library( + name: "PathWrangler", + targets: ["PathWrangler"]), + ], + dependencies: [ + .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"), + .package(url: "https://github.com/apple/swift-algorithms", from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages which this package depends on. + .target(name: "CPathWrangler"), + .target( + name: "CorePathWrangler", + dependencies: [ + .product(name: "Algorithms", package: "swift-algorithms"), + "CPathWrangler", + ], + swiftSettings: swiftSettings), + .target( + name: "PathWrangler", + dependencies: ["CorePathWrangler"], + swiftSettings: swiftSettings), + .testTarget( + name: "CorePathWranglerTests", + dependencies: ["CorePathWrangler"], + swiftSettings: swiftSettings), + .testTarget( + name: "PathWranglerTests", + dependencies: ["PathWrangler"], + swiftSettings: swiftSettings), + ] +) diff --git a/Tests/PathWranglerTests/FileManager+PathProtocolTests.swift b/Tests/PathWranglerTests/FileManager+PathProtocolTests.swift index 73d64b7..e9d6b4e 100644 --- a/Tests/PathWranglerTests/FileManager+PathProtocolTests.swift +++ b/Tests/PathWranglerTests/FileManager+PathProtocolTests.swift @@ -2,15 +2,15 @@ import XCTest import PathWrangler final class FileManagerPathProtocolExtensionsTests: XCTestCase { - private func createFiles(in fileManager: FileManager) -> (absPath: AbsolutePath, relPath: RelativePath) { + private func createFiles() -> (absPath: AbsolutePath, relPath: RelativePath) { let fileName = UUID().uuidString let absPath = AbsolutePath.tmpDir.appending(pathComponents: fileName) let relPath = RelativePath.current.appending(pathComponents: fileName) - fileManager.createFile(atPath: relPath.pathString, contents: nil, attributes: nil) - fileManager.createFile(atPath: absPath.pathString, contents: nil, attributes: nil) + FileManager.default.createFile(atPath: relPath.pathString, contents: nil, attributes: nil) + FileManager.default.createFile(atPath: absPath.pathString, contents: nil, attributes: nil) addTeardownBlock { - try? fileManager.removeItem(atPath: relPath.pathString) - try? fileManager.removeItem(atPath: absPath.pathString) + try? FileManager.default.removeItem(atPath: relPath.pathString) + try? FileManager.default.removeItem(atPath: absPath.pathString) } return (absPath, relPath) } @@ -24,24 +24,22 @@ final class FileManagerPathProtocolExtensionsTests: XCTestCase { } func testFileExistsAtPath() { - let fileManager = FileManager.default - let (absPath, relPath) = createFiles(in: fileManager) - XCTAssertTrue(fileManager.fileExists(at: absPath)) - XCTAssertTrue(fileManager.fileExists(at: relPath)) - XCTAssertFalse(fileManager.fileExists(at: AbsolutePath.tmpDir)) - XCTAssertFalse(fileManager.fileExists(at: RelativePath.current)) - XCTAssertFalse(fileManager.fileExists(at: AbsolutePath(pathString: "/d/e/f/"))) - XCTAssertFalse(fileManager.fileExists(at: RelativePath(pathString: "d/e/f"))) + let (absPath, relPath) = createFiles() + XCTAssertTrue(FileManager.default.fileExists(at: absPath)) + XCTAssertTrue(FileManager.default.fileExists(at: relPath)) + XCTAssertFalse(FileManager.default.fileExists(at: AbsolutePath.tmpDir)) + XCTAssertFalse(FileManager.default.fileExists(at: RelativePath.current)) + XCTAssertFalse(FileManager.default.fileExists(at: AbsolutePath(pathString: "/d/e/f/"))) + XCTAssertFalse(FileManager.default.fileExists(at: RelativePath(pathString: "d/e/f"))) } func testDirectoryExistsAtPath() { - let fileManager = FileManager.default - let (absPath, relPath) = createFiles(in: fileManager) - XCTAssertFalse(fileManager.directoryExists(at: absPath)) - XCTAssertFalse(fileManager.directoryExists(at: relPath)) - XCTAssertTrue(fileManager.directoryExists(at: AbsolutePath.tmpDir)) - XCTAssertTrue(fileManager.directoryExists(at: RelativePath.current)) - XCTAssertFalse(fileManager.directoryExists(at: AbsolutePath(pathString: "/g/h/i/"))) - XCTAssertFalse(fileManager.directoryExists(at: RelativePath(pathString: "g/h/i"))) + let (absPath, relPath) = createFiles() + XCTAssertFalse(FileManager.default.directoryExists(at: absPath)) + XCTAssertFalse(FileManager.default.directoryExists(at: relPath)) + XCTAssertTrue(FileManager.default.directoryExists(at: AbsolutePath.tmpDir)) + XCTAssertTrue(FileManager.default.directoryExists(at: RelativePath.current)) + XCTAssertFalse(FileManager.default.directoryExists(at: AbsolutePath(pathString: "/g/h/i/"))) + XCTAssertFalse(FileManager.default.directoryExists(at: RelativePath(pathString: "g/h/i"))) } }