From 0f824e9c45d2019afa1d6637073439ca855123f0 Mon Sep 17 00:00:00 2001 From: Leo Dion Date: Tue, 22 Oct 2024 08:55:13 -0400 Subject: [PATCH] fixing build and test --- .devcontainer/swift-5.8/devcontainer.json | 39 +++++++++++++++++++ .devcontainer/swift-6.0/devcontainer.json | 39 +++++++++++++++++++ .periphery.yml | 2 +- Sources/FelinePine/Logger.swift | 9 +---- Tests/FelinePineTests/FelinePineTests.swift | 10 +++-- .../FelinePineTests/LoggingSystemTests.swift | 8 +++- Tests/FelinePineTests/Mocks/MockType.swift | 2 +- 7 files changed, 94 insertions(+), 15 deletions(-) create mode 100644 .devcontainer/swift-5.8/devcontainer.json create mode 100644 .devcontainer/swift-6.0/devcontainer.json diff --git a/.devcontainer/swift-5.8/devcontainer.json b/.devcontainer/swift-5.8/devcontainer.json new file mode 100644 index 0000000..378b867 --- /dev/null +++ b/.devcontainer/swift-5.8/devcontainer.json @@ -0,0 +1,39 @@ +{ + "name": "Swift", + "image": "swift:5.8", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "false", + "username": "vscode", + "upgradePackages": "false" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "os-provided", + "ppa": "false" + } + }, + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "lldb.library": "/usr/lib/liblldb.so" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "sswg.swift-lang" + ] + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "root" +} diff --git a/.devcontainer/swift-6.0/devcontainer.json b/.devcontainer/swift-6.0/devcontainer.json new file mode 100644 index 0000000..068475e --- /dev/null +++ b/.devcontainer/swift-6.0/devcontainer.json @@ -0,0 +1,39 @@ +{ + "name": "Swift", + "image": "swift:6.0", + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": "false", + "username": "vscode", + "upgradePackages": "false" + }, + "ghcr.io/devcontainers/features/git:1": { + "version": "os-provided", + "ppa": "false" + } + }, + "runArgs": [ + "--cap-add=SYS_PTRACE", + "--security-opt", + "seccomp=unconfined" + ], + // Configure tool-specific properties. + "customizations": { + // Configure properties specific to VS Code. + "vscode": { + // Set *default* container specific settings.json values on container create. + "settings": { + "lldb.library": "/usr/lib/liblldb.so" + }, + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "sswg.swift-lang" + ] + } + }, + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Set `remoteUser` to `root` to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. + "remoteUser": "vscode" +} diff --git a/.periphery.yml b/.periphery.yml index b04c730..031ece2 100644 --- a/.periphery.yml +++ b/.periphery.yml @@ -1,3 +1,3 @@ retain_public: true targets: -- FelinePineLogging +- FelinePine diff --git a/Sources/FelinePine/Logger.swift b/Sources/FelinePine/Logger.swift index ecd0866..2f99bdf 100644 --- a/Sources/FelinePine/Logger.swift +++ b/Sources/FelinePine/Logger.swift @@ -56,13 +56,6 @@ // OTHER DEALINGS IN THE SOFTWARE. // #if canImport(os) - - #if swift(<6.0) - import os - #else - public import os - #endif - - /// os.Logger + public import os public typealias Logger = os.Logger #endif diff --git a/Tests/FelinePineTests/FelinePineTests.swift b/Tests/FelinePineTests/FelinePineTests.swift index 1e19810..dfbfc48 100644 --- a/Tests/FelinePineTests/FelinePineTests.swift +++ b/Tests/FelinePineTests/FelinePineTests.swift @@ -31,8 +31,12 @@ import XCTest internal final class FelinePineTests: XCTestCase { - internal func testLogger() { - _ = MockType.logger - XCTAssert(true) + internal func testLogger() throws { + #if canImport(os) + _ = MockType.logger + XCTAssert(true) + #else + throw XCTSkip("OSLog not available") + #endif } } diff --git a/Tests/FelinePineTests/LoggingSystemTests.swift b/Tests/FelinePineTests/LoggingSystemTests.swift index b654a6e..9c7091e 100644 --- a/Tests/FelinePineTests/LoggingSystemTests.swift +++ b/Tests/FelinePineTests/LoggingSystemTests.swift @@ -44,9 +44,13 @@ internal final class LoggingSystemTests: XCTestCase { } } - internal func testLogger() { + internal func testLogger() throws { for category in MockSystem.Category.allCases { - _ = MockSystem.logger(forCategory: category) + #if canImport(os) + _ = MockSystem.logger(forCategory: category) + #else + throw XCTSkip("OSLog not available") + #endif } } } diff --git a/Tests/FelinePineTests/Mocks/MockType.swift b/Tests/FelinePineTests/Mocks/MockType.swift index 3379ad6..30e1a4a 100644 --- a/Tests/FelinePineTests/Mocks/MockType.swift +++ b/Tests/FelinePineTests/Mocks/MockType.swift @@ -30,7 +30,7 @@ @testable import FelinePine import XCTest -internal struct MockType: Feline, Pine { +internal struct MockType: Feline { internal typealias LoggingSystemType = MockSystem internal static let loggingCategory: MockSystem.Category = .alpha