Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Explicit Module Builds] Do not specify Clang dependency module.modulemap files as task inputs #1522

Merged
merged 1 commit into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
// The only required input is the .modulemap for this module.
// Command line options in the dependency scanner output will include the
// required modulemap, so here we must only add it to the list of inputs.
inputs.append(moduleMapPath)
let cacheKeys : [TypedVirtualPath : String]
if let key = moduleDetails.moduleCacheKey {
cacheKeys = [moduleMapPath: key]
Expand Down Expand Up @@ -276,11 +275,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
let clangModulePath =
TypedVirtualPath(file: moduleArtifactInfo.clangModulePath.path,
type: .pcm)
let clangModuleMapPath =
TypedVirtualPath(file: moduleArtifactInfo.clangModuleMapPath.path,
type: .clangModuleMap)
inputs.append(clangModulePath)
inputs.append(clangModuleMapPath)
}

// Swift Main Module dependencies are passed encoded in a JSON file as described by
Expand Down Expand Up @@ -445,11 +440,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
let clangModulePath =
TypedVirtualPath(file: moduleArtifactInfo.clangModulePath.path,
type: .pcm)
let clangModuleMapPath =
TypedVirtualPath(file: moduleArtifactInfo.clangModuleMapPath.path,
type: .clangModuleMap)
inputs.append(clangModulePath)
inputs.append(clangModuleMapPath)
}

// Return if depscanner provided build commands.
Expand Down
10 changes: 1 addition & 9 deletions Tests/SwiftDriverTests/CachingBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ throws {
for command in extraCommandLine {
XCTAssertTrue(job.commandLine.contains(.flag(command)))
}
case .clang(let clangModuleDetails):
let moduleMapPath =
TypedVirtualPath(file: clangModuleDetails.moduleMapPath.path,
type: .clangModuleMap)
case .clang(_):
XCTAssertEqual(job.kind, .generatePCM)
XCTAssertEqual(job.description, "Compiling Clang module \(moduleId.moduleName)")
XCTAssertTrue(job.inputs.contains(moduleMapPath))
case .swiftPrebuiltExternal(_):
XCTFail("Unexpected prebuilt external module dependency found.")
case .swiftPlaceholder(_):
Expand Down Expand Up @@ -167,11 +163,7 @@ private func checkCachingBuildJobDependencies(job: Job,
let clangDependencyModulePathString = dependencyInfo.modulePath.path
let clangDependencyModulePath =
TypedVirtualPath(file: clangDependencyModulePathString, type: .pcm)
let clangDependencyModuleMapPath =
TypedVirtualPath(file: clangDependencyDetails.moduleMapPath.path,
type: .clangModuleMap)
XCTAssertTrue(job.inputs.contains(clangDependencyModulePath))
XCTAssertTrue(job.inputs.contains(clangDependencyModuleMapPath))
XCTAssertTrue(job.commandLine.contains(
.flag(String("-fmodule-file=\(dependencyId.moduleName)=\(clangDependencyModulePathString)"))))
XCTAssertTrue(job.commandLine.contains(
Expand Down
10 changes: 1 addition & 9 deletions Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,9 @@ throws {
}
XCTAssertTrue(job.commandLine.filter {$0 == .flag("-candidate-module-file")}.count == compiledCandidateList.count)
}
case .clang(let clangModuleDetails):
let moduleMapPath =
TypedVirtualPath(file: clangModuleDetails.moduleMapPath.path,
type: .clangModuleMap)
case .clang(_):
XCTAssertEqual(job.kind, .generatePCM)
XCTAssertEqual(job.description, "Compiling Clang module \(moduleId.moduleName)")
XCTAssertTrue(job.inputs.contains(moduleMapPath))
case .swiftPrebuiltExternal(_):
XCTFail("Unexpected prebuilt external module dependency found.")
case .swiftPlaceholder(_):
Expand Down Expand Up @@ -88,11 +84,7 @@ private func checkExplicitModuleBuildJobDependencies(job: Job,
let clangDependencyModulePathString = dependencyInfo.modulePath.path
let clangDependencyModulePath =
TypedVirtualPath(file: clangDependencyModulePathString, type: .pcm)
let clangDependencyModuleMapPath =
TypedVirtualPath(file: clangDependencyDetails.moduleMapPath.path,
type: .clangModuleMap)
XCTAssertTrue(job.inputs.contains(clangDependencyModulePath))
XCTAssertTrue(job.inputs.contains(clangDependencyModuleMapPath))
XCTAssertTrue(job.commandLine.contains(
.flag(String("-fmodule-file=\(dependencyId.moduleName)=\(clangDependencyModulePathString)"))))
XCTAssertTrue(job.commandLine.contains(
Expand Down