File tree Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Expand file tree Collapse file tree 3 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -648,7 +648,7 @@ extension TSCBasic.FileSystem {
648
648
try resolvingVirtualPath ( path, apply: exists)
649
649
}
650
650
651
- func lastModificationTime( for file: VirtualPath ) throws -> Date {
651
+ public func lastModificationTime( for file: VirtualPath ) throws -> Date {
652
652
try resolvingVirtualPath ( file) { path in
653
653
#if os(macOS)
654
654
var s = Darwin . stat ( )
Original file line number Diff line number Diff line change @@ -281,6 +281,16 @@ public final class MultiJobExecutor {
281
281
282
282
context. reportSkippedJobs ( )
283
283
284
+ // Check for any inputs that were modified during the build. Report these
285
+ // as errors so we don't e.g. reuse corrupted incremental build state.
286
+ for (input, recordedModTime) in context. recordedInputModificationDates {
287
+ guard try fileSystem. lastModificationTime ( for: input. file) == recordedModTime else {
288
+ let err = Job . InputError. inputUnexpectedlyModified ( input)
289
+ context. diagnosticsEngine. emit ( err)
290
+ throw err
291
+ }
292
+ }
293
+
284
294
// Throw the stub error the build didn't finish successfully.
285
295
if !result. success {
286
296
throw Diagnostics . fatalError
@@ -535,8 +545,6 @@ class ExecuteJobRule: LLBuildRule {
535
545
let arguments : [ String ] = try resolver. resolveArgumentList ( for: job,
536
546
forceResponseFiles: context. forceResponseFiles)
537
547
538
- try job. verifyInputsNotModified ( since: context. recordedInputModificationDates, fileSystem: engine. fileSystem)
539
-
540
548
let process = try context. processType. launchProcess (
541
549
arguments: arguments, env: env
542
550
)
Original file line number Diff line number Diff line change @@ -323,9 +323,12 @@ final class JobExecutorTests: XCTestCase {
323
323
$0 <<< " let bar = 3 "
324
324
}
325
325
326
- // FIXME: It's unfortunate we diagnose this twice, once for each job which uses the input.
327
- verifier. expect ( . error( " input file ' \( other. description) ' was modified during the build " ) )
328
326
verifier. expect ( . error( " input file ' \( other. description) ' was modified during the build " ) )
327
+ // There's a tool-specific linker error that usually happens here from
328
+ // whatever job runs last - probably the linker.
329
+ // It's no use testing for a particular error message, let's just make
330
+ // sure we emit the diagnostic we need.
331
+ verifier. permitUnexpected ( . error)
329
332
XCTAssertThrowsError ( try driver. run ( jobs: jobs) )
330
333
}
331
334
}
You can’t perform that action at this time.
0 commit comments