@@ -20,59 +20,59 @@ import SPMBuildCore
2020import TSCUtility
2121import XCTest
2222
23- public struct MockToolchain : PackageModel . Toolchain {
23+ package struct MockToolchain : PackageModel . Toolchain {
2424 #if os(Windows)
25- public let librarianPath = AbsolutePath ( " /fake/path/to/link.exe " )
25+ package let librarianPath = AbsolutePath ( " /fake/path/to/link.exe " )
2626 #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 " )
2828 #else
29- public let librarianPath = AbsolutePath ( " /fake/path/to/llvm-ar " )
29+ package let librarianPath = AbsolutePath ( " /fake/path/to/llvm-ar " )
3030 #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 {
4444 " /fake/path/to/clang "
4545 }
4646
47- public func _isClangCompilerVendorApple( ) throws -> Bool ? {
47+ package func _isClangCompilerVendorApple( ) throws -> Bool ? {
4848 #if os(macOS)
4949 return true
5050 #else
5151 return false
5252 #endif
5353 }
5454
55- public init ( ) { }
55+ package init ( ) { }
5656}
5757
5858extension 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 " )
6666}
6767
68- public let hostTriple = try ! UserToolchain . default. targetTriple
68+ package let hostTriple = try ! UserToolchain . default. targetTriple
6969#if os(macOS)
70- public let defaultTargetTriple : String = hostTriple. tripleString ( forPlatformVersion: " 10.13 " )
70+ package let defaultTargetTriple : String = hostTriple. tripleString ( forPlatformVersion: " 10.13 " )
7171#else
72- public let defaultTargetTriple : String = hostTriple. tripleString
72+ package let defaultTargetTriple : String = hostTriple. tripleString
7373#endif
7474
75- public func mockBuildParameters(
75+ package func mockBuildParameters(
7676 buildPath: AbsolutePath = " /path/to/build " ,
7777 config: BuildConfiguration = . debug,
7878 toolchain: PackageModel . Toolchain = MockToolchain ( ) ,
@@ -114,7 +114,7 @@ public func mockBuildParameters(
114114 )
115115}
116116
117- public func mockBuildParameters( environment: BuildEnvironment ) -> BuildParameters {
117+ package func mockBuildParameters( environment: BuildEnvironment ) -> BuildParameters {
118118 let triple : Basics . Triple
119119 switch environment. platform {
120120 case . macOS:
@@ -136,12 +136,12 @@ enum BuildError: Swift.Error {
136136 case error( String )
137137}
138138
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 ]
143143
144- public init ( plan: Build . BuildPlan ) throws {
144+ package init ( plan: Build . BuildPlan ) throws {
145145 self . plan = plan
146146 self . productMap = try Dictionary (
147147 throwingUniqueKeysWithValues: plan. buildProducts
@@ -161,22 +161,22 @@ public struct BuildPlanResult {
161161 )
162162 }
163163
164- public func checkTargetsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
164+ package func checkTargetsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
165165 XCTAssertEqual ( self . plan. targetMap. count, count, file: file, line: line)
166166 }
167167
168- public func checkProductsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
168+ package func checkProductsCount( _ count: Int , file: StaticString = #file, line: UInt = #line) {
169169 XCTAssertEqual ( self . plan. productMap. count, count, file: file, line: line)
170170 }
171171
172- public func target( for name: String ) throws -> TargetBuildDescription {
172+ package func target( for name: String ) throws -> TargetBuildDescription {
173173 guard let target = targetMap [ name] else {
174174 throw BuildError . error ( " Target \( name) not found. " )
175175 }
176176 return target
177177 }
178178
179- public func buildProduct( for name: String ) throws -> Build . ProductBuildDescription {
179+ package func buildProduct( for name: String ) throws -> Build . ProductBuildDescription {
180180 guard let product = productMap [ name] else {
181181 // <rdar://problem/30162871> Display the thrown error on macOS
182182 throw BuildError . error ( " Product \( name) not found. " )
@@ -186,7 +186,7 @@ public struct BuildPlanResult {
186186}
187187
188188extension TargetBuildDescription {
189- public func swiftTarget( ) throws -> SwiftTargetBuildDescription {
189+ package func swiftTarget( ) throws -> SwiftTargetBuildDescription {
190190 switch self {
191191 case . swift( let target) :
192192 return target
@@ -195,7 +195,7 @@ extension TargetBuildDescription {
195195 }
196196 }
197197
198- public func clangTarget( ) throws -> ClangTargetBuildDescription {
198+ package func clangTarget( ) throws -> ClangTargetBuildDescription {
199199 switch self {
200200 case . clang( let target) :
201201 return target
0 commit comments