Skip to content

Commit ba6efef

Browse files
author
David Ungar
committed
add isCrossModuleIncrementalBuildEnabled, but do nothing with it yet
Fix tests after extra message
1 parent 769f577 commit ba6efef

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

Sources/SwiftDriver/IncrementalCompilation/IncrementalCompilationState.swift

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ import TSCBasic
1313
import Foundation
1414
import SwiftOptions
1515
public class IncrementalCompilationState {
16+
/// Whether cross-module incrementality is enabled
17+
private let isCrossModuleIncrementalBuildEnabled: Bool
18+
1619
/// The oracle for deciding what depends on what. Applies to this whole module.
1720
private let moduleDependencyGraph: ModuleDependencyGraph
1821

@@ -56,6 +59,11 @@ public class IncrementalCompilationState {
5659
self.reporter = nil
5760
}
5861

62+
self.isCrossModuleIncrementalBuildEnabled =
63+
driver.parsedOptions.contains(.enableExperimentalCrossModuleIncrementalBuild)
64+
reporter?.report(
65+
"\(self.isCrossModuleIncrementalBuildEnabled ? "Enabling" : "Disabling") incremental cross-module building")
66+
5967

6068
guard let (outputFileMap, buildRecordInfo, outOfDateBuildRecord)
6169
= try driver.getBuildInfo(self.reporter)
@@ -66,13 +74,12 @@ public class IncrementalCompilationState {
6674
guard let (
6775
moduleDependencyGraph,
6876
inputsHavingMalformedDependencySources: inputsHavingMalformedDependencySources
69-
) =
70-
Self.computeModuleDependencyGraph(
71-
buildRecordInfo,
72-
outOfDateBuildRecord,
73-
outputFileMap,
74-
&driver,
75-
self.reporter)
77+
) = Self.computeModuleDependencyGraph(
78+
buildRecordInfo,
79+
outOfDateBuildRecord,
80+
outputFileMap,
81+
&driver,
82+
self.reporter)
7683
else {
7784
return nil
7885
}

Tests/SwiftDriverTests/IncrementalCompilationTests.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ final class IncrementalCompilationTests: XCTestCase {
431431
// Leave off the part after the colon because it varies on Linux:
432432
// MacOS: The operation could not be completed. (TSCBasic.FileSystemError error 3.).
433433
// Linux: The operation couldn’t be completed. (TSCBasic.FileSystemError error 3.)
434+
"Disabling incremental cross-module building",
434435
"Incremental compilation: Incremental compilation could not read build record at",
435436
"Incremental compilation: Disabling incremental build: could not read build record",
436437
"Found 2 batchable jobs",
@@ -450,6 +451,7 @@ final class IncrementalCompilationTests: XCTestCase {
450451
"no-change",
451452
checkDiagnostics: checkDiagnostics,
452453
expectingRemarks: [
454+
"Disabling incremental cross-module building",
453455
"Incremental compilation: May skip current input: {compile: main.o <= main.swift}",
454456
"Incremental compilation: May skip current input: {compile: other.o <= other.swift}",
455457
"Incremental compilation: Skipping input: {compile: main.o <= main.swift}",
@@ -465,6 +467,7 @@ final class IncrementalCompilationTests: XCTestCase {
465467
"non-propagating",
466468
checkDiagnostics: checkDiagnostics,
467469
expectingRemarks: [
470+
"Disabling incremental cross-module building",
468471
"Incremental compilation: May skip current input: {compile: main.o <= main.swift}",
469472
"Incremental compilation: Scheduing changed input {compile: other.o <= other.swift}",
470473
"Incremental compilation: Queuing (initial): {compile: other.o <= other.swift}",
@@ -489,6 +492,7 @@ final class IncrementalCompilationTests: XCTestCase {
489492
"non-propagating, both touched",
490493
checkDiagnostics: checkDiagnostics,
491494
expectingRemarks: [
495+
"Disabling incremental cross-module building",
492496
"Incremental compilation: Scheduing changed input {compile: main.o <= main.swift}",
493497
"Incremental compilation: Scheduing changed input {compile: other.o <= other.swift}",
494498
"Incremental compilation: Queuing (initial): {compile: main.o <= main.swift}",
@@ -514,6 +518,7 @@ final class IncrementalCompilationTests: XCTestCase {
514518
"propagating into 2nd wave",
515519
checkDiagnostics: checkDiagnostics,
516520
expectingRemarks: [
521+
"Disabling incremental cross-module building",
517522
"Incremental compilation: Scheduing changed input {compile: main.o <= main.swift}",
518523
"Incremental compilation: May skip current input: {compile: other.o <= other.swift}",
519524
"Incremental compilation: Queuing (initial): {compile: main.o <= main.swift}",
@@ -548,6 +553,7 @@ final class IncrementalCompilationTests: XCTestCase {
548553
checkDiagnostics: checkDiagnostics,
549554
extraArguments: [extraArgument],
550555
expectingRemarks: [
556+
"Disabling incremental cross-module building",
551557
"Incremental compilation: May skip current input: {compile: other.o <= other.swift}",
552558
"Incremental compilation: Queuing (initial): {compile: main.o <= main.swift}",
553559
"Incremental compilation: scheduling dependents of main.swift; -driver-always-rebuild-dependents",

0 commit comments

Comments
 (0)