@@ -20,59 +20,59 @@ import SPMBuildCore
20
20
import TSCUtility
21
21
import XCTest
22
22
23
- public struct MockToolchain : PackageModel . Toolchain {
23
+ package struct MockToolchain : PackageModel . Toolchain {
24
24
#if os(Windows)
25
- public let librarianPath = AbsolutePath ( " /fake/path/to/link.exe " )
25
+ package let librarianPath = AbsolutePath ( " /fake/path/to/link.exe " )
26
26
#elseif os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
27
- public let librarianPath = AbsolutePath ( " /fake/path/to/libtool " )
27
+ package let librarianPath = AbsolutePath ( " /fake/path/to/libtool " )
28
28
#else
29
- public let librarianPath = AbsolutePath ( " /fake/path/to/llvm-ar " )
29
+ package let librarianPath = AbsolutePath ( " /fake/path/to/llvm-ar " )
30
30
#endif
31
- public let swiftCompilerPath = AbsolutePath ( " /fake/path/to/swiftc " )
32
- public let includeSearchPaths = [ AbsolutePath] ( )
33
- public let librarySearchPaths = [ AbsolutePath] ( )
34
- public let swiftResourcesPath : AbsolutePath ? = nil
35
- public let swiftStaticResourcesPath : AbsolutePath ? = nil
36
- public let isSwiftDevelopmentToolchain = false
37
- public let sdkRootPath : AbsolutePath ? = nil
38
- public let swiftPluginServerPath : AbsolutePath ? = nil
39
- public let extraFlags = PackageModel . BuildFlags ( )
40
- public let installedSwiftPMConfiguration = InstalledSwiftPMConfiguration . default
41
- public let providedLibraries = [ LibraryMetadata] ( )
42
-
43
- public func getClangCompiler( ) throws -> AbsolutePath {
31
+ package let swiftCompilerPath = AbsolutePath ( " /fake/path/to/swiftc " )
32
+ package let includeSearchPaths = [ AbsolutePath] ( )
33
+ package let librarySearchPaths = [ AbsolutePath] ( )
34
+ package let swiftResourcesPath : AbsolutePath ? = nil
35
+ package let swiftStaticResourcesPath : AbsolutePath ? = nil
36
+ package let isSwiftDevelopmentToolchain = false
37
+ package let sdkRootPath : AbsolutePath ? = nil
38
+ package let swiftPluginServerPath : AbsolutePath ? = nil
39
+ package let extraFlags = PackageModel . BuildFlags ( )
40
+ package let installedSwiftPMConfiguration = InstalledSwiftPMConfiguration . default
41
+ package let providedLibraries = [ LibraryMetadata] ( )
42
+
43
+ package func getClangCompiler( ) throws -> AbsolutePath {
44
44
" /fake/path/to/clang "
45
45
}
46
46
47
- public func _isClangCompilerVendorApple( ) throws -> Bool ? {
47
+ package func _isClangCompilerVendorApple( ) throws -> Bool ? {
48
48
#if os(macOS)
49
49
return true
50
50
#else
51
51
return false
52
52
#endif
53
53
}
54
54
55
- public init ( ) { }
55
+ package init ( ) { }
56
56
}
57
57
58
58
extension Basics . Triple {
59
- public static let x86_64MacOS = try ! Self ( " x86_64-apple-macosx " )
60
- public static let x86_64Linux = try ! Self ( " x86_64-unknown-linux-gnu " )
61
- public static let arm64Linux = try ! Self ( " aarch64-unknown-linux-gnu " )
62
- public static let arm64Android = try ! Self ( " aarch64-unknown-linux-android " )
63
- public static let windows = try ! Self ( " x86_64-unknown-windows-msvc " )
64
- public static let wasi = try ! Self ( " wasm32-unknown-wasi " )
65
- public static let arm64iOS = try ! Self ( " arm64-apple-ios " )
59
+ package static let x86_64MacOS = try ! Self ( " x86_64-apple-macosx " )
60
+ package static let x86_64Linux = try ! Self ( " x86_64-unknown-linux-gnu " )
61
+ package static let arm64Linux = try ! Self ( " aarch64-unknown-linux-gnu " )
62
+ package static let arm64Android = try ! Self ( " aarch64-unknown-linux-android " )
63
+ package static let windows = try ! Self ( " x86_64-unknown-windows-msvc " )
64
+ package static let wasi = try ! Self ( " wasm32-unknown-wasi " )
65
+ package static let arm64iOS = try ! Self ( " arm64-apple-ios " )
66
66
}
67
67
68
- public let hostTriple = try ! UserToolchain . default. targetTriple
68
+ package let hostTriple = try ! UserToolchain . default. targetTriple
69
69
#if os(macOS)
70
- public let defaultTargetTriple : String = hostTriple. tripleString ( forPlatformVersion: " 10.13 " )
70
+ package let defaultTargetTriple : String = hostTriple. tripleString ( forPlatformVersion: " 10.13 " )
71
71
#else
72
- public let defaultTargetTriple : String = hostTriple. tripleString
72
+ package let defaultTargetTriple : String = hostTriple. tripleString
73
73
#endif
74
74
75
- public func mockBuildParameters(
75
+ package func mockBuildParameters(
76
76
buildPath: AbsolutePath = " /path/to/build " ,
77
77
config: BuildConfiguration = . debug,
78
78
toolchain: PackageModel . Toolchain = MockToolchain ( ) ,
@@ -114,7 +114,7 @@ public func mockBuildParameters(
114
114
)
115
115
}
116
116
117
- public func mockBuildParameters( environment: BuildEnvironment ) -> BuildParameters {
117
+ package func mockBuildParameters( environment: BuildEnvironment ) -> BuildParameters {
118
118
let triple : Basics . Triple
119
119
switch environment. platform {
120
120
case . macOS:
@@ -136,12 +136,12 @@ enum BuildError: Swift.Error {
136
136
case error( String )
137
137
}
138
138
139
- public struct BuildPlanResult {
140
- public let plan : Build . BuildPlan
141
- public let targetMap : [ String : TargetBuildDescription ]
142
- public let productMap : [ String : Build . ProductBuildDescription ]
139
+ package struct BuildPlanResult {
140
+ package let plan : Build . BuildPlan
141
+ package let targetMap : [ String : TargetBuildDescription ]
142
+ package let productMap : [ String : Build . ProductBuildDescription ]
143
143
144
- public init ( plan: Build . BuildPlan ) throws {
144
+ package init ( plan: Build . BuildPlan ) throws {
145
145
self . plan = plan
146
146
self . productMap = try Dictionary (
147
147
throwingUniqueKeysWithValues: plan. buildProducts
@@ -161,22 +161,22 @@ public struct BuildPlanResult {
161
161
)
162
162
}
163
163
164
- public func checkTargetsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
164
+ package func checkTargetsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
165
165
XCTAssertEqual ( self . plan. targetMap. count, count, file: file, line: line)
166
166
}
167
167
168
- public func checkProductsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
168
+ package func checkProductsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
169
169
XCTAssertEqual ( self . plan. productMap. count, count, file: file, line: line)
170
170
}
171
171
172
- public func target( for name: String ) throws -> TargetBuildDescription {
172
+ package func target( for name: String ) throws -> TargetBuildDescription {
173
173
guard let target = targetMap [ name] else {
174
174
throw BuildError . error ( " Target \( name) not found. " )
175
175
}
176
176
return target
177
177
}
178
178
179
- public func buildProduct( for name: String ) throws -> Build . ProductBuildDescription {
179
+ package func buildProduct( for name: String ) throws -> Build . ProductBuildDescription {
180
180
guard let product = productMap [ name] else {
181
181
// <rdar://problem/30162871> Display the thrown error on macOS
182
182
throw BuildError . error ( " Product \( name) not found. " )
@@ -186,7 +186,7 @@ public struct BuildPlanResult {
186
186
}
187
187
188
188
extension TargetBuildDescription {
189
- public func swiftTarget( ) throws -> SwiftTargetBuildDescription {
189
+ package func swiftTarget( ) throws -> SwiftTargetBuildDescription {
190
190
switch self {
191
191
case . swift( let target) :
192
192
return target
@@ -195,7 +195,7 @@ extension TargetBuildDescription {
195
195
}
196
196
}
197
197
198
- public func clangTarget( ) throws -> ClangTargetBuildDescription {
198
+ package func clangTarget( ) throws -> ClangTargetBuildDescription {
199
199
switch self {
200
200
case . clang( let target) :
201
201
return target
0 commit comments