Skip to content

Driver: flip the flag of whether tracking system dependencies #28579

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
Dec 5, 2019

Conversation

nkcsgexi
Copy link
Contributor

@nkcsgexi nkcsgexi commented Dec 5, 2019

Tracking system dependencies should be the default setting so we always rebuild after
headers from SDK changes. We should also provide a way to opt-out so builders could reduce
the size of .d files if they are certain SDKs are stable.

rdar://57361722

@nkcsgexi nkcsgexi requested a review from DougGregor December 5, 2019 01:48
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Dec 5, 2019

@swift-ci Please Build Toolchain macOS Platform

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Dec 5, 2019

@swift-ci Please Build Toolchain macOS Platform

Copy link
Contributor

@varungandhi-apple varungandhi-apple left a comment

Choose a reason for hiding this comment

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

We should probably have -track-system-dependencies take an optional parameter that says true|false. Removing the flag would be a compatibility break. Also, is there a test case for the .d files and the system deps? Maybe this commit should include a small test case where we see that the size of the .d files does indeed reduce (also as a regression thing in case someone changes the defaults again in the future).

@@ -293,9 +293,9 @@ def profile_stats_entities: Flag<["-"], "profile-stats-entities">,
def emit_dependencies : Flag<["-"], "emit-dependencies">,
Flags<[FrontendOption, NoInteractiveOption, DoesNotAffectIncrementalBuild]>,
HelpText<"Emit basic Make-compatible dependencies files">;
def track_system_dependencies : Flag<["-"], "track-system-dependencies">,
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we can remove this flag so easily, that would be a breaking change.

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 understand the concern. However, it seems the build system doesn't specify this flag at all. Also, this driver flag never populates to front-end invocation flags, meaning even if some one specifies the flag, it doesn't change any behavior of the compiler. It should be pretty safe to remove the flag.

Copy link
Contributor

Choose a reason for hiding this comment

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

However, it seems the build system doesn't specify this flag at all.

I don't understand which build system are you referring to. Maybe we are not using it but someone external could very well be using it?

Also, this driver flag never populates to front-end invocation flags, meaning even if some one specifies the flag, it doesn't change any behavior of the compiler.

In that case, we should have the doc comment say something like "[Deprecated] We track system dependencies by default, so this flag doesn't do anything. If you want to avoid tracking system dependencies, use -skip-system-dependencies.". We could even add a warning saying that the flag is a no-op and asking the user to remove it.

I don't see what we gain by removing the flag -- we're potentially breaking someone's code for (IMO) no benefit at all.

@swift-ci
Copy link
Contributor

swift-ci commented Dec 5, 2019

macOS Toolchain
Download Toolchain
Git Sha - 3f6e06ea1dc5e01b2a9e0a16a6d0a4f7823d319f

Install command
tar -zxf swift-PR-28579-442-osx.tar.gz --directory ~/

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Dec 5, 2019

Using the CI-built toolchain, I've verified that .d files by default should now contain all .h dependencies from the SDK and users can get rid of these system dependencies by specifying -skip-system-dependencies

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Dec 5, 2019

Talking with @jrose-apple more about this, it seems risky to flip the flag at this point and the default value of NOT tracking system dependencies is consistent with Clang's behavior. So it seem the only bug worths fixing here is to pass down -track-system-dependencies from driver to front-end invocation.

@nkcsgexi nkcsgexi force-pushed the track-system-dependencies branch from 3f6e06e to 9b49a4c Compare December 5, 2019 19:33
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Dec 5, 2019

@swift-ci please smoke test

@nkcsgexi nkcsgexi merged commit 1e4912b into swiftlang:master Dec 5, 2019
@DougGregor
Copy link
Member

So the flag works but the driver wasn't passing it down?

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Dec 6, 2019

@DougGregor that's correct. The flag didn't pass down to front-end invocation from driver.

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.

4 participants