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
[SR-7982] Swift build forces recompilation with Makefile #5353
Comments
This happens because we add color diagnostics flag depending on whether the terminal is tty or not. We need to remove that flag from the command signature. |
Comment by Andreas Wendleder (JIRA) Would it be acceptable to remove all occurrences of Color in swift-package-manager/Sources/Basic/TerminalController.swift? |
Comment by Andreas Wendleder (JIRA) This is still not resolved with Xcode 10.2 and Swift 5.0. |
@aciidb0mb3r any idea why swiftc rebuilds in this case? Shouldn't it be up to swiftc to no-op even if swiftpm / llbuild ask for it to build again? |
@belkadan might know about that. |
The |
I've submitted apple/swift#24144 and #2099 for this |
The swiftc change is merged and the swiftpm change is ready but waiting so swiftpm still works with Xcode for the time being |
Looks like this is all merged through. Is it ready to be marked Resolved? |
#2103 Still needs to be merged |
Comment by Andreas Wendleder (JIRA) Doesn't work in 5.1. 🙁 |
Comment by Andreas Wendleder (JIRA) Doesn't work in 5.2. |
andreasw (JIRA User) how are you validating if this is fixed or not? It looks to me at this point like it is, I'm testing by using `swift build -v` from a terminal, and then from a makefile. There is still a problem (which we can repurpose this bug for, or create a new one) where any change in environment variables seems to cause swiftpm to re-process the Package.swift files from all dependencies, which does still take some extra time, but it doesn't necessarily re-build anything in that case (unless the env var change actually has an affect on the output). That issue might also not be a trivial solve since Package.swift files can contain arbitrary logic around this. |
Comment by Andreas Wendleder (JIRA) Exactly as specified in the bug report; since executing make from within vim via ":m" is not a terminal everything is recompiled.
|
When you say "everything is recompiled" how are you determining this part? Here's an example of the behavior I see now with Swift 5.2: 1. Have a makefile with `swift build -v` The fact that it's running any commands at all is 2 fold: 1. Re my comment above, any change in env vars will cause Package.swift files to be recomputed, likely these change between make, shell, and vim (unless you call `swift build` with `env -i` )
Adds the `-color-diagnostics` are only in the shell without pipe case, but since my original swiftc changes, this doesn't cause a full-recompile. So tl;dr AFAICT things aren't being recompiled here (besides the module being re-merged) but there is more noise in the logs, and arguably more things happening, than there should be |
Comment by Andreas Wendleder (JIRA) To be precise: A simple hello world works as expected.Compiling my project with "-c debug" works as expected.Compiling my project with "-c release" which has dependencies in Package.swift and options like "-Xswiftc -Ounchecked" recompiles in vim (or a make after vim :m).
Besides, verbose output swift without recompilation looks like this
|
Interesting, I wonder if this reproduces differently on macOS (where I was testing) and linux. |
Comment by Andreas Wendleder (JIRA) I have a medium sized project with one dependency. I have a Makefile which basically does a "swift build". I often type "make|head" to see the first error. Every time the dependency is merged and often the whole project is recompiled. This is very annoying. In addition, typing "make" (without the pipe) recompiles everything always as does compiling within vim with ":make". |
Comment by Andreas Wendleder (JIRA) Even more annoying: I have a "test" goal in my Makefile which just runs my app and which depends on the build. Even if i just typed "make" to compile and then "make test" to see the output of my app, everything is recompiled! |
Environment
Ubuntu 18.04, Swift 4.2 dev.
Additional Detail from JIRA
md5: b246f9ef9446cfcc35be81e5733a0227
Issue Description:
I have a simple Makefile for building:
After typing "make" the expected happens, the swift file is compiled.
After a second "make" the expected happens again, nothing is compiled.
Opening vim and typing ":make" I expected that nothing happens but the file is recompiled.
After a second ":make" in vim this time the expected happens again and nothing is compiled.
But if you close vim and type "make" again, the file has to be compiled again.
The text was updated successfully, but these errors were encountered: