Skip to content

Mark more types and Driver state as internal/@_spi(Testing) #261

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Sources/SwiftDriver/Driver/CompilerMode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
//
//===----------------------------------------------------------------------===//
/// The mode of the compiler.
public enum CompilerMode: Equatable {
@_spi(Testing) public enum CompilerMode: Equatable {
/// A standard compilation, using multiple frontend invocations and -primary-file.
case standardCompile

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

/// Information about batch mode, which is used to determine how to form
/// the batches of jobs.
public struct BatchModeInfo: Equatable {
@_spi(Testing) public struct BatchModeInfo: Equatable {
let seed: Int?
let count: Int?
let sizeLimit: Int?
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Driver/DebugInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

/// The debug information produced by the driver.
public struct DebugInfo {
@_spi(Testing) public struct DebugInfo {

/// Describes the format used for debug information.
public enum Format: String {
Expand Down
76 changes: 38 additions & 38 deletions Sources/SwiftDriver/Driver/Driver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,30 +90,30 @@ public struct Driver {
public let env: [String: String]

/// The file system which we should interact with.
public let fileSystem: FileSystem
let fileSystem: FileSystem

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

/// The executor the driver uses to run jobs.
public let executor: DriverExecutor
let executor: DriverExecutor

/// The toolchain to use for resolution.
public let toolchain: Toolchain
@_spi(Testing) public let toolchain: Toolchain

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

/// The target triple.
public var targetTriple: Triple { frontendTargetInfo.target.triple }
@_spi(Testing) public var targetTriple: Triple { frontendTargetInfo.target.triple }

/// The variant target triple.
public var targetVariantTriple: Triple? {
var targetVariantTriple: Triple? {
frontendTargetInfo.targetVariant?.triple
}

/// The kind of driver.
public let driverKind: DriverKind
let driverKind: DriverKind

/// The option table we're using.
let optionTable: OptionTable
Expand All @@ -122,101 +122,101 @@ public struct Driver {
var parsedOptions: ParsedOptions

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

/// The working directory for the driver, if there is one.
public let workingDirectory: AbsolutePath?
let workingDirectory: AbsolutePath?

/// The set of input files
public let inputFiles: [TypedVirtualPath]
@_spi(Testing) public let inputFiles: [TypedVirtualPath]

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

/// The mapping from input files to output files for each kind.
internal let outputFileMap: OutputFileMap?
let outputFileMap: OutputFileMap?

/// The number of files required before making a file list.
internal let fileListThreshold: Int
let fileListThreshold: Int

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

/// VirtualPath for shared all sources file list. `nil` if unused.
public let allSourcesFileList: VirtualPath?
let allSourcesFileList: VirtualPath?

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

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

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

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

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

/// The set of sanitizers that were requested
public let enabledSanitizers: Set<Sanitizer>
let enabledSanitizers: Set<Sanitizer>

/// The debug information to produce.
public let debugInfo: DebugInfo
@_spi(Testing) public let debugInfo: DebugInfo

// The information about the module to produce.
public let moduleOutputInfo: ModuleOutputInfo
@_spi(Testing) public let moduleOutputInfo: ModuleOutputInfo

/// Code & data for incremental compilation
public let incrementalCompilationState: IncrementalCompilationState
@_spi(Testing) public let incrementalCompilationState: IncrementalCompilationState

/// The path of the SDK.
public var sdkPath: String? {
var sdkPath: String? {
frontendTargetInfo.paths.sdkPath
}

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

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

/// Path to the dependencies file.
public let dependenciesFilePath: VirtualPath?
let dependenciesFilePath: VirtualPath?

/// Path to the reference dependencies (.swiftdeps) file.
public let referenceDependenciesFilePath: VirtualPath?
let referenceDependenciesFilePath: VirtualPath?

/// Path to the serialized diagnostics file.
public let serializedDiagnosticsFilePath: VirtualPath?
let serializedDiagnosticsFilePath: VirtualPath?

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

/// Path to the loaded module trace file.
public let loadedModuleTracePath: VirtualPath?
let loadedModuleTracePath: VirtualPath?

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

/// Path to the module documentation file.
public let moduleDocOutputPath: VirtualPath?
let moduleDocOutputPath: VirtualPath?

/// Path to the Swift interface file.
public let swiftInterfacePath: VirtualPath?
let swiftInterfacePath: VirtualPath?

/// Path to the optimization record.
public let optimizationRecordPath: VirtualPath?
let optimizationRecordPath: VirtualPath?

/// Path to the Swift module source information file.
public let moduleSourceInfoPath: VirtualPath?
let moduleSourceInfoPath: VirtualPath?

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

/// Handler for constructing module build jobs using Explicit Module Builds.
/// Constructed during the planning phase only when all modules will be prebuilt and treated
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Driver/ModuleOutputInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

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

/// How should the Swift module output be handled?
public enum ModuleOutput: Equatable {
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Driver/OutputFileMap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public struct OutputFileMap: Hashable, Codable {
}

/// Load the output file map at the given path.
public static func load(
@_spi(Testing) public static func load(
fileSystem: FileSystem,
file: VirtualPath,
diagnosticEngine: DiagnosticsEngine
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Driver/ToolExecutionDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Glibc
#endif

/// Delegate for printing execution information on the command-line.
public struct ToolExecutionDelegate: JobExecutionDelegate {
struct ToolExecutionDelegate: JobExecutionDelegate {
public enum Mode {
case verbose
case parsableOutput
Expand Down
10 changes: 5 additions & 5 deletions Sources/SwiftDriver/Execution/ParsableOutput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import Foundation

public struct ParsableMessage {
@_spi(Testing) public struct ParsableMessage {
public enum Kind {
case began(BeganMessage)
case finished(FinishedMessage)
Expand All @@ -39,7 +39,7 @@ public struct ParsableMessage {
}
}

public struct BeganMessage: Encodable {
@_spi(Testing) public struct BeganMessage: Encodable {
public struct Output: Encodable {
public let type: String
public let path: String
Expand Down Expand Up @@ -79,7 +79,7 @@ public struct BeganMessage: Encodable {
}
}

public struct FinishedMessage: Encodable {
@_spi(Testing) public struct FinishedMessage: Encodable {
let exitStatus: Int
let pid: Int
let output: String?
Expand All @@ -103,7 +103,7 @@ public struct FinishedMessage: Encodable {
}
}

public struct SignalledMessage: Encodable {
@_spi(Testing) public struct SignalledMessage: Encodable {
let pid: Int
let output: String?
let errorMessage: String
Expand All @@ -124,7 +124,7 @@ public struct SignalledMessage: Encodable {
}
}

extension ParsableMessage: Encodable {
@_spi(Testing) extension ParsableMessage: Encodable {
enum CodingKeys: CodingKey {
case name
case kind
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TSCBasic
import Foundation
import SwiftOptions

public struct IncrementalCompilationState {
@_spi(Testing) public struct IncrementalCompilationState {
public let showIncrementalBuildDecisions: Bool
public let enableIncrementalBuild: Bool
public let buildRecordPath: VirtualPath?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
import Foundation

public struct SourceFileDependencyGraph {
@_spi(Testing) public struct SourceFileDependencyGraph {
public static let sourceFileProvidesInterfaceSequenceNumber: Int = 0
public static let sourceFileProvidesImplementationSequenceNumber: Int = 1

Expand Down Expand Up @@ -52,11 +52,11 @@ public struct SourceFileDependencyGraph {
}
}

public enum DeclAspect: UInt64 {
@_spi(Testing) public enum DeclAspect: UInt64 {
case interface, implementation
}

public struct DependencyKey {
@_spi(Testing) public struct DependencyKey {
public enum Kind: UInt64 {
case topLevel
case nominal
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Jobs/PrintTargetInfoJob.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ extension SwiftVersion: Codable {
}

/// Describes information about the target as provided by the Swift frontend.
public struct FrontendTargetInfo: Codable {
@_spi(Testing) public struct FrontendTargetInfo: Codable {
struct CompatibilityLibrary: Codable {
enum Filter: String, Codable {
case all
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Toolchains/DarwinToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import SwiftOptions
/// Toolchain for Darwin-based platforms, such as macOS and iOS.
///
/// FIXME: This class is not thread-safe.
public final class DarwinToolchain: Toolchain {
@_spi(Testing) public final class DarwinToolchain: Toolchain {
public let env: [String: String]

/// Doubles as path cache and point for overriding normal lookup
Expand Down
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Toolchains/GenericUnixToolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import TSCBasic

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

/// The executor used to run processes used to find tools and retrieve target info.
Expand Down
4 changes: 2 additions & 2 deletions Sources/SwiftDriver/Toolchains/Toolchain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public enum Tool {

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

var env: [String: String] { get }
Expand Down Expand Up @@ -178,6 +178,6 @@ extension Toolchain {
) throws {}
}

public enum ToolchainError: Swift.Error {
@_spi(Testing) public enum ToolchainError: Swift.Error {
case unableToFind(tool: String)
}
2 changes: 1 addition & 1 deletion Sources/SwiftDriver/Utilities/DOTJobGraphSerializer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import TSCBasic

/// Serializes the job graph to a .dot file
public struct DOTJobGraphSerializer {
@_spi(Testing) public struct DOTJobGraphSerializer {
var kindCounter = [Job.Kind: Int]()
var hasEmittedStyling = Set<String>()
let jobs: [Job]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/// The generator uses the [xoshiro256**](http://prng.di.unimi.it/xoshiro256starstar.c)
/// algorithm to produce its output. It is initialized using the
/// [splitmix64](http://prng.di.unimi.it/splitmix64.c) algorithm.
public struct PredictableRandomNumberGenerator: RandomNumberGenerator {
@_spi(Testing) public struct PredictableRandomNumberGenerator: RandomNumberGenerator {

var state: (UInt64, UInt64, UInt64, UInt64)

Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftDriverTests/AssertDiagnosticsTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

import XCTest
import SwiftDriver
@_spi(Testing) import SwiftDriver

// Yes, these are meta-tests! `assertDiagnostics(do:)` and friends are
// complicated enough to warrant a few tests of their own. To test that they
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftDriverTests/IncrementalCompilationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//
import XCTest

import SwiftDriver
@_spi(Testing) import SwiftDriver

final class IncrementalCompilationTests: XCTestCase {
func testInputInfoMapReading() throws {
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftDriverTests/JobExecutorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
import TSCBasic
import TSCUtility

import SwiftDriver
@_spi(Testing) import SwiftDriver

extension Job.ArgTemplate: ExpressibleByStringLiteral {
public init(stringLiteral value: String) {
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftDriverTests/ParsableMessageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import XCTest
import Foundation

import SwiftDriver
@_spi(Testing) import SwiftDriver

final class ParsableMessageTests: XCTestCase {
func testBeganMessage() throws {
Expand Down
Loading