Files
swift-service-lifecycle/Package.swift
T
卓林and赖卓林 0c3343fa54 Default ServiceGroup logger to Logger.current (#252)
Fixes #251

## Summary
- Raise the minimum swift-log dependency to 1.14.0, which provides the
task-local Logger.current API.
- Default ServiceGroup's logger parameter to Logger.current so callers
can inherit the current task-local logger.
- Add a regression test that constructs and runs ServiceGroup without an
explicit logger.

## Design
The change is limited to the current ServiceGroup convenience
initializer. Existing explicit logger calls and
ServiceGroupConfiguration initializers remain unchanged.

## Validation
- Focused test passed: swift test --disable-sandbox --filter
ServiceGroupTests/testRun_withDefaultLogger
- Full test suite passed: swift test --disable-sandbox
- Result: 62 ServiceLifecycle/XCTest tests and all Swift Testing suites
passed.
- git diff --check passed.

Tests used the Xcode 27 beta developer toolchain because the active
Command Line Tools installation does not provide XCTest.

Co-authored-by: 赖卓林 <zhuolin@laizhuolindeMac-mini.local>
2026-08-09 17:14:46 +02:00

86 lines
2.3 KiB
Swift

// swift-tools-version:6.1
import PackageDescription
let package = Package(
name: "swift-service-lifecycle",
products: [
.library(
name: "ServiceLifecycle",
targets: ["ServiceLifecycle"]
),
.library(
name: "ServiceLifecycleTestKit",
targets: ["ServiceLifecycleTestKit"]
),
.library(
name: "UnixSignals",
targets: ["UnixSignals"]
),
],
dependencies: [
.package(
url: "https://github.com/apple/swift-log.git",
from: "1.14.0"
),
.package(
url: "https://github.com/apple/swift-async-algorithms.git",
from: "1.1.3"
),
],
targets: [
.target(
name: "ServiceLifecycle",
dependencies: [
.product(
name: "Logging",
package: "swift-log"
),
.product(
name: "AsyncAlgorithms",
package: "swift-async-algorithms"
),
.target(name: "UnixSignals"),
.target(name: "ConcurrencyHelpers"),
]
),
.target(
name: "ServiceLifecycleTestKit",
dependencies: [
.target(name: "ServiceLifecycle")
]
),
.target(
name: "UnixSignals",
dependencies: [
.target(name: "ConcurrencyHelpers")
]
),
.target(
name: "ConcurrencyHelpers"
),
.testTarget(
name: "ServiceLifecycleTests",
dependencies: [
.target(name: "ServiceLifecycle"),
.target(name: "ServiceLifecycleTestKit"),
]
),
.testTarget(
name: "UnixSignalsTests",
dependencies: [
.target(name: "UnixSignals")
]
),
]
)
for target in package.targets {
#if compiler(<6.2)
// Needed since Sendable checking with isolated methods is not working correctly before 6.2
if target.swiftSettings == nil {
target.swiftSettings = []
}
target.swiftSettings?.append(.swiftLanguageMode(.v5))
#endif
}