Skip to content

[CMake] Temporarily workaround CMake dependencies bug #62129

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
Nov 17, 2022

Conversation

bnbarham
Copy link
Contributor

Workaround a CMake bug in order to make sure that ASTGen is rebuilt when the swift-syntax dependencies change.

Workaround a CMake bug in order to make sure that ASTGen is rebuilt when
the swift-syntax dependencies change.
@bnbarham bnbarham force-pushed the fix-syntax-dependencies branch from 43a5b01 to fa43760 Compare November 17, 2022 00:17
@bnbarham
Copy link
Contributor Author

@bnbarham bnbarham merged commit 6f716a5 into swiftlang:main Nov 17, 2022
@bnbarham bnbarham deleted the fix-syntax-dependencies branch November 17, 2022 22:25
@drodriguez
Copy link
Contributor

I think this workaround has a little problem, but I am not completely sure.

Because the files are empty, it seems that the Swift compilation does not touch the .o files that results from them. This means that when SwiftSyntax is changed, the files will be touched, which will dirty the target, but because Swift does not update the mtime of the .o files the target will always be out-of-date and will be rebuilt all the time. Since this library is part of the compiler, this produces a cascading recompilation of almost all the compiler and the standard library. This is very disrupting when just modifying some test files, since it will rebuilt a large number of files, killing iteration time.

One solution is adding another command that removes the .o files (maybe others), but since the file structure in the build directory are not "public API", I am not sure about this solution being correct.

@bnbarham
Copy link
Contributor Author

Because the files are empty, it seems that the Swift compilation does not touch the .o files that results from them.

This is a problem in general, ie. if there's a change that doesn't impact the .o file, it will continually be rebuilt. So even without this change, that was already the case for swift-syntax. It's "just" that now this cascades out further.

One solution is adding another command that removes the .o files (maybe others), but since the file structure in the build directory are not "public API", I am not sure about this solution being correct.

I think I never looked into doing this because just removing the .o files isn't enough without the workaround - the library would be different, but dependents still wouldn't be rebuilt as from CMake's perspective there isn't any reason to.

But, seems like we could do both. I'll try remove the .o's in the prebuild and see how that goes.

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.

3 participants