Skip to content

Commit 3f4ce98

Browse files
committed
Include the whole ModuleDependenciesContext in the signature
1 parent 1bed53c commit 3f4ce98

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Sources/SWBCore/Dependencies.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
//
1111
//===----------------------------------------------------------------------===//
1212

13+
import Foundation
1314
public import SWBUtil
1415
import SWBMacro
1516

@@ -231,8 +232,7 @@ public struct ModuleDependenciesContext: Sendable, SerializableCodable {
231232
}
232233
}
233234

234-
func signatureData() -> String {
235-
let moduleNames = moduleDependencies.map { $0.name }
236-
return "validate:\(validate),modules:\(moduleNames.joined(separator: ":"))"
235+
func jsonData() throws -> Data {
236+
try JSONEncoder(outputFormatting: [.prettyPrinted, .sortedKeys, .withoutEscapingSlashes]).encode(self)
237237
}
238238
}

Sources/SWBCore/SpecImplementations/Tools/CCompiler.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,8 +1343,9 @@ public class ClangCompilerSpec : CompilerSpec, SpecIdentifierType, GCCCompatible
13431343
extraInputs = []
13441344
}
13451345

1346-
if let moduleDependenciesContext {
1347-
additionalSignatureData += moduleDependenciesContext.signatureData()
1346+
if let moduleDependenciesContext,
1347+
let signature = try? String(data: moduleDependenciesContext.jsonData(), encoding: .utf8) {
1348+
additionalSignatureData += "|\(signature)"
13481349
}
13491350

13501351
// Finally, create the task.

0 commit comments

Comments
 (0)