@@ -97,7 +97,7 @@ import class Dispatch.DispatchQueue
9797 else {
9898 return nil
9999 }
100- let currentArgsHash = Self . computeArgsHash ( parsedOptions)
100+ let currentArgsHash = BuildRecordArguments . computeHash ( parsedOptions)
101101 let compilationInputModificationDates =
102102 recordedInputModificationDates. filter { input, _ in
103103 input. type. isPartOfSwiftCompilation
@@ -113,16 +113,6 @@ import class Dispatch.DispatchQueue
113113 compilationInputModificationDates: compilationInputModificationDates)
114114 }
115115
116- private static func computeArgsHash( _ parsedOptionsArg: ParsedOptions
117- ) -> String {
118- var parsedOptions = parsedOptionsArg
119- let hashInput = parsedOptions
120- . filter { $0. option. affectsIncrementalBuild && $0. option. kind != . input}
121- . map { $0. description } // The description includes the spelling of the option itself and, if present, its argument(s).
122- . joined ( )
123- return SHA256 ( ) . hash ( hashInput) . hexadecimalRepresentation
124- }
125-
126116 /// Determine the input and output path for the build record
127117 private static func computeBuildRecordPath(
128118 outputFileMap: OutputFileMap ? ,
@@ -209,3 +199,15 @@ import class Dispatch.DispatchQueue
209199 buildRecordPath. parentDirectory
210200 }
211201}
202+
203+ public struct BuildRecordArguments {
204+ /// Compute a hash of the parsed options that affect incremental builds.
205+ public static func computeHash( _ parsedOptionsArg: ParsedOptions ) -> String {
206+ var parsedOptions = parsedOptionsArg
207+ let hashInput = parsedOptions
208+ . filter { $0. option. affectsIncrementalBuild && $0. option. kind != . input}
209+ . map { $0. description } // The description includes the spelling of the option itself and, if present, its argument(s).
210+ . joined ( )
211+ return SHA256 ( ) . hash ( hashInput) . hexadecimalRepresentation
212+ }
213+ }
0 commit comments