Skip to content

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

Closed
wants to merge 3 commits into from

Conversation

CodaFi
Copy link
Contributor

@CodaFi CodaFi commented Mar 3, 2021

Resync the options flag and drop the experimental cross-module incremental build terminology. The flags are sync'd to ToT Swift at swiftlang/swift#36254.

CodaFi added 3 commits March 3, 2021 10:18
This also requires an inversion of polarity to better match the interface expected by the Swift frontend, which has incremental imports enabled by default. We therefore consider the "disable" form to be the positive, and the "enable" form to be the negative with respect to feature enablement.
@CodaFi CodaFi requested a review from davidungar March 3, 2021 18:33
@CodaFi
Copy link
Contributor Author

CodaFi commented Mar 3, 2021

@swift-ci test

negative: .enableIncrementalImports,
default: false) {
options.formUnion(.disableIncrementalImports)
} else {
options.formUnion(.readPriorsFromModuleDependencyGraph)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@davidungar If you'd like, I can also flip the polarity on readPriorsFromModuleDependencyGraph to be something like readPriorsFromSourceFileDependencyGraphs

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this. I think there is one critical issue:
let enablingOrDisabling = options.contains(.disableIncrementalImports)

And in a few places, IMO it would be clearer to use the bit for the positive, even if the positive is the default. (You'll see it in my comments). But that's not an essential change.

let enablingOrDisabling = options.contains(.enableCrossModuleIncrementalBuild)
? "Enabling"
: "Disabling"
let enablingOrDisabling = options.contains(.disableIncrementalImports)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! my bad

Comment on lines +390 to +397
/// 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a similar comment-rewording for the enable flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 Options(rawValue: ~(1 << 4))

@@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Comment on lines +160 to +162
if self.parsedOptions.hasFlag(positive: .disableIncrementalImports,
negative: .enableIncrementalImports,
default: false) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it be clearer to write positive: .enableIncrementalImports, negative: .disableIncrementalImports, default: true

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would still like to be positive, though.

@CodaFi
Copy link
Contributor Author

CodaFi commented Mar 3, 2021

Will try to re-invert this bit but use terminology that isn't enable/disable to help.

@CodaFi CodaFi closed this May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants