Skip to content

Commit

Permalink
[Explicit Module Builds] Use Clang dependencys' contextHash as part…
Browse files Browse the repository at this point in the history
… of its filename-encoded hash
  • Loading branch information
artemcm committed Sep 7, 2021
1 parent a1ff162 commit 173b1bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Expand Up @@ -224,7 +224,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
let targetEncodedModulePath =
try targetEncodedClangModuleFilePath(for: moduleInfo,
hashParts: getPCMHashParts(pcmArgs: pcmArgs,
moduleMapPath: moduleMapPath.description))
contextHash: moduleDetails.contextHash))
outputs.append(TypedVirtualPath(file: targetEncodedModulePath, type: .pcm))
commandLine.appendFlags("-emit-pcm", "-module-name", moduleId.moduleName,
"-o", targetEncodedModulePath.description)
Expand Down Expand Up @@ -328,7 +328,7 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
let clangModulePath =
try targetEncodedClangModuleFilePath(for: dependencyInfo,
hashParts: getPCMHashParts(pcmArgs: pcmArgs,
moduleMapPath: moduleMapPath.description))
contextHash: dependencyClangModuleDetails.contextHash))
// Accumulate the requried information about this dependency
clangDependencyArtifacts.append(
ClangModuleArtifactInfo(name: dependencyId.moduleName,
Expand Down Expand Up @@ -393,9 +393,9 @@ public typealias ExternalTargetModuleDetailsMap = [ModuleDependencyId: ExternalT
return VirtualPath.createUniqueTemporaryFileWithKnownContents(.init("\(moduleId.moduleName)-dependencies.json"), contents)
}

private func getPCMHashParts(pcmArgs: [String], moduleMapPath: String) -> [String] {
private func getPCMHashParts(pcmArgs: [String], contextHash: String) -> [String] {
var results: [String] = []
results.append(moduleMapPath)
results.append(contextHash)
results.append(contentsOf: pcmArgs)
if integratedDriver {
return results
Expand Down
4 changes: 2 additions & 2 deletions Tests/SwiftDriverTests/ExplicitModuleBuildTests.swift
Expand Up @@ -270,8 +270,8 @@ final class ExplicitModuleBuildTests: XCTestCase {
let moduleDetails = try? dependencyGraph.clangModuleDetails(of: .clang(moduleName))
let lookupHashParts: [String]
if let details = moduleDetails {
let moduleMapPath = details.moduleMapPath.path.description
lookupHashParts = [moduleMapPath] + hashParts
let contextHash = details.contextHash
lookupHashParts = [contextHash] + hashParts
} else {
// No such module found, no modulemap
lookupHashParts = hashParts
Expand Down

0 comments on commit 173b1bb

Please sign in to comment.