Skip to content
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

[5.7] Driver: provide a more suitable default for emit-module.d #1094

Merged
merged 1 commit into from
May 4, 2022

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented May 4, 2022

Provide a fallback default for the emit-module.d file. It has been
observed on Windows and Android that builds subsequent to #1056 would
emit files into the root of the source tree (specifically, pwd). If
there 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 module
name, 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.

Provide a fallback default for the `emit-module.d` file.  It has been
observed on Windows and Android that builds subsequent to swiftlang#1056 would
emit files into the root of the source tree (specifically, `pwd`). If
there 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 module
name, 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.
@compnerd compnerd requested review from nkcsgexi and artemcm May 4, 2022 17:55
@compnerd
Copy link
Member Author

compnerd commented May 4, 2022

@swift-ci please test

@compnerd
Copy link
Member Author

compnerd commented May 4, 2022

Nominating this for 5.7 as this fixes the auxiliary outputs being emitted into the current directory rather than the proper output directory. This is a low risk change as it just changes the emission location in the case that the output file map does not specify it.

@compnerd
Copy link
Member Author

compnerd commented May 4, 2022

CC: @buttaface

@artemcm artemcm changed the title Driver: provide a more suitable default for emit-module.d [5.7] Driver: provide a more suitable default for emit-module.d May 4, 2022
Copy link
Contributor

@artemcm artemcm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @compnerd.
cc @nkcsgexi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants