diff --git a/Sources/SwiftDriver/IncrementalCompilation/BuildRecordInfo.swift b/Sources/SwiftDriver/IncrementalCompilation/BuildRecordInfo.swift index 2e531dc88..126b680d3 100644 --- a/Sources/SwiftDriver/IncrementalCompilation/BuildRecordInfo.swift +++ b/Sources/SwiftDriver/IncrementalCompilation/BuildRecordInfo.swift @@ -97,7 +97,7 @@ import class Dispatch.DispatchQueue else { return nil } - let currentArgsHash = Self.computeArgsHash(parsedOptions) + let currentArgsHash = BuildRecordArguments.computeHash(parsedOptions) let compilationInputModificationDates = recordedInputModificationDates.filter { input, _ in input.type.isPartOfSwiftCompilation @@ -113,16 +113,6 @@ import class Dispatch.DispatchQueue compilationInputModificationDates: compilationInputModificationDates) } - private static func computeArgsHash(_ parsedOptionsArg: ParsedOptions - ) -> String { - var parsedOptions = parsedOptionsArg - let hashInput = parsedOptions - .filter { $0.option.affectsIncrementalBuild && $0.option.kind != .input} - .map { $0.description } // The description includes the spelling of the option itself and, if present, its argument(s). - .joined() - return SHA256().hash(hashInput).hexadecimalRepresentation - } - /// Determine the input and output path for the build record private static func computeBuildRecordPath( outputFileMap: OutputFileMap?, @@ -209,3 +199,15 @@ import class Dispatch.DispatchQueue buildRecordPath.parentDirectory } } + +public struct BuildRecordArguments { + /// Compute a hash of the parsed options that affect incremental builds. + public static func computeHash(_ parsedOptionsArg: ParsedOptions) -> String { + var parsedOptions = parsedOptionsArg + let hashInput = parsedOptions + .filter { $0.option.affectsIncrementalBuild && $0.option.kind != .input} + .map { $0.description } // The description includes the spelling of the option itself and, if present, its argument(s). + .joined() + return SHA256().hash(hashInput).hexadecimalRepresentation + } +}