mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Fix a longstanding bug in the driver where the incremental build would
fail to execute dependent jobs and allow errors in primaries in later
waves to become buried. A simplified version of a situation that exposes
this bug has been committed into the tests.
Imagine two files:
```
// one.swift
struct A {}
// two.swift
func use() {
let _ = A()
}
```
After a clean build, we modify one.swift as follows:
```
// one.swift
struct B< {}
```
The syntax error in this file caused the baseline driver to fail the
build immediately and thus we would not schedule two.swift for
execution. This is incorrect! Consider correcting the syntax error in
one.swift:
```
// one.swift
struct B {}
```
two.swift _still_ won't be rebuilt because
1) It was never modified during any step of this process
2) The swiftdeps of two.swift have not been updated to flush out the
dependency on A.
rdar://72800626
30 lines
1.3 KiB
Swift
30 lines
1.3 KiB
Swift
// Establish baseline
|
|
|
|
// RUN: %empty-directory(%t)
|
|
// RUN: cp %S/Inputs/cross-file-failure/* %t
|
|
// RUN: cp %t/definesA{-one,}.swift
|
|
// RUN: touch -t 200101010101 %t/*.swift
|
|
// RUN: cd %t
|
|
|
|
// RUN: %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json >&output-baseline
|
|
|
|
// Change one type and cause a syntax error. This should cause _both_ files to
|
|
// rebuild.
|
|
|
|
// RUN: cp %t/definesA{-two,}.swift
|
|
// RUN: touch -t 200201010101 %t/*
|
|
// RUN: touch -t 200101010101 %t/*.swift
|
|
// RUN: touch -t 200301010101 %t/definesA.swift
|
|
|
|
// RUN: not %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json
|
|
|
|
// RUN: cp %t/definesA{-three,}.swift
|
|
// RUN: touch -t 200401010101 %t/definesA.swift
|
|
|
|
// RUN: not %target-swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesA.swift usesA.swift -module-name main -output-file-map ofm.json >&output-incremental
|
|
|
|
// RUN: %FileCheck -check-prefix=CHECK-RECOMPILED %s --dump-input=always < %t/output-incremental
|
|
|
|
// CHECK-RECOMPILED: Queuing (initial): {compile: definesA.o <= definesA.swift}
|
|
// CHECK-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesA.o <= usesA.swift}
|