[5.7] Driver: provide a more suitable default for emit-module.d
#1094
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Provide a fallback default for the
emit-module.d
file. It has beenobserved on Windows and Android that builds subsequent to #1056 would
emit files into the root of the source tree (specifically,
pwd
). Ifthere is no explicit location specified for the new output, and given
that there is no primary output associated with the command, the path
that defaults is simply a singular file name component, emitting that
file into the location that the driver was executed from (which comes
out to the root of the package for commandline invocations), dirtying
the source tree.
Rather than sinking the knowledge for the default into
existingOutputForSingleInput
, where we have no access to the modulename, emit the logic inline and derive a name based on the Swift module
and place it as a peer. This should help ensure that the serialized
diagnostics do not end up committed accidentally.