Skip to content

Commit 036cc49

Browse files
committed
SKSwiftPMWorkspaceTest: hoist platform name computation
Perform the name computation early in the test to avoid importing the `TSCUtility.Triple` type. This fully isolates `TSCUtility.Triple` to SwiftPM, enabling us to migrate the type away to the single user.
1 parent 6081a2e commit 036cc49

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Tests/SKSwiftPMWorkspaceTests/SwiftPMWorkspaceTests.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import TSCBasic
2323
import XCTest
2424

2525
import struct TSCUtility.BuildFlags
26-
import struct TSCUtility.Triple
2726

2827
final class SwiftPMWorkspaceTests: XCTestCase {
2928

@@ -108,7 +107,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
108107

109108
let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
110109
let hostTriple = ws.buildParameters.triple
111-
let build = buildPath(root: packageRoot, triple: hostTriple)
110+
let build = buildPath(root: packageRoot, platform: hostTriple.platformBuildPathComponent())
112111

113112
XCTAssertEqual(ws.buildPath, build)
114113
XCTAssertNotNil(ws.indexStorePath)
@@ -164,7 +163,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
164163

165164
let aswift = packageRoot.appending(components: "Sources", "lib", "a.swift")
166165
let hostTriple = ws.buildParameters.triple
167-
let build = buildPath(root: packageRoot, config: config, triple: hostTriple)
166+
let build = buildPath(root: packageRoot, config: config, platform: hostTriple.platformBuildPathComponent())
168167

169168
XCTAssertEqual(ws.buildPath, build)
170169
let arguments = try ws._settings(for: aswift.asURI, .swift)!.compilerArguments
@@ -351,7 +350,7 @@ final class SwiftPMWorkspaceTests: XCTestCase {
351350
let acxx = packageRoot.appending(components: "Sources", "lib", "a.cpp")
352351
let bcxx = packageRoot.appending(components: "Sources", "lib", "b.cpp")
353352
let hostTriple = ws.buildParameters.triple
354-
let build = buildPath(root: packageRoot, triple: hostTriple)
353+
let build = buildPath(root: packageRoot, platform: hostTriple.platformBuildPathComponent())
355354

356355
XCTAssertEqual(ws.buildPath, build)
357356
XCTAssertNotNil(ws.indexStorePath)
@@ -628,8 +627,8 @@ private func check(
628627
private func buildPath(
629628
root: AbsolutePath,
630629
config: BuildSetup = TestSourceKitServer.serverOptions.buildSetup,
631-
triple: Triple) -> AbsolutePath
630+
platform: String) -> AbsolutePath
632631
{
633632
let buildPath = config.path ?? root.appending(component: ".build")
634-
return buildPath.appending(components: triple.platformBuildPathComponent(), "\(config.configuration)")
633+
return buildPath.appending(components: platform, "\(config.configuration)")
635634
}

0 commit comments

Comments
 (0)