Skip to content

Commit 21f5032

Browse files
authored
Merge pull request #32032 from CodaFi/cascadia
Add a Regression Test For Scenario Improved By Private Dependencies
2 parents 9d322fe + 369b2ab commit 21f5032

File tree

7 files changed

+102
-0
lines changed

7 files changed

+102
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
struct Point {
2+
let x: Double
3+
let y: Double
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
struct Point {
2+
let x: Float
3+
let y: Float
4+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"main.swift": {
3+
"object": "./main.o",
4+
"swift-dependencies": "./main.swiftdeps"
5+
},
6+
"definesPoint.swift": {
7+
"object": "./definesPoint.o",
8+
"swift-dependencies": "./definesPoint.swiftdeps"
9+
},
10+
"usesPoint.swift": {
11+
"object": "./usesPoint.o",
12+
"swift-dependencies": "./usesPoint.swiftdeps"
13+
},
14+
"usesDisplay.swift": {
15+
"object": "./usesDisplay.o",
16+
"swift-dependencies": "./usesDisplay.swiftdeps"
17+
},
18+
"": {
19+
"swift-dependencies": "./main~buildrecord.swiftdeps"
20+
}
21+
}
22+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
struct Computer {
2+
let display: Display
3+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
struct Shape {
2+
let vertices: [Point]
3+
}
4+
5+
struct Display {
6+
let brand: Brand
7+
}
8+
9+
enum Brand {
10+
case apple
11+
case sun
12+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// =============================================================================
2+
// Without private dependencies
3+
// =============================================================================
4+
5+
// Establish status quo
6+
7+
// RUN: %empty-directory(%t)
8+
// RUN: cp %S/Inputs/superfluous-cascade/* %t
9+
// RUN: cp %t/definesPoint{-before,}.swift
10+
// RUN: touch -t 200101010101 %t/*.swift
11+
12+
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output1
13+
14+
// Change one type - the cascading edge causes us to rebuild everything but main
15+
16+
// RUN: cp %t/definesPoint{-after,}.swift
17+
// RUN: touch -t 200201010101 %t/*
18+
// RUN: touch -t 200101010101 %t/*.swift
19+
// RUN: touch -t 200301010101 %t/definesPoint.swift
20+
21+
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json >&output2
22+
23+
// RUN: %FileCheck -check-prefix=CHECK-STATUS-QUO-RECOMPILED %s < %t/output2
24+
25+
// CHECK-STATUS-QUO-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesPoint.o <= usesPoint.swift}
26+
// CHECK-STATUS-QUO-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesDisplay.o <= usesDisplay.swift}
27+
28+
29+
// =============================================================================
30+
// With private dependencies
31+
// =============================================================================
32+
33+
// Establish status quo
34+
35+
// RUN: %empty-directory(%t)
36+
// RUN: cp %S/Inputs/superfluous-cascade/* %t
37+
// RUN: cp %t/definesPoint{-before,}.swift
38+
// RUN: touch -t 200101010101 %t/*.swift
39+
40+
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -experimental-private-intransitive-dependencies >&output3
41+
42+
// Change one type - now only the user of that type rebuilds
43+
44+
// RUN: cp %t/definesPoint{-after,}.swift
45+
// RUN: touch -t 200201010101 %t/*
46+
// RUN: touch -t 200101010101 %t/*.swift
47+
// RUN: touch -t 200301010101 %t/definesPoint.swift
48+
49+
// RUN: cd %t && %swiftc_driver -enable-batch-mode -j2 -incremental -driver-show-incremental main.swift definesPoint.swift usesPoint.swift usesDisplay.swift -module-name main -output-file-map ofm.json -experimental-private-intransitive-dependencies >&output4
50+
51+
// RUN: %FileCheck -check-prefix=CHECK-PRIVATE-RECOMPILED %s --dump-input=always < %t/output4
52+
53+
// CHECK-PRIVATE-RECOMPILED: Queuing because of dependencies discovered later: {compile: usesPoint.o <= usesPoint.swift}
54+
// CHECK-PRIVATE-RECOMPILED-NOT: Queuing because of dependencies discovered later: {compile: usesDisplay.o <= usesDisplay.swift}
55+
56+

0 commit comments

Comments
 (0)