From dd074002a54e89b16845f3d0e7090825f2fa446a Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Mon, 21 Nov 2022 14:56:23 +0000 Subject: [PATCH] Remove _NIOBeta (#2319) Motivation: Having deprecated the NIOBeta entrypoints in #2300, we can now safely remove it. Modifications: Remove all source files in _NIOBeta Remove the _NIOBeta product and target Result: We're ready for 5.8 work! --- Package.swift | 3 -- Package@swift-5.5.swift | 3 -- Sources/_NIOBeta/TimeAmount+Duration.swift | 61 ---------------------- 3 files changed, 67 deletions(-) delete mode 100644 Sources/_NIOBeta/TimeAmount+Duration.swift diff --git a/Package.swift b/Package.swift index ca98cf331..68df38006 100644 --- a/Package.swift +++ b/Package.swift @@ -42,8 +42,6 @@ var targets: [PackageDescription.Target] = [ "NIOPosix"]), .target(name: "_NIOConcurrency", dependencies: ["NIO", "NIOCore"]), - .target(name: "_NIOBeta", - dependencies: ["NIOCore"]), .target(name: "NIOFoundationCompat", dependencies: ["NIO", "NIOCore"]), .target(name: "CNIOAtomics", dependencies: []), .target(name: "CNIOSHA1", dependencies: []), @@ -133,7 +131,6 @@ let package = Package( .library(name: "NIOEmbedded", targets: ["NIOEmbedded"]), .library(name: "NIOPosix", targets: ["NIOPosix"]), .library(name: "_NIOConcurrency", targets: ["_NIOConcurrency"]), - .library(name: "_NIOBeta", targets: ["_NIOBeta"]), .library(name: "NIOTLS", targets: ["NIOTLS"]), .library(name: "NIOHTTP1", targets: ["NIOHTTP1"]), .library(name: "NIOConcurrencyHelpers", targets: ["NIOConcurrencyHelpers"]), diff --git a/Package@swift-5.5.swift b/Package@swift-5.5.swift index 0507e6274..fb7f87ac8 100644 --- a/Package@swift-5.5.swift +++ b/Package@swift-5.5.swift @@ -41,8 +41,6 @@ var targets: [PackageDescription.Target] = [ "NIOPosix"]), .target(name: "_NIOConcurrency", dependencies: ["NIO", "NIOCore"]), - .target(name: "_NIOBeta", - dependencies: ["NIOCore"]), .target(name: "NIOFoundationCompat", dependencies: ["NIO", "NIOCore"]), .target(name: "CNIOAtomics", dependencies: []), .target(name: "CNIOSHA1", dependencies: []), @@ -132,7 +130,6 @@ let package = Package( .library(name: "NIOEmbedded", targets: ["NIOEmbedded"]), .library(name: "NIOPosix", targets: ["NIOPosix"]), .library(name: "_NIOConcurrency", targets: ["_NIOConcurrency"]), - .library(name: "_NIOBeta", targets: ["_NIOBeta"]), .library(name: "NIOTLS", targets: ["NIOTLS"]), .library(name: "NIOHTTP1", targets: ["NIOHTTP1"]), .library(name: "NIOConcurrencyHelpers", targets: ["NIOConcurrencyHelpers"]), diff --git a/Sources/_NIOBeta/TimeAmount+Duration.swift b/Sources/_NIOBeta/TimeAmount+Duration.swift deleted file mode 100644 index 6ec863717..000000000 --- a/Sources/_NIOBeta/TimeAmount+Duration.swift +++ /dev/null @@ -1,61 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the SwiftNIO open source project -// -// Copyright (c) 2022 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 NIOCore - -#if (os(macOS) && swift(>=5.7.1)) || (!os(macOS) && swift(>=5.7)) -extension TimeAmount { - @available(macOS 13, iOS 16, tvOS 16, watchOS 9, *) - @available(*, deprecated, message: "This API has been moved to NIOCore and will be removed in a future update.") - /// Creates a new `TimeAmount` for the given `Duration`, truncating and clamping if necessary. - /// - /// - returns: `TimeAmount`, truncated to nanosecond precision, and clamped to `Int64.max` nanoseconds. - public init(_ duration: Swift.Duration) { - self = .nanoseconds(duration.nanosecondsClamped) - } -} - -@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *) -extension Swift.Duration { - /// Construct a `Duration` given a number of nanoseconds represented as a `TimeAmount`. - /// - /// - returns: A `Duration` representing a given number of nanoseconds. - @available(*, deprecated, message: "This API has been moved to NIOCore and will be removed in a future update.") - public init(_ timeAmount: TimeAmount) { - self = .nanoseconds(timeAmount.nanoseconds) - } -} - -@available(macOS 13, iOS 16, tvOS 16, watchOS 9, *) -internal extension Swift.Duration { - /// The duration represented as nanoseconds, clamped to maximum expressible value. - @available(*, deprecated, message: "This API has been moved to NIOCore and will be removed in a future update.") - var nanosecondsClamped: Int64 { - let components = self.components - - let secondsComponentNanos = components.seconds.multipliedReportingOverflow(by: 1_000_000_000) - let attosCompononentNanos = components.attoseconds / 1_000_000_000 - let combinedNanos = secondsComponentNanos.partialValue.addingReportingOverflow(attosCompononentNanos) - - guard - !secondsComponentNanos.overflow, - !combinedNanos.overflow - else { - return .max - } - - return combinedNanos.partialValue - } -} -#endif // (os(macOS) && swift(>=5.7.1)) || (!os(macOS) && swift(>=5.7))