-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Try avoiding a full clean in cargo sqlx prepare --merged
#1802
Conversation
Got a few more changes I want to make on this later today. I'll comment after I get everything pushed |
Final set of changes are up! Things changed a bit since my original description, so here's the current gist: This PR manages to avoid a full clean when using #1793 also mentioned allowing for an ignore list so that crates that depend on
Feel free to let me know what you think of the changes. I verified that the changes appear to work fine on a few projects I have that use It's also worth noting that this currently cleans |
Also wanted to say it's a bit unfortunate that github is counting the pretty-printed json file when it comes to the +/- for code. I can compact it, or change the test. There's just a lot of complexity contained within figuring out the recompile action, so I wanted a test to make the behavior obvious |
@LovecraftianHorror sorry for the delay, you mind rebasing and fixing the merge conflicts? |
I'll try to get to that later today |
Merge conflicts fixed, and no worries on the delay. I understand that life gets busy I don't know if I mentioned elsewhere in this thread, but these changes should be backwards compatible which means that it shouldn't have to wait for another breaking version update |
Closes #1793
This PR avoids a full
cargo clean
when runningcargo sqlx prepare --merged
by selectivelycargo clean -p
ing packages that depend onsqlx-macros
outside the current workspace and updating the mtime of the source paths of crates that depend onsqlx-macros
within the current workspace.Doing recompiles this way drastically lowers the time that
cargo sqlx prepare --merged
takes. I'll avoid a benchmark this time since it's just comparing a full recompile with a partial recompile and depends heavily on the project it's being run on and the machine doing the building, but it's a drastic improvement.Update: Even though
cargo clean -p <SPEC>
works by pkgid, it ignores the url and version to just clean by name. Due to that I ripped out all the pkgid logicCurrently the changes don't allow for people to ignore crates that depend onsqlx-macros
without actually using compile-time verified queries. My original idea on this was to allow people to pass pkgids of crates they want ignored. From there the fully qualified pkgid spec could be obtained from runningcargo pkgid <partially-qualified-spec>
, and those fully qualified specs can be removed from the fully qualified specs returned fromcargo metadata
. I'll just paste in a md formatted version of my comment in the code:NOTE: Trying to get theurl
fromsource
is rather problematic:Local files don't have this setIt only appears to be set withinid
which would need to be parsedssh
urls (from using git repos) have can include fragments and queries that pkgid does not expectA separate issue is thatpkgid
s don't seem to be entirely unique (two git urls on different commits with the same version and name get normalized to the same pkgid)Due to all of this we:Only allow crates.io as the source urlCan't use PkgId as a UUID, instead we need to use the metadataid
stillMay recompile more packages then required due to ambiguityI'm planning on opening issues upstream about both of the above problems upstream, but the good news is that adding an--ignore
flag shouldn't be a breaking change since its behavior is opt-in