Repository navigation
Use cargo check consistently in prepare - #2071
Merged
Merged
Conversation
Collaborator
|
This PR has conflicts after merging #2069. |
cycraig
force-pushed
the
chore/use-cargo-check-prepare
branch
from
August 27, 2022 08:18
eb9d3f4 to
b331f3f
Compare
Contributor
Author
|
Thanks for the ping; rebased the changes. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of change
Small PR to change
cargo sqlx prepareto always usecargo check.Currently,
prepareinvokescargo rustcby default but switches tocheckwhen the--mergedflag is used. This can lead to confusion since certain flags passed tocargo checkwill be rejected bycargo rustcwhen runningprepare.The current behaviour also contradicts the
sqlx-cliREADME, which states:Which actually fails with the following error:
But passes with
--merged, regardless of whether the current directory is a workspace root or a sub-crate.cargo sqlx prepare --merged -- --all-targets --all-featuresThis PR ensures it works with or without
--merged.When the working directory is a crate in a workspace, it still only builds the queries for it and not the entire workspace.
Is there any reason to retain the behaviour of using
rustcdirectly? Edit: does this negatively affect plans for #1706?This arose from the following comment thread: #2069 (comment)
Alternative: update the documentation/README.md to specify
--mergedmust be used to combine the queries of multiple targets, even when in a single crate.P.S. sorry for spamming PRs.
Type of change
Bug fix to match the intended behaviour, but might technically be a breaking change as it changes which flags are accepted or not.
How the change has been tested
cd sqlx-cli && cargo testand runningcargo sqlx prepare -- --all-targets --all-featuresin a sample project.