Skip to content

Commit c605132

Browse files
authored
Merge pull request #261 from artemcm/LessAPI
Mark more types and Driver state as internal/@_spi(Testing)
2 parents fb311e7 + f9874d2 commit c605132

20 files changed

+65
-65
lines changed

Sources/SwiftDriver/Driver/CompilerMode.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212
/// The mode of the compiler.
13-
public enum CompilerMode: Equatable {
13+
@_spi(Testing) public enum CompilerMode: Equatable {
1414
/// A standard compilation, using multiple frontend invocations and -primary-file.
1515
case standardCompile
1616

@@ -33,7 +33,7 @@ public enum CompilerMode: Equatable {
3333

3434
/// Information about batch mode, which is used to determine how to form
3535
/// the batches of jobs.
36-
public struct BatchModeInfo: Equatable {
36+
@_spi(Testing) public struct BatchModeInfo: Equatable {
3737
let seed: Int?
3838
let count: Int?
3939
let sizeLimit: Int?

Sources/SwiftDriver/Driver/DebugInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
/// The debug information produced by the driver.
14-
public struct DebugInfo {
14+
@_spi(Testing) public struct DebugInfo {
1515

1616
/// Describes the format used for debug information.
1717
public enum Format: String {

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -104,30 +104,30 @@ public struct Driver {
104104
public let env: [String: String]
105105

106106
/// The file system which we should interact with.
107-
public let fileSystem: FileSystem
107+
let fileSystem: FileSystem
108108

109109
/// Diagnostic engine for emitting warnings, errors, etc.
110110
public let diagnosticEngine: DiagnosticsEngine
111111

112112
/// The executor the driver uses to run jobs.
113-
public let executor: DriverExecutor
113+
let executor: DriverExecutor
114114

115115
/// The toolchain to use for resolution.
116-
public let toolchain: Toolchain
116+
@_spi(Testing) public let toolchain: Toolchain
117117

118118
/// Information about the target, as reported by the Swift frontend.
119-
let frontendTargetInfo: FrontendTargetInfo
119+
@_spi(Testing) public let frontendTargetInfo: FrontendTargetInfo
120120

121121
/// The target triple.
122-
public var targetTriple: Triple { frontendTargetInfo.target.triple }
122+
@_spi(Testing) public var targetTriple: Triple { frontendTargetInfo.target.triple }
123123

124124
/// The variant target triple.
125-
public var targetVariantTriple: Triple? {
125+
var targetVariantTriple: Triple? {
126126
frontendTargetInfo.targetVariant?.triple
127127
}
128128

129129
/// The kind of driver.
130-
public let driverKind: DriverKind
130+
let driverKind: DriverKind
131131

132132
/// The option table we're using.
133133
let optionTable: OptionTable
@@ -136,101 +136,101 @@ public struct Driver {
136136
var parsedOptions: ParsedOptions
137137

138138
/// Extra command-line arguments to pass to the Swift compiler.
139-
public let swiftCompilerPrefixArgs: [String]
139+
let swiftCompilerPrefixArgs: [String]
140140

141141
/// The working directory for the driver, if there is one.
142-
public let workingDirectory: AbsolutePath?
142+
let workingDirectory: AbsolutePath?
143143

144144
/// The set of input files
145-
public let inputFiles: [TypedVirtualPath]
145+
@_spi(Testing) public let inputFiles: [TypedVirtualPath]
146146

147147
/// The last time each input file was modified, recorded at the start of the build.
148-
public let recordedInputModificationDates: [TypedVirtualPath: Date]
148+
@_spi(Testing) public let recordedInputModificationDates: [TypedVirtualPath: Date]
149149

150150
/// The mapping from input files to output files for each kind.
151-
internal let outputFileMap: OutputFileMap?
151+
let outputFileMap: OutputFileMap?
152152

153153
/// The number of files required before making a file list.
154-
internal let fileListThreshold: Int
154+
let fileListThreshold: Int
155155

156156
/// Should use file lists for inputs (number of inputs exceeds `fileListThreshold`).
157-
public let shouldUseInputFileList: Bool
157+
let shouldUseInputFileList: Bool
158158

159159
/// VirtualPath for shared all sources file list. `nil` if unused.
160-
public let allSourcesFileList: VirtualPath?
160+
let allSourcesFileList: VirtualPath?
161161

162162
/// The mode in which the compiler will execute.
163-
public let compilerMode: CompilerMode
163+
@_spi(Testing) public let compilerMode: CompilerMode
164164

165165
/// The type of the primary output generated by the compiler.
166-
public let compilerOutputType: FileType?
166+
@_spi(Testing) public let compilerOutputType: FileType?
167167

168168
/// The type of the primary output generated by the linker.
169-
public let linkerOutputType: LinkOutputType?
169+
@_spi(Testing) public let linkerOutputType: LinkOutputType?
170170

171171
/// When > 0, the number of threads to use in a multithreaded build.
172-
public let numThreads: Int
172+
@_spi(Testing) public let numThreads: Int
173173

174174
/// The specified maximum number of parallel jobs to execute.
175-
public let numParallelJobs: Int?
175+
@_spi(Testing) public let numParallelJobs: Int?
176176

177177
/// The set of sanitizers that were requested
178-
public let enabledSanitizers: Set<Sanitizer>
178+
let enabledSanitizers: Set<Sanitizer>
179179

180180
/// The debug information to produce.
181-
public let debugInfo: DebugInfo
181+
@_spi(Testing) public let debugInfo: DebugInfo
182182

183183
// The information about the module to produce.
184-
public let moduleOutputInfo: ModuleOutputInfo
184+
@_spi(Testing) public let moduleOutputInfo: ModuleOutputInfo
185185

186186
/// Code & data for incremental compilation
187-
public let incrementalCompilationState: IncrementalCompilationState
187+
@_spi(Testing) public let incrementalCompilationState: IncrementalCompilationState
188188

189189
/// The path of the SDK.
190-
public var sdkPath: String? {
190+
var sdkPath: String? {
191191
frontendTargetInfo.paths.sdkPath
192192
}
193193

194194
/// The path to the imported Objective-C header.
195-
public let importedObjCHeader: VirtualPath?
195+
let importedObjCHeader: VirtualPath?
196196

197197
/// The path to the pch for the imported Objective-C header.
198-
public let bridgingPrecompiledHeader: VirtualPath?
198+
let bridgingPrecompiledHeader: VirtualPath?
199199

200200
/// Path to the dependencies file.
201-
public let dependenciesFilePath: VirtualPath?
201+
let dependenciesFilePath: VirtualPath?
202202

203203
/// Path to the reference dependencies (.swiftdeps) file.
204-
public let referenceDependenciesFilePath: VirtualPath?
204+
let referenceDependenciesFilePath: VirtualPath?
205205

206206
/// Path to the serialized diagnostics file.
207-
public let serializedDiagnosticsFilePath: VirtualPath?
207+
let serializedDiagnosticsFilePath: VirtualPath?
208208

209209
/// Path to the Objective-C generated header.
210-
public let objcGeneratedHeaderPath: VirtualPath?
210+
let objcGeneratedHeaderPath: VirtualPath?
211211

212212
/// Path to the loaded module trace file.
213-
public let loadedModuleTracePath: VirtualPath?
213+
let loadedModuleTracePath: VirtualPath?
214214

215215
/// Path to the TBD file (text-based dylib).
216-
public let tbdPath: VirtualPath?
216+
let tbdPath: VirtualPath?
217217

218218
/// Path to the module documentation file.
219-
public let moduleDocOutputPath: VirtualPath?
219+
let moduleDocOutputPath: VirtualPath?
220220

221221
/// Path to the Swift interface file.
222-
public let swiftInterfacePath: VirtualPath?
222+
let swiftInterfacePath: VirtualPath?
223223

224224
/// Path to the optimization record.
225-
public let optimizationRecordPath: VirtualPath?
225+
let optimizationRecordPath: VirtualPath?
226226

227227
/// Path to the Swift module source information file.
228-
public let moduleSourceInfoPath: VirtualPath?
228+
let moduleSourceInfoPath: VirtualPath?
229229

230230
/// If the driver should force emit module in a single invocation.
231231
///
232232
/// This will force the driver to first emit the module and then run compile jobs.
233-
public var forceEmitModuleInSingleInvocation: Bool = false
233+
var forceEmitModuleInSingleInvocation: Bool = false
234234

235235
/// Handler for constructing module build jobs using Explicit Module Builds.
236236
/// Constructed during the planning phase only when all modules will be prebuilt and treated

Sources/SwiftDriver/Driver/ModuleOutputInfo.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
/// The information about module output produced by the driver.
14-
public struct ModuleOutputInfo {
14+
@_spi(Testing) public struct ModuleOutputInfo {
1515

1616
/// How should the Swift module output be handled?
1717
public enum ModuleOutput: Equatable {

Sources/SwiftDriver/Driver/OutputFileMap.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public struct OutputFileMap: Hashable, Codable {
7171
}
7272

7373
/// Load the output file map at the given path.
74-
public static func load(
74+
@_spi(Testing) public static func load(
7575
fileSystem: FileSystem,
7676
file: VirtualPath,
7777
diagnosticEngine: DiagnosticsEngine

Sources/SwiftDriver/Driver/ToolExecutionDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Glibc
2323
#endif
2424

2525
/// Delegate for printing execution information on the command-line.
26-
public struct ToolExecutionDelegate: JobExecutionDelegate {
26+
struct ToolExecutionDelegate: JobExecutionDelegate {
2727
public enum Mode {
2828
case verbose
2929
case parsableOutput

Sources/SwiftDriver/Execution/ParsableOutput.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import Foundation
1414

15-
public struct ParsableMessage {
15+
@_spi(Testing) public struct ParsableMessage {
1616
public enum Kind {
1717
case began(BeganMessage)
1818
case finished(FinishedMessage)
@@ -39,7 +39,7 @@ public struct ParsableMessage {
3939
}
4040
}
4141

42-
public struct BeganMessage: Encodable {
42+
@_spi(Testing) public struct BeganMessage: Encodable {
4343
public struct Output: Encodable {
4444
public let type: String
4545
public let path: String
@@ -79,7 +79,7 @@ public struct BeganMessage: Encodable {
7979
}
8080
}
8181

82-
public struct FinishedMessage: Encodable {
82+
@_spi(Testing) public struct FinishedMessage: Encodable {
8383
let exitStatus: Int
8484
let pid: Int
8585
let output: String?
@@ -103,7 +103,7 @@ public struct FinishedMessage: Encodable {
103103
}
104104
}
105105

106-
public struct SignalledMessage: Encodable {
106+
@_spi(Testing) public struct SignalledMessage: Encodable {
107107
let pid: Int
108108
let output: String?
109109
let errorMessage: String
@@ -124,7 +124,7 @@ public struct SignalledMessage: Encodable {
124124
}
125125
}
126126

127-
extension ParsableMessage: Encodable {
127+
@_spi(Testing) extension ParsableMessage: Encodable {
128128
enum CodingKeys: CodingKey {
129129
case name
130130
case kind

Sources/SwiftDriver/Incremental Compilation/IncrementalCompilationState.swift

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

16-
public struct IncrementalCompilationState {
16+
@_spi(Testing) public struct IncrementalCompilationState {
1717
public let showIncrementalBuildDecisions: Bool
1818
public let enableIncrementalBuild: Bool
1919
public let buildRecordPath: VirtualPath?

Sources/SwiftDriver/Incremental Compilation/SourceFileDependencyGraph.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212
import Foundation
1313

14-
public struct SourceFileDependencyGraph {
14+
@_spi(Testing) public struct SourceFileDependencyGraph {
1515
public static let sourceFileProvidesInterfaceSequenceNumber: Int = 0
1616
public static let sourceFileProvidesImplementationSequenceNumber: Int = 1
1717

@@ -52,11 +52,11 @@ public struct SourceFileDependencyGraph {
5252
}
5353
}
5454

55-
public enum DeclAspect: UInt64 {
55+
@_spi(Testing) public enum DeclAspect: UInt64 {
5656
case interface, implementation
5757
}
5858

59-
public struct DependencyKey {
59+
@_spi(Testing) public struct DependencyKey {
6060
public enum Kind: UInt64 {
6161
case topLevel
6262
case nominal

Sources/SwiftDriver/Jobs/PrintTargetInfoJob.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ extension SwiftVersion: Codable {
6262
}
6363

6464
/// Describes information about the target as provided by the Swift frontend.
65-
public struct FrontendTargetInfo: Codable {
65+
@_spi(Testing) public struct FrontendTargetInfo: Codable {
6666
struct CompatibilityLibrary: Codable {
6767
enum Filter: String, Codable {
6868
case all

Sources/SwiftDriver/Toolchains/DarwinToolchain.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import SwiftOptions
1717
/// Toolchain for Darwin-based platforms, such as macOS and iOS.
1818
///
1919
/// FIXME: This class is not thread-safe.
20-
public final class DarwinToolchain: Toolchain {
20+
@_spi(Testing) public final class DarwinToolchain: Toolchain {
2121
public let env: [String: String]
2222

2323
/// Doubles as path cache and point for overriding normal lookup

Sources/SwiftDriver/Toolchains/GenericUnixToolchain.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import TSCBasic
1313

1414
/// Toolchain for Unix-like systems.
15-
public final class GenericUnixToolchain: Toolchain {
15+
@_spi(Testing) public final class GenericUnixToolchain: Toolchain {
1616
public let env: [String: String]
1717

1818
/// The executor used to run processes used to find tools and retrieve target info.

Sources/SwiftDriver/Toolchains/Toolchain.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public enum Tool {
2727

2828
/// Describes a toolchain, which includes information about compilers, linkers
2929
/// and other tools required to build Swift code.
30-
public protocol Toolchain {
30+
@_spi(Testing) public protocol Toolchain {
3131
init(env: [String: String], executor: DriverExecutor, fileSystem: FileSystem)
3232

3333
var env: [String: String] { get }
@@ -178,6 +178,6 @@ extension Toolchain {
178178
) throws {}
179179
}
180180

181-
public enum ToolchainError: Swift.Error {
181+
@_spi(Testing) public enum ToolchainError: Swift.Error {
182182
case unableToFind(tool: String)
183183
}

Sources/SwiftDriver/Utilities/DOTJobGraphSerializer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import TSCBasic
1313

1414
/// Serializes the job graph to a .dot file
15-
public struct DOTJobGraphSerializer {
15+
@_spi(Testing) public struct DOTJobGraphSerializer {
1616
var kindCounter = [Job.Kind: Int]()
1717
var hasEmittedStyling = Set<String>()
1818
let jobs: [Job]

Sources/SwiftDriver/Utilities/PredictableRandomNumberGenerator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/// The generator uses the [xoshiro256**](http://prng.di.unimi.it/xoshiro256starstar.c)
1717
/// algorithm to produce its output. It is initialized using the
1818
/// [splitmix64](http://prng.di.unimi.it/splitmix64.c) algorithm.
19-
public struct PredictableRandomNumberGenerator: RandomNumberGenerator {
19+
@_spi(Testing) public struct PredictableRandomNumberGenerator: RandomNumberGenerator {
2020

2121
var state: (UInt64, UInt64, UInt64, UInt64)
2222

Tests/SwiftDriverTests/AssertDiagnosticsTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
import XCTest
14-
import SwiftDriver
14+
@_spi(Testing) import SwiftDriver
1515

1616
// Yes, these are meta-tests! `assertDiagnostics(do:)` and friends are
1717
// complicated enough to warrant a few tests of their own. To test that they

Tests/SwiftDriverTests/IncrementalCompilationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//===----------------------------------------------------------------------===//
1212
import XCTest
1313

14-
import SwiftDriver
14+
@_spi(Testing) import SwiftDriver
1515

1616
final class IncrementalCompilationTests: XCTestCase {
1717
func testInputInfoMapReading() throws {

Tests/SwiftDriverTests/JobExecutorTests.swift

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

16-
import SwiftDriver
16+
@_spi(Testing) import SwiftDriver
1717

1818
extension Job.ArgTemplate: ExpressibleByStringLiteral {
1919
public init(stringLiteral value: String) {

Tests/SwiftDriverTests/ParsableMessageTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import XCTest
1313
import Foundation
1414

15-
import SwiftDriver
15+
@_spi(Testing) import SwiftDriver
1616

1717
final class ParsableMessageTests: XCTestCase {
1818
func testBeganMessage() throws {

0 commit comments

Comments
 (0)