Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 6.0
// swift-tools-version: 6.3

import CompilerPluginSupport
import PackageDescription
Expand All @@ -25,6 +25,14 @@ let package = Package(
targets: ["DependenciesTestSupport"]
),
],
traits: [
"Clocks",
"CombineSchedulers",
"Foundation",
.default(enabledTraits: [
"Clocks", "CombineSchedulers", "Foundation"
])
],
dependencies: [
.package(url: "https://github.com/pointfreeco/combine-schedulers", from: "1.0.2"),
.package(url: "https://github.com/pointfreeco/swift-clocks", from: "1.0.4"),
Expand All @@ -42,9 +50,21 @@ let package = Package(
.target(
name: "Dependencies",
dependencies: [
.product(name: "Clocks", package: "swift-clocks"),
.product(name: "CombineSchedulers", package: "combine-schedulers"),
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(
name: "Clocks",
package: "swift-clocks",
condition: .when(traits: ["Clocks"])
),
.product(
name: "CombineSchedulers",
package: "combine-schedulers",
condition: .when(traits: ["CombineSchedulers"])
),
.product(
name: "ConcurrencyExtras",
package: "swift-concurrency-extras",
condition: .when(traits: ["Foundation"])
),
.product(name: "IssueReporting", package: "xctest-dynamic-overlay"),
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
]
Expand Down
5 changes: 5 additions & 0 deletions Package@swift-5.9.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ let package = Package(
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(name: "IssueReporting", package: "xctest-dynamic-overlay"),
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
],
swiftSettings: [
.define("Clocks"),
.define("CombineSchedulers"),
.define("Foundation"),
]
),
.testTarget(
Expand Down
125 changes: 125 additions & 0 deletions Package@swift-6.0.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// swift-tools-version: 6.0

import CompilerPluginSupport
import PackageDescription

let package = Package(
name: "swift-dependencies",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6),
],
products: [
.library(
name: "Dependencies",
targets: ["Dependencies"]
),
.library(
name: "DependenciesMacros",
targets: ["DependenciesMacros"]
),
.library(
name: "DependenciesTestSupport",
targets: ["DependenciesTestSupport"]
),
],
dependencies: [
.package(url: "https://github.com/pointfreeco/combine-schedulers", from: "1.0.2"),
.package(url: "https://github.com/pointfreeco/swift-clocks", from: "1.0.4"),
.package(url: "https://github.com/pointfreeco/swift-concurrency-extras", from: "1.0.0"),
.package(url: "https://github.com/pointfreeco/xctest-dynamic-overlay", from: "1.4.0"),
.package(url: "https://github.com/swiftlang/swift-syntax", "509.0.0"..<"603.0.0"),
],
targets: [
.target(
name: "DependenciesTestObserver",
dependencies: [
.product(name: "IssueReporting", package: "xctest-dynamic-overlay")
]
),
.target(
name: "Dependencies",
dependencies: [
.product(name: "Clocks", package: "swift-clocks"),
.product(name: "CombineSchedulers", package: "combine-schedulers"),
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(name: "IssueReporting", package: "xctest-dynamic-overlay"),
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
],
swiftSettings: [
.define("Clocks"),
.define("CombineSchedulers"),
.define("Foundation"),
]
),
.target(
name: "DependenciesTestSupport",
dependencies: [
"Dependencies",
.product(name: "ConcurrencyExtras", package: "swift-concurrency-extras"),
.product(name: "IssueReportingTestSupport", package: "xctest-dynamic-overlay"),
]
),
.testTarget(
name: "DependenciesTests",
dependencies: [
"Dependencies",
"DependenciesTestSupport",
.product(name: "IssueReportingTestSupport", package: "xctest-dynamic-overlay"),
],
exclude: ["Dependencies.xctestplan"]
),
.target(
name: "DependenciesMacros",
dependencies: [
"DependenciesMacrosPlugin",
.product(name: "IssueReporting", package: "xctest-dynamic-overlay"),
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay"),
]
),
.macro(
name: "DependenciesMacrosPlugin",
dependencies: [
.product(name: "SwiftSyntaxMacros", package: "swift-syntax"),
.product(name: "SwiftCompilerPlugin", package: "swift-syntax"),
]
),
],
swiftLanguageModes: [.v6]
)

#if !os(macOS) && !os(WASI)
package.products.append(
.library(
name: "DependenciesTestObserver",
type: .dynamic,
targets: ["DependenciesTestObserver"]
)
)
#endif

#if !os(WASI)
package.dependencies.append(
.package(url: "https://github.com/pointfreeco/swift-macro-testing", from: "0.2.0")
)
package.targets.append(contentsOf: [
.testTarget(
name: "DependenciesMacrosPluginTests",
dependencies: [
"Dependencies",
"DependenciesMacros",
"DependenciesMacrosPlugin",
.product(name: "MacroTesting", package: "swift-macro-testing"),
]
)
])
#endif

#if !os(Windows)
// Add the documentation compiler plugin if possible
package.dependencies.append(
.package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0")
)
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/Calendar.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Foundation
import Foundation

extension DependencyValues {
Expand Down Expand Up @@ -43,3 +44,4 @@ extension DependencyValues {
#endif
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/Clocks.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Clocks
#if (canImport(RegexBuilder) || !os(macOS) && !targetEnvironment(macCatalyst))
@available(iOS 16, macOS 13, tvOS 16, watchOS 9, *)
extension DependencyValues {
Expand Down Expand Up @@ -78,3 +79,4 @@
}
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/Date.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Foundation
import Foundation

extension DependencyValues {
Expand Down Expand Up @@ -73,3 +74,4 @@ public struct DateGenerator: Sendable {
self.generate()
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/Locale.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Foundation
import Foundation

extension DependencyValues {
Expand Down Expand Up @@ -56,3 +57,4 @@ extension DependencyValues {
#endif
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/MainQueue.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if CombineSchedulers
#if canImport(Combine)
import Foundation

Expand Down Expand Up @@ -62,3 +63,4 @@
}
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/MainRunLoop.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if CombineSchedulers
#if canImport(Combine)
import Foundation

Expand Down Expand Up @@ -61,3 +62,4 @@
}
}
#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Foundation
#if canImport(Foundation)
import Foundation

Expand Down Expand Up @@ -29,3 +30,4 @@
}
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/TimeZone.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Foundation
import Foundation

extension DependencyValues {
Expand Down Expand Up @@ -42,3 +43,4 @@ extension DependencyValues {
#endif
}
}
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/URLSession.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Foundation
#if !os(WASI)
import Foundation

Expand Down Expand Up @@ -113,3 +114,4 @@
}
}
#endif
#endif
2 changes: 2 additions & 0 deletions Sources/Dependencies/DependencyValues/UUID.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if Foundation
import Foundation

extension DependencyValues {
Expand Down Expand Up @@ -147,3 +148,4 @@ private struct IncrementingUUIDGenerator: Sendable {
}
}
}
#endif
6 changes: 6 additions & 0 deletions Sources/Dependencies/Internal/Exports.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#if Clocks
@_exported import Clocks
#endif
#if CombineSchedulers
@_exported import CombineSchedulers
#endif
#if Foundation
@_exported import ConcurrencyExtras
#endif
@_exported import IssueReporting
@_exported import XCTestDynamicOverlay
Loading