Skip to content

Commit 3946977

Browse files
authored
Merge pull request swiftlang#34251 from CodaFi/walking-externalities
Ensure Changes to External Dependencies Cascade
2 parents 4e8ed24 + 4099ddf commit 3946977

File tree

9 files changed

+108
-0
lines changed

9 files changed

+108
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"A.swift": {
3+
"object": "./A.o",
4+
"swift-dependencies": "./A.swiftdeps",
5+
"swiftmodule": "./A~partial.swiftmodule",
6+
"swiftdoc": "./A.swiftdoc",
7+
},
8+
"": {
9+
"swift-dependencies": "./A~buildrecord.swiftdeps"
10+
}
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import B
2+
3+
public let fromA = fromB
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"B.swift": {
3+
"object": "./B.o",
4+
"swift-dependencies": "./B.swiftdeps",
5+
"swiftmodule": "./B~partial.swiftmodule",
6+
"swiftdoc": "./B.swiftdoc",
7+
},
8+
"": {
9+
"swift-dependencies": "./B~buildrecord.swiftdeps"
10+
}
11+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import C
2+
3+
public let fromB = fromC
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"C.swift": {
3+
"object": "./C.o",
4+
"swift-dependencies": "./C.swiftdeps",
5+
"swiftmodule": "./C~partial.swiftmodule",
6+
"swiftdoc": "./C.swiftdoc",
7+
},
8+
"": {
9+
"swift-dependencies": "./C~buildrecord.swiftdeps"
10+
}
11+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
public let fromC = ASymbolFromAHeader + ASymbolFromAnotherHeader
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
int ASymbolFromAnotherHeader = 43;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include "another-header.h"
2+
int ASymbolFromAHeader = 42;
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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

Comments
 (0)