-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Use forwarding symlinks to reduce toolchain installation size #3276
Conversation
@swift-ci please smoke test |
@swift-ci please build toolchain |
717f5fd
to
274ddb6
Compare
@swift-ci please smoke test |
The macOS toolchain build is failing due to an unrelated issue, but I was able to get some concrete numbers by comparing the Ubuntu 16.04 toolchain to the 2/9 nightly snapshot: Compressed: Uncompressed With this change, we go from 5 to 1 68 MB executables, which lines up with the numbers here - the impact ended up being much larger than I expected |
This is awesome! |
this is great, thank you @owenv |
This looks great In the long run it might make sense to have It looks as if this doesn't change what gets built at debug time, which I don't think will be a problem but which we should maybe consider in a follow-on PR. |
Temporarily marking as un-reviewed so it doesn't get merged before hearing from other reviewers (want more eyes on this).
@owenv thanks again for putting together. we would need a bit of time before we can merge this, but will do ASAP |
@tomerd no problem! I'm in no rush to land this |
Yeah, I think there's a few different approaches we could take to clean this up. My one concern is that there might be external tools that are looking specifically for
I think the other executable targets are worth keeping around for now because they make manual testing much easier and they don't add much time to the build. |
Could the |
@benrimmington I'm not entirely sure if that would work, but I think it's unnecessary. We already ship other executables like |
I just wanted to follow up on this - is there any particular reason it can't be shipped with Swift 5.5/anything I can do to unblock it? |
apologies for the delay @owenv. we are waiting for the 5.5 branching to take changes that should land post 5.5 |
@swift-ci please smoke test |
thanks for your patience @owenv. 5.5 was just branched this weekend so we are finally ready to take this, @abertelrud can work with you to land |
This looks great, @owenv — thank you for your work on this and for your patience! It looks good to me, but I have a suggestion to simplify things even further: since I suggest the following simplification, which seems to work well in preliminary testing:
Then we still have just the one tool, and one symlink fewer (and SwiftPM target) fewer. When |
swift-build, swift-package, swift-test, swift-package-collection, and swift-run are now installed as symlinks to _swift-package-manager, which selects the correct tool based on the path used to invoke it.
@abertelrud sure, that makes sense to me. I dropped the underscored target, but kept the ones for swift-build, swift-test, etc. since they're still useful when not using the install action. |
@swift-ci please smoke test |
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.
This looks great. Thanks @owenv!
Absolutely, I did not mean to suggest removing the existing executables, only not adding the new underscored one. The existing ones are very useful during debug builds (in fact I use them all the time when working on SwiftPM in Xcode, using the scheme that's autocreated for each of them — and I suspect others use them in this was as well). Perhaps in the future once we can create arbitrary symlinks during a debug build (perhaps with a postbuild action) we'll be able to remove them, but that's a ways off. |
@owenv This looks ready to merge at this point. Thanks again! |
@abertelrud thanks for reviewing! There's no rush, but do you mind merging on my behalf, I don't have commit access to this repo |
Oh, right. Sure thing. Thanks again for your work here! |
swift-build, swift-package, swift-test, swift-package-collection, and swift-run are now installed as symlinks to _swift-package-manager, which selects the correct tool based on the path used to invoke it.
Motivation:
Reduce download & installation size of the Swift toolchain
Modifications:
Swift*Tool.main()
based on the path used to invoke it.Result: