// swift-tools-version:6.1 import PackageDescription let package = Package( name: "swift-system-metrics", platforms: [ .macOS(.v13), .iOS(.v16), .watchOS(.v9), .tvOS(.v16), ], products: [ .library(name: "SystemMetrics", targets: ["SystemMetrics"]) ], dependencies: [ .package(url: "https://github.com/apple/swift-metrics.git", from: "2.10.1"), .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.9.1"), .package(url: "https://github.com/apple/swift-async-algorithms", from: "1.1.1"), ], targets: [ .target( name: "SystemMetrics", dependencies: [ .product(name: "CoreMetrics", package: "swift-metrics"), .product(name: "ServiceLifecycle", package: "swift-service-lifecycle"), .product(name: "AsyncAlgorithms", package: "swift-async-algorithms"), ] ), .testTarget( name: "SystemMetricsTests", dependencies: [ "SystemMetrics", .product(name: "MetricsTestKit", package: "swift-metrics"), ] ), ] ) for target in package.targets where [.executable, .test, .regular].contains( target.type ) { var settings = target.swiftSettings ?? [] // https://github.com/apple/swift-evolution/blob/main/proposals/0335-existential-any.md // Require `any` for existential types. settings.append(.enableUpcomingFeature("ExistentialAny")) // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md settings.append(.enableUpcomingFeature("MemberImportVisibility")) // https://github.com/swiftlang/swift-evolution/blob/main/proposals/0409-access-level-on-imports.md settings.append(.enableUpcomingFeature("InternalImportsByDefault")) // https://docs.swift.org/compiler/documentation/diagnostics/nonisolated-nonsending-by-default/ settings.append(.enableUpcomingFeature("NonisolatedNonsendingByDefault")) // Note: do not use .unsafeFlags, this will prevent SPM from checking out the package with tag. target.swiftSettings = settings }