From a33fd12fa98121f2e624f07e841a3721b6c1f93c Mon Sep 17 00:00:00 2001 From: dankinsoid <30962149+dankinsoid@users.noreply.github.com> Date: Tue, 27 Aug 2024 17:32:02 +0400 Subject: [PATCH] 0.36.0 --- Package.swift | 10 +++--- Package@swift-5.9.swift | 4 ++- README.md | 2 +- Sources/VDStore/Utils/RuntimeWarnings.swift | 35 +++++++------------ .../TestMiddlware.swift | 1 + 5 files changed, 22 insertions(+), 30 deletions(-) rename Sources/{VDStore => VDStoreTestUtils}/TestMiddlware.swift (99%) diff --git a/Package.swift b/Package.swift index 846743b..40d7851 100644 --- a/Package.swift +++ b/Package.swift @@ -13,15 +13,13 @@ let package = Package( ], products: [ .library(name: "VDStore", targets: ["VDStore"]), + .library(name: "VDStoreTestUtils", targets: ["VDStoreTestUtils"]), ], dependencies: [ ], targets: [ - .target( - name: "VDStore", - dependencies: [ - ] - ), - .testTarget(name: "VDStoreTests", dependencies: ["VDStore"]), + .target(name: "VDStore", dependencies: []), + .target(name: "VDStoreTestUtils", dependencies: ["VDStore"]), + .testTarget(name: "VDStoreTests", dependencies: ["VDStoreTestUtils"]), ] ) diff --git a/Package@swift-5.9.swift b/Package@swift-5.9.swift index ff85ab0..27b1d2f 100644 --- a/Package@swift-5.9.swift +++ b/Package@swift-5.9.swift @@ -14,6 +14,7 @@ let package = Package( ], products: [ .library(name: "VDStore", targets: ["VDStore"]), + .library(name: "VDStoreTestUtils", targets: ["VDStoreTestUtils"]), ], dependencies: [ .package(url: "https://github.com/apple/swift-syntax.git", from: "509.0.2"), @@ -27,6 +28,7 @@ let package = Package( .product(name: "SwiftCompilerPlugin", package: "swift-syntax"), ] ), - .testTarget(name: "VDStoreTests", dependencies: ["VDStore"]), + .target(name: "VDStoreTestUtils", dependencies: ["VDStore"]), + .testTarget(name: "VDStoreTests", dependencies: ["VDStoreTestUtils"]), ] ) diff --git a/README.md b/README.md index 7bf544b..ee9d972 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ import PackageDescription let package = Package( name: "SomeProject", dependencies: [ - .package(url: "https://github.com/dankinsoid/VDStore.git", from: "0.35.0") + .package(url: "https://github.com/dankinsoid/VDStore.git", from: "0.36.0") ], targets: [ .target(name: "SomeProject", dependencies: ["VDStore"]) diff --git a/Sources/VDStore/Utils/RuntimeWarnings.swift b/Sources/VDStore/Utils/RuntimeWarnings.swift index 6efd859..9a623f6 100644 --- a/Sources/VDStore/Utils/RuntimeWarnings.swift +++ b/Sources/VDStore/Utils/RuntimeWarnings.swift @@ -7,33 +7,24 @@ func runtimeWarn( _ message: @autoclosure () -> String, category: String? = "VDStore" ) { - #if DEBUG +#if DEBUG let message = message() let category = category ?? "Runtime Warning" - if _XCTIsTesting { - #if canImport(XCTest) - XCTFail(message) - #endif - } else { - #if canImport(os) - os_log( - .fault, - dso: dso, - log: OSLog(subsystem: "com.apple.runtime-issues", category: category), - "%@", - message - ) - #else - fputs("\(formatter.string(from: Date())) [\(category)] \(message)\n", stderr) - #endif - } - #endif +#if canImport(os) + os_log( + .fault, + dso: dso, + log: OSLog(subsystem: "com.apple.runtime-issues", category: category), + "%@", + message + ) +#else + fputs("\(formatter.string(from: Date())) [\(category)] \(message)\n", stderr) +#endif +#endif } #if DEBUG -#if canImport(XCTest) -import XCTest -#endif #if canImport(os) import os diff --git a/Sources/VDStore/TestMiddlware.swift b/Sources/VDStoreTestUtils/TestMiddlware.swift similarity index 99% rename from Sources/VDStore/TestMiddlware.swift rename to Sources/VDStoreTestUtils/TestMiddlware.swift index 1e78a08..258c479 100644 --- a/Sources/VDStore/TestMiddlware.swift +++ b/Sources/VDStoreTestUtils/TestMiddlware.swift @@ -1,6 +1,7 @@ #if canImport(XCTest) import Foundation import XCTest +@_exported import VDStore public final class TestMiddleware: StoreMiddleware {