Skip to content

Commit 701a053

Browse files
committed
Revert "Adopt package in the test support module (#7372)"
This reverts commit b9fc53b.
1 parent c9a3945 commit 701a053

28 files changed

+508
-504
lines changed

Sources/SPMTestSupport/InMemoryGitRepository.swift

Lines changed: 62 additions & 62 deletions
Large diffs are not rendered by default.

Sources/SPMTestSupport/ManifestExtensions.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import PackageModel
1717
import struct TSCUtility.Version
1818

1919
extension Manifest {
20-
package static func createRootManifest(
20+
public static func createRootManifest(
2121
displayName: String,
2222
path: AbsolutePath = .root,
2323
defaultLocalization: String? = nil,
@@ -53,7 +53,7 @@ extension Manifest {
5353
)
5454
}
5555

56-
package static func createFileSystemManifest(
56+
public static func createFileSystemManifest(
5757
displayName: String,
5858
path: AbsolutePath,
5959
defaultLocalization: String? = nil,
@@ -89,7 +89,7 @@ extension Manifest {
8989
)
9090
}
9191

92-
package static func createLocalSourceControlManifest(
92+
public static func createLocalSourceControlManifest(
9393
displayName: String,
9494
path: AbsolutePath,
9595
defaultLocalization: String? = nil,
@@ -125,7 +125,7 @@ extension Manifest {
125125
)
126126
}
127127

128-
package static func createRemoteSourceControlManifest(
128+
public static func createRemoteSourceControlManifest(
129129
displayName: String,
130130
url: SourceControlURL,
131131
path: AbsolutePath,
@@ -162,7 +162,7 @@ extension Manifest {
162162
)
163163
}
164164

165-
package static func createRegistryManifest(
165+
public static func createRegistryManifest(
166166
displayName: String,
167167
identity: PackageIdentity,
168168
path: AbsolutePath = .root,
@@ -199,7 +199,7 @@ extension Manifest {
199199
)
200200
}
201201

202-
package static func createManifest(
202+
public static func createManifest(
203203
displayName: String,
204204
path: AbsolutePath = .root,
205205
packageKind: PackageReference.Kind,
@@ -238,7 +238,7 @@ extension Manifest {
238238
)
239239
}
240240

241-
package func with(location: String) -> Manifest {
241+
public func with(location: String) -> Manifest {
242242
Manifest(
243243
displayName: self.displayName,
244244
path: self.path,

Sources/SPMTestSupport/MockArchiver.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ package final class MockArchiver: Archiver {
2828
package typealias ValidationHandler = (MockArchiver, AbsolutePath, (Result<Bool, Error>) -> Void) throws -> Void
2929

3030
package struct Extraction: Equatable {
31-
package let archivePath: AbsolutePath
32-
package let destinationPath: AbsolutePath
31+
public let archivePath: AbsolutePath
32+
public let destinationPath: AbsolutePath
3333

34-
package init(archivePath: AbsolutePath, destinationPath: AbsolutePath) {
34+
public init(archivePath: AbsolutePath, destinationPath: AbsolutePath) {
3535
self.archivePath = archivePath
3636
self.destinationPath = destinationPath
3737
}
3838
}
3939

4040
package struct Compression: Equatable {
41-
package let directory: AbsolutePath
42-
package let destinationPath: AbsolutePath
41+
public let directory: AbsolutePath
42+
public let destinationPath: AbsolutePath
4343

44-
package init(directory: AbsolutePath, destinationPath: AbsolutePath) {
44+
public init(directory: AbsolutePath, destinationPath: AbsolutePath) {
4545
self.directory = directory
4646
self.destinationPath = destinationPath
4747
}

Sources/SPMTestSupport/MockBuildTestHelper.swift

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,59 +22,59 @@ import SPMBuildCore
2222
import TSCUtility
2323
import XCTest
2424

25-
package struct MockToolchain: PackageModel.Toolchain {
25+
public struct MockToolchain: PackageModel.Toolchain {
2626
#if os(Windows)
27-
package let librarianPath = AbsolutePath("/fake/path/to/link.exe")
27+
public let librarianPath = AbsolutePath("/fake/path/to/link.exe")
2828
#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
29-
package let librarianPath = AbsolutePath("/fake/path/to/libtool")
29+
public let librarianPath = AbsolutePath("/fake/path/to/libtool")
3030
#else
31-
package let librarianPath = AbsolutePath("/fake/path/to/llvm-ar")
31+
public let librarianPath = AbsolutePath("/fake/path/to/llvm-ar")
3232
#endif
33-
package let swiftCompilerPath = AbsolutePath("/fake/path/to/swiftc")
34-
package let includeSearchPaths = [AbsolutePath]()
35-
package let librarySearchPaths = [AbsolutePath]()
36-
package let swiftResourcesPath: AbsolutePath?
37-
package let swiftStaticResourcesPath: AbsolutePath? = nil
38-
package let sdkRootPath: AbsolutePath? = nil
39-
package let extraFlags = PackageModel.BuildFlags()
40-
package let installedSwiftPMConfiguration = InstalledSwiftPMConfiguration.default
41-
package let providedLibraries = [ProvidedLibrary]()
42-
43-
package func getClangCompiler() throws -> AbsolutePath {
33+
public let swiftCompilerPath = AbsolutePath("/fake/path/to/swiftc")
34+
public let includeSearchPaths = [AbsolutePath]()
35+
public let librarySearchPaths = [AbsolutePath]()
36+
public let swiftResourcesPath: AbsolutePath?
37+
public let swiftStaticResourcesPath: AbsolutePath? = nil
38+
public let sdkRootPath: AbsolutePath? = nil
39+
public let extraFlags = PackageModel.BuildFlags()
40+
public let installedSwiftPMConfiguration = InstalledSwiftPMConfiguration.default
41+
public let providedLibraries = [ProvidedLibrary]()
42+
43+
public func getClangCompiler() throws -> AbsolutePath {
4444
"/fake/path/to/clang"
4545
}
4646

47-
package func _isClangCompilerVendorApple() throws -> Bool? {
47+
public func _isClangCompilerVendorApple() throws -> Bool? {
4848
#if os(macOS)
4949
return true
5050
#else
5151
return false
5252
#endif
5353
}
5454

55-
package init(swiftResourcesPath: AbsolutePath? = nil) {
55+
public init(swiftResourcesPath: AbsolutePath? = nil) {
5656
self.swiftResourcesPath = swiftResourcesPath
5757
}
5858
}
5959

6060
extension Basics.Triple {
61-
package static let x86_64MacOS = try! Self("x86_64-apple-macosx")
62-
package static let x86_64Linux = try! Self("x86_64-unknown-linux-gnu")
63-
package static let arm64Linux = try! Self("aarch64-unknown-linux-gnu")
64-
package static let arm64Android = try! Self("aarch64-unknown-linux-android")
65-
package static let windows = try! Self("x86_64-unknown-windows-msvc")
66-
package static let wasi = try! Self("wasm32-unknown-wasi")
67-
package static let arm64iOS = try! Self("arm64-apple-ios")
61+
public static let x86_64MacOS = try! Self("x86_64-apple-macosx")
62+
public static let x86_64Linux = try! Self("x86_64-unknown-linux-gnu")
63+
public static let arm64Linux = try! Self("aarch64-unknown-linux-gnu")
64+
public static let arm64Android = try! Self("aarch64-unknown-linux-android")
65+
public static let windows = try! Self("x86_64-unknown-windows-msvc")
66+
public static let wasi = try! Self("wasm32-unknown-wasi")
67+
public static let arm64iOS = try! Self("arm64-apple-ios")
6868
}
6969

70-
package let hostTriple = try! UserToolchain.default.targetTriple
70+
public let hostTriple = try! UserToolchain.default.targetTriple
7171
#if os(macOS)
72-
package let defaultTargetTriple: String = hostTriple.tripleString(forPlatformVersion: "10.13")
72+
public let defaultTargetTriple: String = hostTriple.tripleString(forPlatformVersion: "10.13")
7373
#else
74-
package let defaultTargetTriple: String = hostTriple.tripleString
74+
public let defaultTargetTriple: String = hostTriple.tripleString
7575
#endif
7676

77-
package func mockBuildParameters(
77+
public func mockBuildParameters(
7878
buildPath: AbsolutePath? = nil,
7979
config: BuildConfiguration = .debug,
8080
toolchain: PackageModel.Toolchain = MockToolchain(),
@@ -116,7 +116,7 @@ package func mockBuildParameters(
116116
)
117117
}
118118

119-
package func mockBuildParameters(environment: BuildEnvironment) -> BuildParameters {
119+
public func mockBuildParameters(environment: BuildEnvironment) -> BuildParameters {
120120
let triple: Basics.Triple
121121
switch environment.platform {
122122
case .macOS:
@@ -138,12 +138,12 @@ enum BuildError: Swift.Error {
138138
case error(String)
139139
}
140140

141-
package struct BuildPlanResult {
142-
package let plan: Build.BuildPlan
143-
package let targetMap: [ResolvedModule.ID: TargetBuildDescription]
144-
package let productMap: [ResolvedProduct.ID: Build.ProductBuildDescription]
141+
public struct BuildPlanResult {
142+
public let plan: Build.BuildPlan
143+
public let targetMap: [ResolvedModule.ID: TargetBuildDescription]
144+
public let productMap: [ResolvedProduct.ID: Build.ProductBuildDescription]
145145

146-
package init(plan: Build.BuildPlan) throws {
146+
public init(plan: Build.BuildPlan) throws {
147147
self.plan = plan
148148
self.productMap = try Dictionary(
149149
throwingUniqueKeysWithValues: plan.buildProducts
@@ -163,15 +163,15 @@ package struct BuildPlanResult {
163163
)
164164
}
165165

166-
package func checkTargetsCount(_ count: Int, file: StaticString = #file, line: UInt = #line) {
166+
public func checkTargetsCount(_ count: Int, file: StaticString = #file, line: UInt = #line) {
167167
XCTAssertEqual(self.plan.targetMap.count, count, file: file, line: line)
168168
}
169169

170-
package func checkProductsCount(_ count: Int, file: StaticString = #file, line: UInt = #line) {
170+
public func checkProductsCount(_ count: Int, file: StaticString = #file, line: UInt = #line) {
171171
XCTAssertEqual(self.plan.productMap.count, count, file: file, line: line)
172172
}
173173

174-
package func target(for name: String) throws -> TargetBuildDescription {
174+
public func target(for name: String) throws -> TargetBuildDescription {
175175
let matchingIDs = targetMap.keys.filter({ $0.targetName == name })
176176
guard matchingIDs.count == 1, let target = targetMap[matchingIDs[0]] else {
177177
if matchingIDs.isEmpty {
@@ -183,7 +183,7 @@ package struct BuildPlanResult {
183183
return target
184184
}
185185

186-
package func buildProduct(for name: String) throws -> Build.ProductBuildDescription {
186+
public func buildProduct(for name: String) throws -> Build.ProductBuildDescription {
187187
let matchingIDs = productMap.keys.filter({ $0.productName == name })
188188
guard matchingIDs.count == 1, let product = productMap[matchingIDs[0]] else {
189189
if matchingIDs.isEmpty {
@@ -198,7 +198,7 @@ package struct BuildPlanResult {
198198
}
199199

200200
extension TargetBuildDescription {
201-
package func swiftTarget() throws -> SwiftTargetBuildDescription {
201+
public func swiftTarget() throws -> SwiftTargetBuildDescription {
202202
switch self {
203203
case .swift(let target):
204204
return target
@@ -207,7 +207,7 @@ extension TargetBuildDescription {
207207
}
208208
}
209209

210-
package func clangTarget() throws -> ClangTargetBuildDescription {
210+
public func clangTarget() throws -> ClangTargetBuildDescription {
211211
switch self {
212212
case .clang(let target):
213213
return target

Sources/SPMTestSupport/MockDependency.swift

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@ import Foundation
1515
import PackageLoading
1616
import PackageModel
1717

18-
package typealias SourceControlRequirement = PackageDependency.SourceControl.Requirement
19-
package typealias RegistryRequirement = PackageDependency.Registry.Requirement
18+
public typealias SourceControlRequirement = PackageDependency.SourceControl.Requirement
19+
public typealias RegistryRequirement = PackageDependency.Registry.Requirement
2020

21-
package struct MockDependency {
22-
package let deprecatedName: String?
23-
package let location: Location
24-
package let products: ProductFilter
21+
public struct MockDependency {
22+
public let deprecatedName: String?
23+
public let location: Location
24+
public let products: ProductFilter
2525

2626
init(deprecatedName: String? = nil, location: Location, products: ProductFilter = .everything) {
2727
self.deprecatedName = deprecatedName
2828
self.location = location
2929
self.products = products
3030
}
3131

32-
package func convert(baseURL: AbsolutePath, identityResolver: IdentityResolver) throws -> PackageDependency {
32+
public func convert(baseURL: AbsolutePath, identityResolver: IdentityResolver) throws -> PackageDependency {
3333
switch self.location {
3434
case .fileSystem(let path):
3535
let absolutePath = baseURL.appending(path)
@@ -119,39 +119,39 @@ package struct MockDependency {
119119

120120
}
121121

122-
package static func fileSystem(path: String, products: ProductFilter = .everything) -> MockDependency {
122+
public static func fileSystem(path: String, products: ProductFilter = .everything) -> MockDependency {
123123
try! MockDependency(location: .fileSystem(path: RelativePath(validating: path)), products: products)
124124
}
125125

126-
package static func sourceControl(path: String, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
126+
public static func sourceControl(path: String, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
127127
try! .sourceControl(path: RelativePath(validating: path), requirement: requirement, products: products)
128128
}
129129

130-
package static func sourceControl(path: RelativePath, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
130+
public static func sourceControl(path: RelativePath, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
131131
MockDependency(location: .localSourceControl(path: path, requirement: requirement), products: products)
132132
}
133133

134-
package static func sourceControlWithDeprecatedName(name: String, path: String, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
134+
public static func sourceControlWithDeprecatedName(name: String, path: String, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
135135
try! MockDependency(deprecatedName: name, location: .localSourceControl(path: RelativePath(validating: path), requirement: requirement), products: products)
136136
}
137137

138-
package static func sourceControl(url: String, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
138+
public static func sourceControl(url: String, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
139139
.sourceControl(url: SourceControlURL(url), requirement: requirement, products: products)
140140
}
141141

142-
package static func sourceControl(url: SourceControlURL, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
142+
public static func sourceControl(url: SourceControlURL, requirement: SourceControlRequirement, products: ProductFilter = .everything) -> MockDependency {
143143
MockDependency(location: .remoteSourceControl(url: url, requirement: requirement), products: products)
144144
}
145145

146-
package static func registry(identity: String, requirement: RegistryRequirement, products: ProductFilter = .everything) -> MockDependency {
146+
public static func registry(identity: String, requirement: RegistryRequirement, products: ProductFilter = .everything) -> MockDependency {
147147
.registry(identity: .plain(identity), requirement: requirement)
148148
}
149149

150-
package static func registry(identity: PackageIdentity, requirement: RegistryRequirement, products: ProductFilter = .everything) -> MockDependency {
150+
public static func registry(identity: PackageIdentity, requirement: RegistryRequirement, products: ProductFilter = .everything) -> MockDependency {
151151
MockDependency(location: .registry(identity: identity, requirement: requirement), products: products)
152152
}
153153

154-
package enum Location {
154+
public enum Location {
155155
case fileSystem(path: RelativePath)
156156
case localSourceControl(path: RelativePath, requirement: SourceControlRequirement)
157157
case remoteSourceControl(url: SourceControlURL, requirement: SourceControlRequirement)

Sources/SPMTestSupport/MockDependencyGraph.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ import PackageModel
1616

1717
import struct TSCUtility.Version
1818

19-
package struct MockDependencyGraph {
20-
package let name: String
21-
package let constraints: [MockPackageContainer.Constraint]
22-
package let containers: [MockPackageContainer]
23-
package let result: [PackageReference: Version]
19+
public struct MockDependencyGraph {
20+
public let name: String
21+
public let constraints: [MockPackageContainer.Constraint]
22+
public let containers: [MockPackageContainer]
23+
public let result: [PackageReference: Version]
2424

25-
package init(name: String, constraints: [MockPackageContainer.Constraint], containers: [MockPackageContainer], result: [PackageReference : Version]) {
25+
public init(name: String, constraints: [MockPackageContainer.Constraint], containers: [MockPackageContainer], result: [PackageReference : Version]) {
2626
self.name = name
2727
self.constraints = constraints
2828
self.containers = containers
2929
self.result = result
3030
}
3131

32-
package func checkResult(
32+
public func checkResult(
3333
_ output: [(container: PackageReference, version: Version)],
3434
file: StaticString = #file,
3535
line: UInt = #line

Sources/SPMTestSupport/MockHTTPClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import Basics
1414

1515
extension LegacyHTTPClient {
16-
package static func mock(fileSystem: FileSystem) -> LegacyHTTPClient {
16+
public static func mock(fileSystem: FileSystem) -> LegacyHTTPClient {
1717
let handler: LegacyHTTPClient.Handler = { request, _, completion in
1818
switch request.kind {
1919
case.generic:

Sources/SPMTestSupport/MockHashAlgorithm.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ import Basics
1515
import struct TSCBasic.ByteString
1616
import protocol TSCBasic.HashAlgorithm
1717

18-
package final class MockHashAlgorithm {
19-
package typealias Handler = @Sendable (ByteString) -> ByteString
18+
public final class MockHashAlgorithm {
19+
public typealias Handler = @Sendable (ByteString) -> ByteString
2020

21-
package let hashes = ThreadSafeArrayStore<ByteString>()
21+
public let hashes = ThreadSafeArrayStore<ByteString>()
2222
private let handler: Handler?
2323

24-
package init(handler: Handler? = nil) {
24+
public init(handler: Handler? = nil) {
2525
self.handler = handler
2626
}
2727

28-
package func hash(_ hash: ByteString) -> ByteString {
28+
public func hash(_ hash: ByteString) -> ByteString {
2929
if let handler = self.handler {
3030
return handler(hash)
3131
} else {

0 commit comments

Comments
 (0)