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

Allow using cargo-binstall / cargo-quickinstall to download install_crate dependencies #674

Closed
dbanty opened this issue Jul 31, 2022 · 7 comments
Assignees
Milestone

Comments

@dbanty
Copy link
Contributor

dbanty commented Jul 31, 2022

Feature Description

Building crates from scratch can be slow—luckily cargo-quickinstall and cargo-binstall provide a solution! Popular crates (in the case of quickinstall) or crates that opt-in to the right format (in the case of binstall) can be downloaded as prebuilt binaries! I'd love to be able to use install_crate in my Makefile.toml while leveraging one of those tools; unfortunately, neither of them have a --force flag, so I can't get this to work.

Describe The Solution You'd Like

Add a no_force flag or similar to install_crate to allow omitting the --force flag so that install_command = "binstall" will work.

Code Sample

[tasks.mdbook.install_crate]
crate_name = "mdbook"
binary = "mdbook"
test_arg = ["serve", "--help"]
install_command = "quickinstall"

Today, the output is:

Error: "unexpected positional arguments: --force mdbook"
@sagiegurari
Copy link
Owner

good idea. I'll check it out

@sagiegurari
Copy link
Owner

@dbanty can you checkout the dev branch 0.35.16 for this?
basically add also force=false to the install_crate block.
still need to write few tests, but it should be ok now.
would love your feedback

@dbanty
Copy link
Contributor Author

dbanty commented Aug 7, 2022

Hmm, I'm still seeing the same error 🤔 I could have done something wrong though. I installed the new version like cargo install --git https://github.com/sagiegurari/cargo-make --branch=0.35.16 (I've never used that syntax before, so maybe that's wrong?). It then told me:

Replaced package `cargo-make v0.35.15` with `cargo-make v0.35.15 (https://github.com/sagiegurari/cargo-make?branch=0.35.16#7b52723d)` (executables `cargo-make`, `makers`)

I then uninstalled mdbook with cargo uninstall mdbook and added a couple of lines to my install_crate section so that it now looks like this:

[tasks.mdbook.install_crate]
crate_name = "mdbook"
binary = "mdbook"
test_arg = "--help"
install_command = "quickinstall"
force = false

When running a makers serve-book command that requires that dependency, I still get this output:

[cargo-make] INFO - makers 0.35.15
[cargo-make] INFO - Project: knope
[cargo-make] INFO - Build File: Makefile.toml
[cargo-make] INFO - Task: serve-book
[cargo-make] INFO - Profile: development
[cargo-make] INFO - Running Task: legacy-migration
[cargo-make] INFO - Execute Command: "cargo" "quickinstall" "--force" "mdbook"
Error: "unexpected positional arguments: --force mdbook"
[cargo-make] ERROR - Error while executing command, exit code: 1
[cargo-make] WARN - Build Failed.

@sagiegurari
Copy link
Owner

thanks and sorry about that. i'll check it out tomorrow. didn't have time to setup tests...

@dbanty
Copy link
Contributor Author

dbanty commented Aug 7, 2022

No problem, thanks for working on this!

@sagiegurari
Copy link
Owner

@dbanty it should work well now with your usecase.

@sagiegurari sagiegurari added this to the 0.35.16 milestone Aug 8, 2022
@sagiegurari
Copy link
Owner

@dbanty this is now officially released. if there are any issues with it, feel free to open an issue and I'll handle.
thanks for the idea

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

No branches or pull requests

2 participants