Skip to content

Add a Test Demonstrating Superfluous Cascading Across Module Boundaries #32122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extension Map {
func pin() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"main.swift": {
"object": "./main.o",
"swift-dependencies": "./main.swiftdeps"
},
"usesLib.swift": {
"object": "./usesLib.o",
"swift-dependencies": "./usesLib.swiftdeps"
},
"usesLibTransitively.swift": {
"object": "./usesLib.o",
"swift-dependencies": "./usesLib.swiftdeps"
},
"doesNotUseLib.swift": {
"object": "./doesNotUseLib.o",
"swift-dependencies": "./doesNotUseLib.swiftdeps"
},
"": {
"swift-dependencies": "./main~buildrecord.swiftdeps"
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
public struct Library {
var catalog: [Book]
}

public struct Book {
var title: String
var checkOutCount: Int
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
public struct Library {
var catalog: [Book]
}

public struct Book {
var title: String
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"lib.swift": {
"object": "./lib.o",
"swift-dependencies": "./lib.swiftdeps"
},
"": {
"swift-dependencies": "./submodule~buildrecord.swiftdeps"
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Lib

public struct District {
var libraries: [Library]
}

struct Map {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct County {
var districts: [District]
}
39 changes: 39 additions & 0 deletions test/Incremental/superfluous-cascade-across-modules.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// =============================================================================
// Without private dependencies
// =============================================================================

// First, build a submodule

// RUN: %empty-directory(%t)
// RUN: cp %S/Inputs/superfluous-cascade-across-modules/*.swift %t
// RUN: cp %S/Inputs/superfluous-cascade-across-modules/*.json %t

// RUN: %target-build-swift %S/Inputs/superfluous-cascade-across-modules/submodule/lib-before.swift -emit-module -emit-library -module-name Lib -module-link-name Lib -emit-module-path %t/Lib.swiftmodule -o %t/%target-library-name(Lib)

// Build the main executable that depends on the submodule we just built

// RUN: cd %t && %swiftc_driver -emit-module -enable-batch-mode -j2 -incremental -driver-show-incremental -I %t -L %t -lLib -module-name main \
// RUN: -output-file-map ofm.json \
// RUN: main.swift \
// RUN: doesNotUseLib.swift \
// RUN: usesLib.swift \
// RUN: usesLibTransitively.swift >&output1

// Rebuild the submodule

// RUN: %target-build-swift %S/Inputs/superfluous-cascade-across-modules/submodule/lib-after.swift -emit-module -emit-library -module-name Lib -module-link-name Lib -emit-module-path %t/Lib.swiftmodule -o %t/%target-library-name(Lib)

// Rebuild the main executable

// RUN: cd %t && %swiftc_driver -emit-module -enable-batch-mode -j2 -incremental -driver-show-incremental -I %t -L %t -lLib -module-name main \
// RUN: -output-file-map ofm.json \
// RUN: main.swift \
// RUN: doesNotUseLib.swift \
// RUN: usesLib.swift \
// RUN: usesLibTransitively.swift >&output2

// RUN: %FileCheck -check-prefix=CHECK-STATUS-QUO-RECOMPILED %s < %t/output2

// CHECK-STATUS-QUO-RECOMPILED-DAG: Queuing because of external dependencies: {compile: main
// CHECK-STATUS-QUO-RECOMPILED-DAG: Queuing because of external dependencies: {compile: usesLib
// CHECK-STATUS-QUO-RECOMPILED-DAG: Queuing because of external dependencies: {compile: doesNotUseLib