-
Notifications
You must be signed in to change notification settings - Fork 206
Use 'Incremental Imports' Terminology #523
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,11 +56,11 @@ public class IncrementalCompilationState { | |
self.reporter = nil | ||
} | ||
|
||
let enablingOrDisabling = options.contains(.enableCrossModuleIncrementalBuild) | ||
? "Enabling" | ||
: "Disabling" | ||
let enablingOrDisabling = options.contains(.disableIncrementalImports) | ||
? "Disabling" | ||
: "Enabling" | ||
reporter?.report( | ||
"\(enablingOrDisabling) incremental cross-module building") | ||
"\(enablingOrDisabling) incremental imports") | ||
|
||
|
||
guard let outputFileMap = driver.outputFileMap else { | ||
|
@@ -120,8 +120,8 @@ extension IncrementalCompilationState { | |
/// When this information is combined with the output file map, swiftdeps | ||
/// files can be located and loaded into the graph. | ||
/// | ||
/// In a cross-module build, the dependency graph is derived from prior | ||
/// state that is serialized alongside the build record. | ||
/// In a build that is aware of incremental imports, the dependency graph is | ||
/// derived from prior state that is serialized alongside the build record. | ||
let graph: ModuleDependencyGraph | ||
/// The set of compile jobs we can definitely skip given the state of the | ||
/// incremental dependency graph and the status of the input files for this | ||
|
@@ -382,18 +382,19 @@ extension IncrementalCompilationState { | |
/// After integrating each source file dependency graph into the driver's | ||
/// module dependency graph, dump a dot file to the current working | ||
/// directory showing the state of the driver's dependency graph. | ||
/// | ||
/// FIXME: This option is not yet implemented. | ||
public static let emitDependencyDotFileAfterEveryImport = Options(rawValue: 1 << 2) | ||
/// After integrating each source file dependency graph, verifies the | ||
/// integrity of the driver's dependency graph and aborts if any errors | ||
/// are detected. | ||
public static let verifyDependencyGraphAfterEveryImport = Options(rawValue: 1 << 3) | ||
/// Enables the cross-module incremental build infrastructure. | ||
/// Disables the cross-module incremental build infrastructure by forcing | ||
/// the incremental build to ignore dependency information embedded in | ||
/// swiftmodule files. | ||
/// | ||
/// FIXME: This option is transitory. We intend to make this the | ||
/// default behavior. This option should flip to a "disable" bit after that. | ||
public static let enableCrossModuleIncrementalBuild = Options(rawValue: 1 << 4) | ||
/// Using this flag pessimizes the incremental compilation session by forcing | ||
/// the driver to only consider changes to the modification time of imported | ||
/// swiftmodules, which necessarily requires cascading rebuilds. | ||
public static let disableIncrementalImports = Options(rawValue: 1 << 4) | ||
Comment on lines
+390
to
+397
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should there be a similar comment-rewording for the enable flag? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you mean here. The opposite of this flag is |
||
/// Enables an optimized form of start-up for the incremental build state | ||
/// that reads the dependency graph from a serialized format on disk instead | ||
/// of reading O(N) swiftdeps files. | ||
|
@@ -405,9 +406,9 @@ extension IncrementalCompilationState { | |
|
||
extension IncrementalCompilationState { | ||
@_spi(Testing) public func writeDependencyGraph() { | ||
// If the cross-module build is not enabled, the status quo dictates we | ||
// If incremental imports not enabled, the status quo dictates we | ||
// not emit this file. | ||
guard moduleDependencyGraph.info.isCrossModuleIncrementalBuildEnabled else { | ||
if moduleDependencyGraph.info.areIncrementalImportsDisabled { | ||
return | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ extension IncrementalCompilationState { | |
@_spi(Testing) public let diagnosticEngine: DiagnosticsEngine | ||
@_spi(Testing) public let readPriorsFromModuleDependencyGraph: Bool | ||
@_spi(Testing) public let alwaysRebuildDependents: Bool | ||
@_spi(Testing) public let isCrossModuleIncrementalBuildEnabled: Bool | ||
@_spi(Testing) public let areIncrementalImportsDisabled: Bool | ||
@_spi(Testing) public let verifyDependencyGraphAfterEveryImport: Bool | ||
@_spi(Testing) public let emitDependencyDotFileAfterEveryImport: Bool | ||
|
||
|
@@ -69,7 +69,7 @@ extension IncrementalCompilationState { | |
self.readPriorsFromModuleDependencyGraph = maybeBuildRecord != nil && | ||
options.contains(.readPriorsFromModuleDependencyGraph) | ||
self.alwaysRebuildDependents = options.contains(.alwaysRebuildDependents) | ||
self.isCrossModuleIncrementalBuildEnabled = options.contains(.enableCrossModuleIncrementalBuild) | ||
self.areIncrementalImportsDisabled = options.contains(.disableIncrementalImports) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I tend to favor the bit being true when the feature is enabled. |
||
self.verifyDependencyGraphAfterEveryImport = options.contains(.verifyDependencyGraphAfterEveryImport) | ||
self.emitDependencyDotFileAfterEveryImport = options.contains(.emitDependencyDotFileAfterEveryImport) | ||
self.buildTime = maybeBuildRecord?.buildTime ?? .distantPast | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -152,12 +152,19 @@ extension Driver { | |
if self.parsedOptions.contains(veriOpt) { | ||
options.formUnion(.verifyDependencyGraphAfterEveryImport) | ||
} | ||
if self.parsedOptions.hasFlag(positive: .enableIncrementalImports, | ||
negative: .disableIncrementalImports, | ||
default: true) { | ||
options.formUnion(.enableCrossModuleIncrementalBuild) | ||
|
||
// Propagate the disable flag for cross-module incremental builds | ||
// if necessary. Note because we're interested in *disabling* this feature, | ||
// we consider the disable form to be the positive and enable to be the | ||
// negative. | ||
if self.parsedOptions.hasFlag(positive: .disableIncrementalImports, | ||
negative: .enableIncrementalImports, | ||
default: false) { | ||
Comment on lines
+160
to
+162
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't it be clearer to write |
||
options.formUnion(.disableIncrementalImports) | ||
} else { | ||
options.formUnion(.readPriorsFromModuleDependencyGraph) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @davidungar If you'd like, I can also flip the polarity on |
||
} | ||
|
||
return options | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if options contains both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the bitflags, not the parsed options.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! my bad