Skip to content

Commit 0eeb43d

Browse files
committed
Skip target-import dependency verification procedure and test, if the host compiler does not support it.
1 parent 8411068 commit 0eeb43d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Sources/Build/BuildOperation.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ public final class BuildOperation: PackageStructureDelegate, SPMBuildCore.BuildS
123123
// Emit a warning if a target imports another target in this build
124124
// without specifying it as a dependency in the manifest
125125
private func verifyTargetImports(in description: BuildDescription) throws {
126+
// Ensure the compiler supports the import-scan operation
127+
guard SwiftTargetBuildDescription.checkSupportedFrontendFlags(flags: ["import-prescan"], fs: localFileSystem) else {
128+
return
129+
}
126130
for (target, commandLine) in description.swiftTargetScanArgs {
127131
do {
128132
guard let dependencies = description.targetDependencyMap[target] else {

Tests/CommandsTests/BuildToolTests.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ final class BuildToolTests: XCTestCase {
7373
}
7474

7575
func testImportOfMissedDepWarning() throws {
76+
#if swift(<5.5)
77+
try XCTSkipIf(true, "skipping because host compiler doesn't support '-import-prescan'")
78+
#endif
7679
fixture(name: "Miscellaneous/ImportOfMissingDependency") { path in
7780
let fullPath = resolveSymlinks(path)
7881
XCTAssertThrowsError(try build([], packagePath: fullPath)) { error in

0 commit comments

Comments
 (0)