Skip to content

Commit d091f6d

Browse files
Remove error for invalid swift caching configuration
Currently, swift-driver emits an error when trying to importing a swift binary module that has a bridging header when swift caching is enabled. This turns out to be a very common configuration that we need to support. It turns out most of the time, allowing the compilation to continue will result in a successful compilation. Even though in rare occasions where multiple bridging headers from the dependencies are involved with overlapping content, the compilation is going to fail with confusing error message, we will address that in swift compiler instead. Thus the current error message is removed to allow more supported projects.
1 parent eba1952 commit d091f6d

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

-5
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,6 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
264264
for dependencyModule in swiftDependencyArtifacts {
265265
inputs.append(TypedVirtualPath(file: dependencyModule.modulePath.path,
266266
type: .swiftModule))
267-
268-
let prebuiltHeaderDependencyPaths = dependencyModule.prebuiltHeaderDependencyPaths ?? []
269-
if cas != nil && !prebuiltHeaderDependencyPaths.isEmpty {
270-
throw DependencyScanningError.unsupportedConfigurationForCaching("module \(dependencyModule.moduleName) has bridging header dependency")
271-
}
272267
}
273268
for moduleArtifactInfo in clangDependencyArtifacts {
274269
let clangModulePath =

Sources/SwiftDriver/SwiftScan/SwiftScan.swift

-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ public enum DependencyScanningError: LocalizedError, DiagnosticData, Equatable {
3939
case scanningLibraryInvocationMismatch(String, String)
4040
case scanningLibraryNotFound(AbsolutePath)
4141
case argumentQueryFailed
42-
case unsupportedConfigurationForCaching(String)
4342

4443
public var description: String {
4544
switch self {
@@ -65,8 +64,6 @@ public enum DependencyScanningError: LocalizedError, DiagnosticData, Equatable {
6564
return "Dependency Scanning library not found at path: \(path)"
6665
case .argumentQueryFailed:
6766
return "Supported compiler argument query failed"
68-
case .unsupportedConfigurationForCaching(let reason):
69-
return "Unsupported configuration for -cache-compile-job, consider turn off swift caching: \(reason)"
7067
}
7168
}
7269

Tests/SwiftDriverTests/CachingBuildTests.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -718,9 +718,9 @@ final class CachingBuildTests: XCTestCase {
718718
"-working-directory", path.nativePathString(escaped: true),
719719
main.nativePathString(escaped: true)] + sdkArgumentsForTesting,
720720
interModuleDependencyOracle: dependencyOracle)
721-
// This is currently not supported.
722-
XCTAssertThrowsError(try driver.planBuild()) {
723-
XCTAssertEqual($0 as? DependencyScanningError, .unsupportedConfigurationForCaching("module Foo has bridging header dependency"))
721+
let jobs = try driver.planBuild()
722+
for job in jobs {
723+
XCTAssertFalse(job.outputCacheKeys.isEmpty)
724724
}
725725
}
726726
}

0 commit comments

Comments
 (0)