-
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
Optionally generate "dep-info for external build system integration" for test and example binaries #14050
Comments
@rustbot label: +A-dep-info |
Could you provide a reproduction case of "on this project, I run this command, and I'm reading dep info files in this way"? |
Absolutely, I think the most trivial example would be a project that uses make to invoke cargo. Imagine a project called target/debug/foo:
CARGO_BUILD_DEP_INFO_BASEDIR=$(CURDIR) \
cargo build --package foo
include $(wildcard target/debug/foo.d) Which allows make to do out-of-date checks for foo's binary: $ make
CARGO_BUILD_DEP_INFO_BASEDIR=/a/path/foo \
cargo build --package foo
Compiling foo v0.1.0 (/a/path/foo)
Finished dev [unoptimized + debuginfo] target(s) in 0.29s
$ make
make: 'target/debug/foo' is up to date.
$ touch src/main.rs
$ make
CARGO_BUILD_DEP_INFO_BASEDIR=/a/path/foo \
cargo build --package foo
Compiling foo v0.1.0 (/a/path/foo)
Finished dev [unoptimized + debuginfo] target(s) in 0.23s This works even if foo depends on other local crates and it is their source that changes. At a high-level, what I want to be able to do is something similar for tests. I want to author a target/debug/deps/foo-somehash:
CARGO_BUILD_DEP_INFO_BASEDIR=$(CURDIR) \
cargo test --package foo
include $(wildcard target/debug/deps/foo-somehash.d) And have make only attempt to rebuild and re-run tests if any source files upon which the tests depend have changed. Ignoring the |
To make sure we're on the same page, the "extended dep-info" you are talking about is the third kind of dep-info in the doc, right? I believe "example binaries" already got their own extended dep-info files. They are kinda uplifted to The only thing left is dep-info for test executables. |
This could work, but not ideal. People then have one more implicit detail to depend on. I wonder if we should move tests to a separate directory like |
There is a discussion on Zulip about a query interafce that is a bit related: https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Query.20Interface.20for.20Cargo. |
Yes, correct
I missed that, thanks for highlighting it :)
Would this include removing the fingerprint hash from the file-name as well, similar to the other binary artefacts that get uplifted? If so that would be ideal. |
Problem
Currently only artefacts destined for uplift to the top-level target directory have extended dep-info generated for them.
In order for external build tools to be able to trivially ascertain whether it's necessary to invoke cargo to rebuild (and potentially re-run) test and example executables it would be ideal if cargo could, optionally, generate the extended dep-info for them as well.
Proposed Solution
Generate extended dep-info for test and binary executables.
target/.../deps
folder, perhaps named something of the form<artefact-name>-<hash>-extended.d
.Notes
I'm happy to do the work once the proposal is accepted and an implementation agreed.
The text was updated successfully, but these errors were encountered: