@@ -22,59 +22,59 @@ import SPMBuildCore
22
22
import TSCUtility
23
23
import XCTest
24
24
25
- package struct MockToolchain : PackageModel . Toolchain {
25
+ public struct MockToolchain : PackageModel . Toolchain {
26
26
#if os(Windows)
27
- package let librarianPath = AbsolutePath ( " /fake/path/to/link.exe " )
27
+ public let librarianPath = AbsolutePath ( " /fake/path/to/link.exe " )
28
28
#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 " )
30
30
#else
31
- package let librarianPath = AbsolutePath ( " /fake/path/to/llvm-ar " )
31
+ public let librarianPath = AbsolutePath ( " /fake/path/to/llvm-ar " )
32
32
#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 {
44
44
" /fake/path/to/clang "
45
45
}
46
46
47
- package func _isClangCompilerVendorApple( ) throws -> Bool ? {
47
+ public 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
- package init ( swiftResourcesPath: AbsolutePath ? = nil ) {
55
+ public init ( swiftResourcesPath: AbsolutePath ? = nil ) {
56
56
self . swiftResourcesPath = swiftResourcesPath
57
57
}
58
58
}
59
59
60
60
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 " )
68
68
}
69
69
70
- package let hostTriple = try ! UserToolchain . default. targetTriple
70
+ public let hostTriple = try ! UserToolchain . default. targetTriple
71
71
#if os(macOS)
72
- package let defaultTargetTriple : String = hostTriple. tripleString ( forPlatformVersion: " 10.13 " )
72
+ public let defaultTargetTriple : String = hostTriple. tripleString ( forPlatformVersion: " 10.13 " )
73
73
#else
74
- package let defaultTargetTriple : String = hostTriple. tripleString
74
+ public let defaultTargetTriple : String = hostTriple. tripleString
75
75
#endif
76
76
77
- package func mockBuildParameters(
77
+ public func mockBuildParameters(
78
78
buildPath: AbsolutePath ? = nil ,
79
79
config: BuildConfiguration = . debug,
80
80
toolchain: PackageModel . Toolchain = MockToolchain ( ) ,
@@ -116,7 +116,7 @@ package func mockBuildParameters(
116
116
)
117
117
}
118
118
119
- package func mockBuildParameters( environment: BuildEnvironment ) -> BuildParameters {
119
+ public func mockBuildParameters( environment: BuildEnvironment ) -> BuildParameters {
120
120
let triple : Basics . Triple
121
121
switch environment. platform {
122
122
case . macOS:
@@ -138,12 +138,12 @@ enum BuildError: Swift.Error {
138
138
case error( String )
139
139
}
140
140
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 ]
145
145
146
- package init ( plan: Build . BuildPlan ) throws {
146
+ public init ( plan: Build . BuildPlan ) throws {
147
147
self . plan = plan
148
148
self . productMap = try Dictionary (
149
149
throwingUniqueKeysWithValues: plan. buildProducts
@@ -163,15 +163,15 @@ package struct BuildPlanResult {
163
163
)
164
164
}
165
165
166
- package func checkTargetsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
166
+ public func checkTargetsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
167
167
XCTAssertEqual ( self . plan. targetMap. count, count, file: file, line: line)
168
168
}
169
169
170
- package func checkProductsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
170
+ public func checkProductsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
171
171
XCTAssertEqual ( self . plan. productMap. count, count, file: file, line: line)
172
172
}
173
173
174
- package func target( for name: String ) throws -> TargetBuildDescription {
174
+ public func target( for name: String ) throws -> TargetBuildDescription {
175
175
let matchingIDs = targetMap. keys. filter ( { $0. targetName == name } )
176
176
guard matchingIDs. count == 1 , let target = targetMap [ matchingIDs [ 0 ] ] else {
177
177
if matchingIDs. isEmpty {
@@ -183,7 +183,7 @@ package struct BuildPlanResult {
183
183
return target
184
184
}
185
185
186
- package func buildProduct( for name: String ) throws -> Build . ProductBuildDescription {
186
+ public func buildProduct( for name: String ) throws -> Build . ProductBuildDescription {
187
187
let matchingIDs = productMap. keys. filter ( { $0. productName == name } )
188
188
guard matchingIDs. count == 1 , let product = productMap [ matchingIDs [ 0 ] ] else {
189
189
if matchingIDs. isEmpty {
@@ -198,7 +198,7 @@ package struct BuildPlanResult {
198
198
}
199
199
200
200
extension TargetBuildDescription {
201
- package func swiftTarget( ) throws -> SwiftTargetBuildDescription {
201
+ public func swiftTarget( ) throws -> SwiftTargetBuildDescription {
202
202
switch self {
203
203
case . swift( let target) :
204
204
return target
@@ -207,7 +207,7 @@ extension TargetBuildDescription {
207
207
}
208
208
}
209
209
210
- package func clangTarget( ) throws -> ClangTargetBuildDescription {
210
+ public func clangTarget( ) throws -> ClangTargetBuildDescription {
211
211
switch self {
212
212
case . clang( let target) :
213
213
return target
0 commit comments