mirror of
https://github.com/apple/swift-nio-extras
synced 2026-11-22 04:30:42 +00:00
Widened Swift Crypto versions to "1.0.0" ..< "6.0.0" ### Motivation: Swift Crypto 5.0.3 contains a security patch that has not been applied to v4.
380 lines
14 KiB
Swift
380 lines
14 KiB
Swift
// swift-tools-version:6.1
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2025 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
import PackageDescription
|
|
|
|
import class Foundation.ProcessInfo
|
|
|
|
let strictConcurrencyDevelopment = false
|
|
|
|
let strictConcurrencySettings: [SwiftSetting] = {
|
|
var initialSettings: [SwiftSetting] = []
|
|
|
|
if strictConcurrencyDevelopment {
|
|
// -warnings-as-errors here is a workaround so that IDE-based development can
|
|
// get tripped up on -require-explicit-sendable.
|
|
initialSettings.append(.unsafeFlags(["-require-explicit-sendable", "-warnings-as-errors"]))
|
|
}
|
|
|
|
return initialSettings
|
|
}()
|
|
|
|
var targets: [PackageDescription.Target] = [
|
|
.target(
|
|
name: "NIOExtras",
|
|
dependencies: [
|
|
.product(name: "NIO", package: "swift-nio"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOHTTPCompression",
|
|
dependencies: [
|
|
"CNIOExtrasZlib",
|
|
.product(name: "NIO", package: "swift-nio"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.executableTarget(
|
|
name: "HTTPServerWithQuiescingDemo",
|
|
dependencies: [
|
|
"NIOExtras",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.executableTarget(
|
|
name: "NIOWritePCAPDemo",
|
|
dependencies: [
|
|
"NIOExtras",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.executableTarget(
|
|
name: "NIOWritePartialPCAPDemo",
|
|
dependencies: [
|
|
"NIOExtras",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.executableTarget(
|
|
name: "NIOExtrasPerformanceTester",
|
|
dependencies: [
|
|
"NIOExtras",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOSOCKS",
|
|
dependencies: [
|
|
.product(name: "NIO", package: "swift-nio"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.executableTarget(
|
|
name: "NIOSOCKSClient",
|
|
dependencies: [
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
"NIOSOCKS",
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "CNIOExtrasZlib",
|
|
dependencies: [],
|
|
cSettings: [
|
|
.define("HAVE_HIDDEN"),
|
|
.define("_CRT_SECURE_NO_WARNINGS", .when(platforms: [.windows])),
|
|
],
|
|
linkerSettings: [
|
|
.linkedLibrary("z", .when(platforms: [.linux, .macOS, .iOS, .tvOS, .watchOS, .visionOS])),
|
|
.linkedLibrary("zlib", .when(platforms: [.windows])),
|
|
]
|
|
),
|
|
.testTarget(
|
|
name: "NIOExtrasTests",
|
|
dependencies: [
|
|
"NIOExtras",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "NIOTestUtils", package: "swift-nio"),
|
|
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOHTTPCompressionTests",
|
|
dependencies: [
|
|
"CNIOExtrasZlib",
|
|
"NIOHTTPCompression",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOSOCKSTests",
|
|
dependencies: [
|
|
"NIOSOCKS",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIONFS3",
|
|
dependencies: [
|
|
.product(name: "NIOCore", package: "swift-nio")
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIONFS3Tests",
|
|
dependencies: [
|
|
"NIONFS3",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
.product(name: "NIOTestUtils", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOHTTPTypes",
|
|
dependencies: [
|
|
.product(name: "HTTPTypes", package: "swift-http-types"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOHTTPTypesHTTP1",
|
|
dependencies: [
|
|
"NIOHTTPTypes",
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOHTTPTypesHTTP2",
|
|
dependencies: [
|
|
"NIOHTTPTypes",
|
|
.product(name: "NIOHTTP2", package: "swift-nio-http2"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOHTTPTypesHTTP1Tests",
|
|
dependencies: [
|
|
"NIOHTTPTypesHTTP1"
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOHTTPTypesHTTP2Tests",
|
|
dependencies: [
|
|
"NIOHTTPTypesHTTP2"
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOResumableUpload",
|
|
dependencies: [
|
|
"NIOHTTPTypes",
|
|
.product(name: "HTTPTypes", package: "swift-http-types"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "StructuredFieldValues", package: "swift-http-structured-headers"),
|
|
.product(name: "Atomics", package: "swift-atomics"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.executableTarget(
|
|
name: "NIOResumableUploadDemo",
|
|
dependencies: [
|
|
"NIOResumableUpload",
|
|
"NIOHTTPTypesHTTP1",
|
|
.product(name: "HTTPTypes", package: "swift-http-types"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOResumableUploadTests",
|
|
dependencies: [
|
|
.target(name: "NIOResumableUpload"),
|
|
.target(name: "NIOHTTPTypes"),
|
|
.target(name: "NIOHTTPTypesHTTP1"),
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
.product(name: "NIOHTTP1", package: "swift-nio"),
|
|
.product(name: "NIOPosix", package: "swift-nio"),
|
|
.product(name: "HTTPTypes", package: "swift-http-types"),
|
|
.product(name: "StructuredFieldValues", package: "swift-http-structured-headers"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOHTTPResponsiveness",
|
|
dependencies: [
|
|
"NIOHTTPTypes",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "HTTPTypes", package: "swift-http-types"),
|
|
.product(name: "Algorithms", package: "swift-algorithms"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOHTTPResponsivenessTests",
|
|
dependencies: [
|
|
"NIOHTTPResponsiveness",
|
|
"NIOHTTPTypes",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOEmbedded", package: "swift-nio"),
|
|
.product(name: "HTTPTypes", package: "swift-http-types"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOCertificateReloading",
|
|
dependencies: [
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOSSL", package: "swift-nio-ssl"),
|
|
.product(name: "X509", package: "swift-certificates"),
|
|
.product(name: "SwiftASN1", package: "swift-asn1"),
|
|
.product(name: "ServiceLifecycle", package: "swift-service-lifecycle"),
|
|
.product(name: "AsyncAlgorithms", package: "swift-async-algorithms"),
|
|
.product(name: "Logging", package: "swift-log"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOCertificateReloadingTests",
|
|
dependencies: [
|
|
"NIOCertificateReloading",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOSSL", package: "swift-nio-ssl"),
|
|
.product(name: "X509", package: "swift-certificates"),
|
|
.product(name: "SwiftASN1", package: "swift-asn1"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.target(
|
|
name: "NIOCertificateHelpers",
|
|
dependencies: [
|
|
.product(name: "NIOSSL", package: "swift-nio-ssl"),
|
|
.product(name: "SwiftASN1", package: "swift-asn1"),
|
|
.product(name: "X509", package: "swift-certificates"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
.testTarget(
|
|
name: "NIOCertificateHelpersTests",
|
|
dependencies: [
|
|
"NIOCertificateHelpers",
|
|
.product(name: "NIOCore", package: "swift-nio"),
|
|
.product(name: "NIOConcurrencyHelpers", package: "swift-nio"),
|
|
.product(name: "NIOSSL", package: "swift-nio-ssl"),
|
|
.product(name: "X509", package: "swift-certificates"),
|
|
.product(name: "SwiftASN1", package: "swift-asn1"),
|
|
.product(name: "Crypto", package: "swift-crypto"),
|
|
],
|
|
swiftSettings: strictConcurrencySettings
|
|
),
|
|
]
|
|
|
|
let package = Package(
|
|
name: "swift-nio-extras",
|
|
products: [
|
|
.library(name: "NIOExtras", targets: ["NIOExtras"]),
|
|
.library(name: "NIOSOCKS", targets: ["NIOSOCKS"]),
|
|
.library(name: "NIOHTTPCompression", targets: ["NIOHTTPCompression"]),
|
|
.library(name: "NIOHTTPTypes", targets: ["NIOHTTPTypes"]),
|
|
.library(name: "NIOHTTPTypesHTTP1", targets: ["NIOHTTPTypesHTTP1"]),
|
|
.library(name: "NIOHTTPTypesHTTP2", targets: ["NIOHTTPTypesHTTP2"]),
|
|
.library(name: "NIOResumableUpload", targets: ["NIOResumableUpload"]),
|
|
.library(name: "NIOHTTPResponsiveness", targets: ["NIOHTTPResponsiveness"]),
|
|
.library(name: "NIOCertificateReloading", targets: ["NIOCertificateReloading"]),
|
|
.library(name: "NIOCertificateHelpers", targets: ["NIOCertificateHelpers"]),
|
|
],
|
|
dependencies: [
|
|
.package(url: "https://github.com/apple/swift-nio.git", from: "2.94.0"),
|
|
.package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.27.0"),
|
|
.package(url: "https://github.com/apple/swift-http-types.git", from: "1.3.0"),
|
|
.package(url: "https://github.com/apple/swift-http-structured-headers.git", from: "1.2.0"),
|
|
.package(url: "https://github.com/apple/swift-atomics.git", from: "1.2.0"),
|
|
.package(url: "https://github.com/apple/swift-algorithms.git", from: "1.2.0"),
|
|
.package(url: "https://github.com/apple/swift-certificates.git", from: "1.14.0"),
|
|
.package(url: "https://github.com/apple/swift-nio-ssl.git", from: "2.34.0"),
|
|
.package(url: "https://github.com/apple/swift-asn1.git", from: "1.3.1"),
|
|
.package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.8.0"),
|
|
.package(url: "https://github.com/apple/swift-async-algorithms.git", from: "1.0.0"),
|
|
.package(url: "https://github.com/apple/swift-log.git", from: "1.6.3"),
|
|
],
|
|
targets: targets
|
|
)
|
|
|
|
// If the `SWIFT_NIO_EXTRAS_ALLOW_SWIFT_CRYPTO_BETA` environment variable is set
|
|
// swift-nio-extras will accept swift-crypto beta releases as a dependency.
|
|
//
|
|
// Note: A beta release can only be used if other packages in the dependency tree
|
|
// that have a direct dependency on swift-crypto accept beta releases as well.
|
|
if ProcessInfo.processInfo.environment["SWIFT_NIO_EXTRAS_ALLOW_SWIFT_CRYPTO_BETA"] == nil {
|
|
package.dependencies += [
|
|
.package(url: "https://github.com/apple/swift-crypto.git", "3.0.0"..<"6.0.0")
|
|
]
|
|
} else {
|
|
print("Accepting beta versions of swift-crypto!")
|
|
package.dependencies += [
|
|
.package(url: "https://github.com/apple/swift-crypto.git", "3.0.0"..<"6.0.0-beta.max")
|
|
]
|
|
}
|
|
|
|
// --- STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- //
|
|
for target in package.targets {
|
|
switch target.type {
|
|
case .regular, .test, .executable:
|
|
var settings = target.swiftSettings ?? []
|
|
// https://github.com/swiftlang/swift-evolution/blob/main/proposals/0444-member-import-visibility.md
|
|
settings.append(.enableUpcomingFeature("MemberImportVisibility"))
|
|
target.swiftSettings = settings
|
|
case .macro, .plugin, .system, .binary:
|
|
() // not applicable
|
|
@unknown default:
|
|
() // we don't know what to do here, do nothing
|
|
}
|
|
}
|
|
// --- END: STANDARD CROSS-REPO SETTINGS DO NOT EDIT --- //
|