Skip to content

Commit 9337c5e

Browse files
authored
Hide CLI commands API with package access control (#7381)
Known clients of SwiftPM have not adopted these CLI APIs that were previously marked as `public`. To prevent accidental adoption by clients in the future, we should use `package` access control instead. Also replaced remaining usages of `@_spi(SwiftPMInternal)` with `package` across all of our codebase.
1 parent 64adc92 commit 9337c5e

File tree

86 files changed

+283
-415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+283
-415
lines changed

Sources/Basics/ProgressAnimation/NinjaProgressAnimation.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import protocol TSCBasic.WritableByteStream
1515

1616
extension ProgressAnimation {
1717
/// A ninja-like progress animation that adapts to the provided output stream.
18-
@_spi(SwiftPMInternal)
19-
public static func ninja(
18+
package static func ninja(
2019
stream: WritableByteStream,
2120
verbose: Bool
2221
) -> any ProgressAnimationProtocol {

Sources/Basics/ProgressAnimation/PercentProgressAnimation.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ import protocol TSCBasic.WritableByteStream
1515

1616
extension ProgressAnimation {
1717
/// A percent-based progress animation that adapts to the provided output stream.
18-
@_spi(SwiftPMInternal)
19-
public static func percent(
18+
package static func percent(
2019
stream: WritableByteStream,
2120
verbose: Bool,
2221
header: String

Sources/Basics/ProgressAnimation/ProgressAnimationProtocol.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ import class TSCBasic.LocalFileOutputByteStream
1515
import protocol TSCBasic.WritableByteStream
1616
import protocol TSCUtility.ProgressAnimationProtocol
1717

18-
@_spi(SwiftPMInternal)
19-
public typealias ProgressAnimationProtocol = TSCUtility.ProgressAnimationProtocol
18+
package typealias ProgressAnimationProtocol = TSCUtility.ProgressAnimationProtocol
2019

2120
/// Namespace to nest public progress animations under.
22-
@_spi(SwiftPMInternal)
23-
public enum ProgressAnimation {
21+
package enum ProgressAnimation {
2422
/// Dynamically create a progress animation based on the current stream
2523
/// capabilities and desired verbosity.
2624
///

Sources/Basics/ProgressAnimation/ThrottledProgressAnimation.swift

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,27 +56,23 @@ final class ThrottledProgressAnimation: ProgressAnimationProtocol {
5656
}
5757
}
5858

59-
@_spi(SwiftPMInternal)
6059
extension ProgressAnimationProtocol {
61-
@_spi(SwiftPMInternal)
62-
public func throttled<C: Clock>(
60+
package func throttled<C: Clock>(
6361
now: @escaping () -> C.Instant,
6462
interval: C.Duration,
6563
clock: C.Type = C.self
6664
) -> some ProgressAnimationProtocol {
6765
ThrottledProgressAnimation(self, now: now, interval: interval, clock: clock)
6866
}
6967

70-
@_spi(SwiftPMInternal)
71-
public func throttled<C: Clock>(
68+
package func throttled<C: Clock>(
7269
clock: C,
7370
interval: C.Duration
7471
) -> some ProgressAnimationProtocol {
7572
self.throttled(now: { clock.now }, interval: interval, clock: C.self)
7673
}
7774

78-
@_spi(SwiftPMInternal)
79-
public func throttled(
75+
package func throttled(
8076
interval: ContinuousClock.Duration
8177
) -> some ProgressAnimationProtocol {
8278
self.throttled(clock: ContinuousClock(), interval: interval)

Sources/Build/BuildDescription/ProductBuildDescription.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import Basics
1414
import PackageGraph
1515

16-
@_spi(SwiftPMInternal)
1716
import PackageModel
1817

1918
import OrderedCollections

Sources/Build/BuildDescription/SwiftTargetBuildDescription.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import PackageGraph
1717
import PackageLoading
1818
import PackageModel
1919

20-
@_spi(SwiftPMInternal)
2120
import SPMBuildCore
2221

2322
#if USE_IMPL_ONLY_IMPORTS

Sources/Build/BuildOperation.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,15 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
@_spi(SwiftPMInternal)
1413
import Basics
1514

16-
@_spi(SwiftPMInternal)
1715
import Build
1816

1917
import LLBuildManifest
2018
import PackageGraph
2119
import PackageLoading
2220
import PackageModel
2321

24-
@_spi(SwiftPMInternal)
2522
import SPMBuildCore
2623

2724
import SPMLLBuild
@@ -43,8 +40,7 @@ import DriverSupport
4340
import SwiftDriver
4441
#endif
4542

46-
@_spi(SwiftPMInternal)
47-
public final class BuildOperation: PackageStructureDelegate, SPMBuildCore.BuildSystem, BuildErrorAdviceProvider {
43+
package final class BuildOperation: PackageStructureDelegate, SPMBuildCore.BuildSystem, BuildErrorAdviceProvider {
4844
/// The delegate used by the build system.
4945
public weak var delegate: SPMBuildCore.BuildSystemDelegate?
5046

Sources/Build/BuildOperationBuildSystemDelegateHandler.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,12 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13-
@_spi(SwiftPMInternal)
1413
import Basics
1514
import Dispatch
1615
import Foundation
1716
import LLBuildManifest
1817
import PackageModel
1918

20-
@_spi(SwiftPMInternal)
2119
import SPMBuildCore
2220

2321
import SPMLLBuild

Sources/Build/BuildPlan/BuildPlan+Product.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import struct PackageGraph.ResolvedTarget
1818
import class PackageModel.BinaryTarget
1919
import class PackageModel.ClangTarget
2020

21-
@_spi(SwiftPMInternal)
2221
import class PackageModel.Target
2322

2423
import class PackageModel.SwiftTarget

Sources/Build/BuildPlan/BuildPlan.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,7 @@ public class BuildPlan: SPMBuildCore.BuildPlan {
225225
/// source files as well as directories to which any changes should cause us to reevaluate the build plan.
226226
public let prebuildCommandResults: [ResolvedTarget.ID: [PrebuildCommandResult]]
227227

228-
@_spi(SwiftPMInternal)
229-
public private(set) var derivedTestTargetsMap: [ResolvedProduct.ID: [ResolvedTarget]] = [:]
228+
package private(set) var derivedTestTargetsMap: [ResolvedProduct.ID: [ResolvedTarget]] = [:]
230229

231230
/// Cache for pkgConfig flags.
232231
private var pkgConfigCache = [SystemLibraryTarget: (cFlags: [String], libs: [String])]()

0 commit comments

Comments
 (0)