-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix response file support for batch jobs. #24008
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
Fix response file support for batch jobs. #24008
Conversation
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.
It's a worthy goal. Let me know about my suggestions.
lib/Driver/ToolChain.cpp
Outdated
@@ -62,6 +62,27 @@ ToolChain::JobContext::getTemporaryFilePath(const llvm::Twine &name, | |||
return C.getArgs().MakeArgString(buffer.str()); | |||
} | |||
|
|||
ToolChain::ResponseFileInfo ToolChain::getResponseFileInfoIfNeeded( |
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.
Why not return an Optional? Wherever ResponseFileInfo is used and the pointers might be null, you could use the optional type. That would ensure that the next maintainer doesn't forget the null checks.
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.
Good call. I originally did that, but it didn't seem worth it because I didn't also change the Job
constructor signature to use it, so the call sites actually became more complicated. After passing the optional throughout Job
/BatchJob
as well, it came out much cleaner.
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.
Cool!
include/swift/Driver/ToolChain.h
Outdated
struct ResponseFileInfo { | ||
/// The path to the response file that a job should use, or null if no | ||
/// response file is needed. | ||
const char *responseFilePath; |
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.
I'm not sure about this, but would std:string work better for these?
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.
(Addressed in the other comment about std::string
.)
ac19ccc
to
6d72230
Compare
Is there anything else to be done here? Could someone kick off CI please? |
@davidungar Friendly ping |
Getting the CI, and I'll check in with David today. @swift-ci Please test |
@allevato Looks fine! Sorry I missed your ping earlier. @jrose-apple Thanks for the ping! |
Please cherry-pick this to the 5.1 branch as well. (I'll help merge it through.) |
…files Fix response file support for batch jobs.
…4829) Fix response file support for batch jobs.
This fixes an issue where batch jobs don't recompute whether they need response files due to command line length limits, because
BatchJob
s are added directly to the task queue and don't go through the same code path inconstructJob
that checks the length (the comment inconstructBatchJob
was incorrect).I've verified that the test added in this PR fails when this patch is not present (the batch frontend job doesn't use a response file) and succeeds when it is.