-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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-327] Add --outdir argument to swiftc #42949
Comments
We'd need something like this if we want to have incremental builds without having to write out a whole output file map. I'm not quite sure it's the right name because it's the directory used for intermediate files, not outputs, when swiftc is responsible for producing the output binary as well. |
Comment by Raphael (JIRA) Yes, please! @belkadan The we probably need one parameter for tmps and one for outputs? |
Interesting. I'm not sure there are many temporaries that don't make sense to persist in an incremental build, but I suppose we could support a separate directory for those. |
I'm interested in trying my hand at this task, if that's alright. I have a few questions:
|
Thanks to z (JIRA User), who informed me that there's a |
No, this is completely different from |
The only thing this should affect is calculating the paths of output files. |
OK, I think I understand. For my own clarification, though: is it possible that the original task was describing something like |
I don't think so. Note that in the original description |
Oooh, I see! Yes, thanks, I think I was misreading it. |
Additional Detail from JIRA
md5: ffc5d47714bb694b2a42adb551584a44
relates to:
Issue Description:
Currently swiftc writes all its output to current working directory. Please consider adding a --outdir argument so you can instruct swiftc to write its output to a different directory.
This makes it easier to integrate swiftc with other build systems. For example on Ninja you need to write all paths relative to the top level Ninja file directory. This leads to the weird situation that you need to manually cd into the output directory and invoke swiftc with paths that are different to what the Ninja file has.
As an example suppose you have a swift project with sources in Sources and you want to build in a directory called build and place the temporary files in a directory called build/tmpdir then you Ninja dependency looks [roughly] like this
executable [depends on] ../Sources/myexe.swift
but the compilation command is this:
cd tmpdir; swiftc -c ../../Sources/myexe.swift; cd ..
Note the extra '..' in the source file. This makes integration work needlessly complicated. With --outdir the command would look like this:
swiftc --outdir=tmpdir -c ../Sources/myexe.swift
The text was updated successfully, but these errors were encountered: