|
| 1 | +// RUN: %empty-directory(%t) |
| 2 | +// RUN: cp -r %S/Inputs/external-cascade/* %t |
| 3 | + |
| 4 | +// rdar://problem/70012853 |
| 5 | +// XFAIL: OS=windows-msvc |
| 6 | + |
| 7 | +// |
| 8 | +// This test establishes a chain of modules that all depend on a set of |
| 9 | +// bridging headers. This test ensures that changes to external dependencies - |
| 10 | +// especially those that aren't directly imported - cause incremental rebuilds. |
| 11 | +// |
| 12 | +// |bridging-header.h| - Module C Module B Module A |
| 13 | +// ^ -------- -> -------- -> -------- |
| 14 | +// | | ^ |
| 15 | +// | | | |
| 16 | +// |another-header.h| ------------------------ |
| 17 | + |
| 18 | +// |
| 19 | +// Set up a clean incremental build of all three modules |
| 20 | +// |
| 21 | + |
| 22 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/C.swiftmodule -enable-experimental-cross-module-incremental-build -module-name C -I %t -output-file-map %t/C.json -working-directory %t -import-objc-header %t/bridging-header.h -Xfrontend -validate-tbd-against-ir=none -driver-show-incremental -driver-show-job-lifecycle %t/C.swift |
| 23 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/B.swiftmodule -enable-experimental-cross-module-incremental-build -module-name B -I %t -output-file-map %t/B.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle %t/B.swift |
| 24 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/A.swiftmodule -enable-experimental-cross-module-incremental-build -module-name A -I %t -output-file-map %t/A.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle %t/A.swift |
| 25 | + |
| 26 | +// |
| 27 | +// Now change a header and ensure that the rebuild cascades outwards |
| 28 | +// |
| 29 | + |
| 30 | +// RUN: rm %t/another-header.h |
| 31 | +// RUN: cp %S/Inputs/external-cascade/another-header.h %t/another-header.h |
| 32 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/C.swiftmodule -enable-experimental-cross-module-incremental-build -module-name C -I %t -output-file-map %t/C.json -working-directory %t -import-objc-header %t/bridging-header.h -Xfrontend -validate-tbd-against-ir=none -driver-show-incremental -driver-show-job-lifecycle %t/C.swift 2>&1 | %FileCheck -check-prefix MODULE-C %s |
| 33 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/B.swiftmodule -enable-experimental-cross-module-incremental-build -module-name B -I %t -output-file-map %t/B.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle %t/B.swift 2>&1 | %FileCheck -check-prefix MODULE-B %s |
| 34 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/A.swiftmodule -enable-experimental-cross-module-incremental-build -module-name A -I %t -output-file-map %t/A.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle %t/A.swift 2>&1 | %FileCheck -check-prefix MODULE-A %s |
| 35 | + |
| 36 | +// MODULE-C: Job finished: {generate-pch: bridging-header-[[BRIDGING_HEADER:.*]].pch <= bridging-header.h} |
| 37 | +// MODULE-C: Job finished: {compile: C.o <= C.swift bridging-header-[[BRIDGING_HEADER]].pch} |
| 38 | +// MODULE-C: Job finished: {merge-module: C.swiftmodule <= C.o} |
| 39 | + |
| 40 | +// MODULE-B: Queuing because of external dependencies: {compile: B.o <= B.swift} |
| 41 | +// MODULE-B: Job finished: {compile: B.o <= B.swift} |
| 42 | +// MODULE-B: Job finished: {merge-module: B.swiftmodule <= B.o} |
| 43 | + |
| 44 | + |
| 45 | +// MODULE-A: Queuing because of external dependencies: {compile: A.o <= A.swift} |
| 46 | +// MODULE-A: Job finished: {compile: A.o <= A.swift} |
| 47 | +// MODULE-A: Job finished: {merge-module: A.swiftmodule <= A.o} |
| 48 | + |
| 49 | +// |
| 50 | +// And ensure that the null build really is null. |
| 51 | +// |
| 52 | + |
| 53 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/C.swiftmodule -enable-experimental-cross-module-incremental-build -module-name C -I %t -output-file-map %t/C.json -working-directory %t -import-objc-header %t/bridging-header.h -Xfrontend -validate-tbd-against-ir=none -driver-show-incremental -driver-show-job-lifecycle %t/C.swift 2>&1 | %FileCheck -check-prefix MODULE-C-NULL %s |
| 54 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/B.swiftmodule -enable-experimental-cross-module-incremental-build -module-name B -I %t -output-file-map %t/B.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle %t/B.swift 2>&1 | %FileCheck -check-prefix MODULE-B-NULL %s |
| 55 | +// RUN: cd %t && %swiftc_driver -c -incremental -emit-dependencies -emit-module -emit-module-path %t/A.swiftmodule -enable-experimental-cross-module-incremental-build -module-name A -I %t -output-file-map %t/A.json -working-directory %t -driver-show-incremental -driver-show-job-lifecycle %t/A.swift 2>&1 | %FileCheck -check-prefix MODULE-A-NULL %s |
| 56 | + |
| 57 | +// MODULE-C-NULL: Job finished: {generate-pch: bridging-header-[[BRIDGING_HEADER:.*]].pch <= bridging-header.h} |
| 58 | +// MODULE-C-NULL: Job skipped: {compile: C.o <= C.swift bridging-header-[[BRIDGING_HEADER]].pch} |
| 59 | +// MODULE-C-NULL: Job skipped: {merge-module: C.swiftmodule <= C.o} |
| 60 | + |
| 61 | +// MODULE-B-NULL: Job skipped: {compile: B.o <= B.swift} |
| 62 | +// MODULE-B-NULL: Job skipped: {merge-module: B.swiftmodule <= B.o} |
| 63 | + |
| 64 | +// MODULE-A-NULL: Job skipped: {compile: A.o <= A.swift} |
| 65 | +// MODULE-A-NULL: Job skipped: {merge-module: A.swiftmodule <= A.o} |
0 commit comments