Skip to content

Commit b92abf4

Browse files
committed
Remove testable imports of SKCore
1 parent 50bb56c commit b92abf4

File tree

7 files changed

+25
-11
lines changed

7 files changed

+25
-11
lines changed

Sources/SKCore/CompilationDatabase.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ public struct CompilationDatabaseCompileCommand: Equatable {
3030

3131
/// The name of the build output, or nil.
3232
public var output: String? = nil
33+
34+
public init(directory: String, filename: String, commandLine: [String], output: String? = nil) {
35+
self.directory = directory
36+
self.filename = filename
37+
self.commandLine = commandLine
38+
self.output = output
39+
}
3340
}
3441

3542
extension CompilationDatabase.Command {

Sources/SKCore/FallbackBuildSystem.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ import enum SPMUtility.Platform
1717
/// A simple BuildSystem suitable as a fallback when accurate settings are unknown.
1818
public final class FallbackBuildSystem: BuildSystem {
1919

20+
public init() {}
21+
2022
/// The path to the SDK.
21-
lazy var sdkpath: AbsolutePath? = {
23+
public lazy var sdkpath: AbsolutePath? = {
2224
if case .darwin? = Platform.currentPlatform,
2325
let str = try? Process.checkNonZeroExit(
2426
args: "/usr/bin/xcrun", "--show-sdk-path", "--sdk", "macosx"),

Sources/SKCore/ToolchainRegistry.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public final class ToolchainRegistry {
4141
var queue: DispatchQueue = DispatchQueue(label: "toolchain-registry-queue")
4242

4343
/// The currently selected toolchain identifier on Darwin.
44-
public internal(set) lazy var darwinToolchainOverride: String? = {
44+
public lazy var darwinToolchainOverride: String? = {
4545
if let id = ProcessEnv.vars["TOOLCHAINS"], !id.isEmpty, id != "default" {
4646
return id
4747
}
@@ -151,7 +151,7 @@ extension ToolchainRegistry {
151151

152152
extension ToolchainRegistry {
153153

154-
enum Error: Swift.Error {
154+
public enum Error: Swift.Error {
155155

156156
/// There is already a toolchain with the given identifier.
157157
case duplicateToolchainIdentifier

Sources/SKCore/XCToolchainPlist.swift

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ import Basic
1414
import Foundation
1515

1616
/// A helper type for decoding the Info.plist or ToolchainInfo.plist file from an .xctoolchain.
17-
struct XCToolchainPlist {
17+
public struct XCToolchainPlist {
1818

1919
/// The toolchain identifer e.g. "com.apple.dt.toolchain.XcodeDefault".
20-
var identifier: String
20+
public var identifier: String
2121

2222
/// The toolchain's human-readable name.
23-
var displayName: String?
23+
public var displayName: String?
24+
25+
public init(identifier: String, displayName: String? = nil) {
26+
self.identifier = identifier
27+
self.displayName = displayName
28+
}
2429
}
2530

2631
extension XCToolchainPlist {
@@ -79,7 +84,7 @@ extension XCToolchainPlist: Codable {
7984
case DisplayName
8085
}
8186

82-
init(from decoder: Decoder) throws {
87+
public init(from decoder: Decoder) throws {
8388
let container = try decoder.container(keyedBy: CodingKeys.self)
8489
if let identifier = try container.decodeIfPresent(String.self, forKey: .Identifier) {
8590
self.identifier = identifier
@@ -90,7 +95,7 @@ extension XCToolchainPlist: Codable {
9095
}
9196

9297
/// Encode the info plist. **For testing**.
93-
func encode(to encoder: Encoder) throws {
98+
public func encode(to encoder: Encoder) throws {
9499
var container = encoder.container(keyedBy: CodingKeys.self)
95100
if identifier.starts(with: "com.apple") {
96101
try container.encode(identifier, forKey: .Identifier)

Tests/SKCoreTests/CompilationDatabaseTests.swift

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

13-
@testable import SKCore
13+
import SKCore
1414
import Basic
1515
import SKTestSupport
1616
import XCTest

Tests/SKCoreTests/FallbackBuildSystemTests.swift

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

13-
@testable import SKCore
13+
import SKCore
1414
import LanguageServerProtocol
1515
import Basic
1616
import XCTest

Tests/SKCoreTests/ToolchainRegistryTests.swift

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

13-
@testable import SKCore
13+
import SKCore
1414
import Basic
1515
import SPMUtility
1616
import XCTest

0 commit comments

Comments
 (0)