-
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
Command to run only build scripts #7178
Comments
cc @Undin |
@vlad20012 pointed out that |
I'm in favor of a Here's a simple, practical, graphics-related example why this needs to be implemented:
In this example, the solution is to touch a file with the same name, for every new file. Or for example, have a custom make solution. |
I'm thinking of introducing Rust at work into an existing project using Cpp + Cmake. By using Corrosion to import the rust crate and Cxx to generate cpp source file bindings, such a command could then be run at cmake configure time such that they exist at build time. |
The status quo today is that IDEs use this RUSTC_WRAPPER hack to shortcut the build process: Recently, it was found to cause problems. In particular, build scripts can use rustc not failing as a signal that a particular language feature is supported: dtolnay/anyhow#252, and that breaks if rustc is an always succeeding shim! |
Is there a reason that |
Remember that "these use cases" are about all main IDE solutions at this moment (either rust-analyzer or Rust plugin in IntelliJ ecosystem), so it affects quite a lot of Rust developers |
My RFC for this goes a bit into the usecases etc rust-lang/rfcs#3344 But in short, IDEs really really want this because cargo check has downsides that we'd like to avoid (outlined in the linked RFC). |
I raised it because there wasn't much talk of why that wasn't sufficient. |
I have a use case where we have tooling that scans generated code. We'd like this scan to be relatively cheap, but |
Another scenario where it may be useful to ask Cargo run just the build script is integration with other, non-Cargo build systems. For example, Chromium uses GN/ninja-based build system and:
|
Hi!
This is a pre-RFC style issue just to write down some long-term thoughts.
The IDE support for rust progressed enough that build scripts need some special support. Specifically, for IDEs it would be useful if Cargo can just run the build scripts and compile proc-macros, without building any code. That is, do all the stuff for
$host
, and skip everything$target
related. With this, IDE can provide full support for generated code and procedural macros, without requiring that the code itself builds (if it can also discover results of build-scripts, like theOUT_DIR
).In the ideal world, I think this should work like this:
I think we unfortunately can't do that now, as there's little separation between "stages" of dependencies, and, for example
cargo run
andcargo test
might run build scripts slightly differently. This also seems to touch "build profile" and "build-deps features influcence the final artifact" problems.The text was updated successfully, but these errors were encountered: