Skip to content

Commit 0da3ecf

Browse files
committed
[Explicit Module Builds] Do not specify Clang dependency '.modulemap' files as task inputs
These files exist outside the task execution graph and are not produced by any of the tasks involved, so we rely on trusting they are present. This is crucial because these paths may be pre-VFS-remap paths which means that the driver (not-VFS-aware) may not have access to their "external" path and thus unable to verify their actual existence.
1 parent c283179 commit 0da3ecf

File tree

3 files changed

+2
-27
lines changed

3 files changed

+2
-27
lines changed

Sources/SwiftDriver/ExplicitModuleBuilds/ExplicitDependencyBuildPlanner.swift

-9
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
219219
// The only required input is the .modulemap for this module.
220220
// Command line options in the dependency scanner output will include the
221221
// required modulemap, so here we must only add it to the list of inputs.
222-
inputs.append(moduleMapPath)
223222
let cacheKeys : [TypedVirtualPath : String]
224223
if let key = moduleDetails.moduleCacheKey {
225224
cacheKeys = [moduleMapPath: key]
@@ -276,11 +275,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
276275
let clangModulePath =
277276
TypedVirtualPath(file: moduleArtifactInfo.clangModulePath.path,
278277
type: .pcm)
279-
let clangModuleMapPath =
280-
TypedVirtualPath(file: moduleArtifactInfo.clangModuleMapPath.path,
281-
type: .clangModuleMap)
282278
inputs.append(clangModulePath)
283-
inputs.append(clangModuleMapPath)
284279
}
285280

286281
// Swift Main Module dependencies are passed encoded in a JSON file as described by
@@ -445,11 +440,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
445440
let clangModulePath =
446441
TypedVirtualPath(file: moduleArtifactInfo.clangModulePath.path,
447442
type: .pcm)
448-
let clangModuleMapPath =
449-
TypedVirtualPath(file: moduleArtifactInfo.clangModuleMapPath.path,
450-
type: .clangModuleMap)
451443
inputs.append(clangModulePath)
452-
inputs.append(clangModuleMapPath)
453444
}
454445

455446
// Return if depscanner provided build commands.

Tests/SwiftDriverTests/CachingBuildTests.swift

+1-9
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,9 @@ throws {
5656
for command in extraCommandLine {
5757
XCTAssertTrue(job.commandLine.contains(.flag(command)))
5858
}
59-
case .clang(let clangModuleDetails):
60-
let moduleMapPath =
61-
TypedVirtualPath(file: clangModuleDetails.moduleMapPath.path,
62-
type: .clangModuleMap)
59+
case .clang(_):
6360
XCTAssertEqual(job.kind, .generatePCM)
6461
XCTAssertEqual(job.description, "Compiling Clang module \(moduleId.moduleName)")
65-
XCTAssertTrue(job.inputs.contains(moduleMapPath))
6662
case .swiftPrebuiltExternal(_):
6763
XCTFail("Unexpected prebuilt external module dependency found.")
6864
case .swiftPlaceholder(_):
@@ -167,11 +163,7 @@ private func checkCachingBuildJobDependencies(job: Job,
167163
let clangDependencyModulePathString = dependencyInfo.modulePath.path
168164
let clangDependencyModulePath =
169165
TypedVirtualPath(file: clangDependencyModulePathString, type: .pcm)
170-
let clangDependencyModuleMapPath =
171-
TypedVirtualPath(file: clangDependencyDetails.moduleMapPath.path,
172-
type: .clangModuleMap)
173166
XCTAssertTrue(job.inputs.contains(clangDependencyModulePath))
174-
XCTAssertTrue(job.inputs.contains(clangDependencyModuleMapPath))
175167
XCTAssertTrue(job.commandLine.contains(
176168
.flag(String("-fmodule-file=\(dependencyId.moduleName)=\(clangDependencyModulePathString)"))))
177169
XCTAssertTrue(job.commandLine.contains(

Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift

+1-9
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,9 @@ throws {
5050
}
5151
XCTAssertTrue(job.commandLine.filter {$0 == .flag("-candidate-module-file")}.count == compiledCandidateList.count)
5252
}
53-
case .clang(let clangModuleDetails):
54-
let moduleMapPath =
55-
TypedVirtualPath(file: clangModuleDetails.moduleMapPath.path,
56-
type: .clangModuleMap)
53+
case .clang(_):
5754
XCTAssertEqual(job.kind, .generatePCM)
5855
XCTAssertEqual(job.description, "Compiling Clang module \(moduleId.moduleName)")
59-
XCTAssertTrue(job.inputs.contains(moduleMapPath))
6056
case .swiftPrebuiltExternal(_):
6157
XCTFail("Unexpected prebuilt external module dependency found.")
6258
case .swiftPlaceholder(_):
@@ -88,11 +84,7 @@ private func checkExplicitModuleBuildJobDependencies(job: Job,
8884
let clangDependencyModulePathString = dependencyInfo.modulePath.path
8985
let clangDependencyModulePath =
9086
TypedVirtualPath(file: clangDependencyModulePathString, type: .pcm)
91-
let clangDependencyModuleMapPath =
92-
TypedVirtualPath(file: clangDependencyDetails.moduleMapPath.path,
93-
type: .clangModuleMap)
9487
XCTAssertTrue(job.inputs.contains(clangDependencyModulePath))
95-
XCTAssertTrue(job.inputs.contains(clangDependencyModuleMapPath))
9688
XCTAssertTrue(job.commandLine.contains(
9789
.flag(String("-fmodule-file=\(dependencyId.moduleName)=\(clangDependencyModulePathString)"))))
9890
XCTAssertTrue(job.commandLine.contains(

0 commit comments

Comments
 (0)