-
Notifications
You must be signed in to change notification settings - Fork 121
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
Rustup integration for non-binary/non-cargo dependencies #139
Comments
sorry for the loooong answer. # install crate using cargo install using crate name
install_crate = "mycrate"
# install crate via rustup and fallback to cargo
install_crate = { crate_name = "mycrate", rustup_component_name = "rustup-component", binary = "testbinary", test_arg = "--help" }
# install crate via cargo install
install_crate = { crate_name = "mycrate", binary = "testbinary", test_arg = "--help" } so you are looking for a way to install via rustup a source only component and components that you can't fallback to cargo install. install_script = [ "rustup component add llvm-tools" ] which is something you can do today and should work just fine. install_scripts are invoked if install_crate is not defined and do not have any 'automatic' conditions to them so that would work. So those are 2 issues:
For item 1, we could modify install_crate to invoke only rustup without cargo fallback
That should be really easy to develop for cargo-make. As for item 2, you will need to do the following, since install_crate can be defined once in a task and since you have another crate there that might need to be installed (cargo-xbuild), you might want to split it to 2 tasks. [tasks.install-llvm-tools]
install_crate = { rustup_component_name = "llvm-tools", binary = "llvm-nm", test_arg = "--help" }
[tasks.install-rust-src]
install_crate = { rustup_component_name = "rust-src" }
[tasks.xbuild1]
# run cargo xbuild, if xbuild is not installed, it will be automatically installed for you
command = "cargo"
args = [ "xbuild", .... ]
dependencies = [ "install-llvm-tools", "install-rust-src" ]
[tasks.xbuild2]
# run cargo xbuild, if xbuild is not installed, it will be automatically installed for you
command = "cargo"
args = [ "xbuild", .... ]
dependencies = [ "install-llvm-tools", "install-rust-src" ]
[tasks.myflow]
dependencies = [ "xbuild1", "xbuild2" ] that doesn't require any cargo-make changes. summary:
makes sense? |
Yes, this all makes sense! And yeah, for my use-case, I'd use this with cargo-xbuild or xargo. The plan you laid out should work well for me. I'll install the latest commit of cargo-make and give it a try :). As a bit of a sub-issue: I think the documentation doesn't properly explain that the various auto-installation steps are mutually exclusive. I came to realize this by reading your above post. I think it'd be nice if this was explicitly mentioned at the beginning of the "installing dependencies" section. In addition to this, maybe the flow for having multiple "install" dependencies should be also explained in the documentation. It'll certainly come in handy for some people. And as always, thanks for the quick reply and the awesome work on cargo-make! |
thanks :) very curious to see if the latest changes work well for you, so please keep me updated. as for docs, I totally agree. I wrote a lot, but still much is still missing. I'll definitely add the installation descriptions from above to the main readme. |
Alright, just finished doing some tests. rust-src and cargo-xbuild both get properly installed. I tested llvm-tools-preview, and while it installs properly, it doesn't seem to be trying to run the test binary. E.G. As a separate issue, llvm-tools-preview can't be properly tested for presence anyways. That's because it isn't added to the $PATH (rustup run doesn't work either). Instead, we're supposed to use https://crates.io/crates/cargo-binutils to run them. So using llvm-tools-preview as an example in the README is a bit misleading. It might be better to show with the rls-preview compoent:
I'm not sure the test for presence is really necessary anyways. If we're going to run a binary anyways, it doesn't matter if it's |
Great thanks. Good timing, as i'm writing the docs now :) |
Problem Description
The rustup integration right now seems to assumes two things:
The rustup binary has an equivalent cargo crate. This is not always the case, for instance rustup has components like llvm-tools, which install llvm versions of objdump, strip, etc... Those are C dependencies, and as such are not available via cargo.
The integration assumes that the dependency provides a binary. This is not always the case either, for instance the rust-src component creates a new directory containing the rust sources.
One use-case I have for this integration would be to install
rust-src
automatically oncargo make
invocation, since it's a necessary dependency of cargo-xbuild. I don't think it's possible right now. Is there any plan for this?The text was updated successfully, but these errors were encountered: