-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Added '--deps-only' to {build, doc} subcommands #3567
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
@rust-highfive, stop build. |
@brson, |
cc #2644 I'm not personally sold on the motivation for such a feature here to add it to Cargo yet. Perhaps we could continue to gather use cases on the issue itself? |
@alexcrichton, |
cc #2801 |
The implementation is not as easy as you might think. For example the implementation here is incorrect. For example it looks like this will still compile the library of the current package if there's a binary. I'd like to get more information about use cases before we add such a feature. "it is useful" to me isn't a concrete reason as to why this feature is motivated. |
I can't understand that. Can you rephrase that please? I will check whether it still compiles a library. For me it is useful only for |
@KalitaAlexey I'd encourage you to add some tests to this PR to see the behavior. You can try adding a project with both a library and a binary and then assert that |
@alexcrichton, |
Ah yes, I do |
Currently I little time. |
Closing due to inactivity, but feel free to resubmit with comments addressed! |
@alexcrichton I'm a +1 for using this inside Docker but I'm not sure if we can do this. In my Dockerfile I have:
What I want to do is:
so that I rebuild the dependencies only if they changed and I can reuse the intermediate Docker container running the --dependencies-only step. Is it possible to implement this option without having the source code available, only Cargo.toml and/or Cargo.lock ? If yes can you point to some places in the code I may be able to produce a PR ? |
@atodorov right now Cargo's not really built to cater to that use case unfortunately. Getting that working in a reliable fashion would be pretty difficult. |
FYI I've managed to work around this by using |
I just published a cargo extension crate to make this easier. I've been using it in one of my projects. https://crates.io/crates/cargo-build-deps |
Please don't merge it.
I haven't added tests.
It works, I just want to hear opinions.
Which subcommands can support "--deps-only"?
How can I prevent the bot from building?
Soon I will describe my changes.
Unresolved questions
What to do if
--deps-only
is passed but there are no dependencies?What to do if both
--deps-only
and--no-deps
are passed tocargo doc
?