-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Access to compiler artifact notifications messages #13672
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
Comments
FWIW rust-lang/rust#122597 is implemented and approved, awaiting on FCP to how exactly to get it merged. |
For me, the main question is "why was the filtering done in the first place?" The code in question was changed in |
FCP for my change was approved 🎉 Any ideas how to best implement it in |
We talked about this in today's cargo team meeting. The biggest challenge we have with exposing these json messages is that they expose implementation details of cargo
We came up with three options but no real consensus on which route to go
|
The way I see working with
It's
Possibly, this means
I tried doing that. This works, but adds unnecessary coupling between I think out of those options 2 is the easiest way forward if we wrap every |
Oh, and one terrible workaround I forgot to mention is to explore using a rustc wrapper. |
We'd be pointing to people to files in internal locations. We'd want to be directing people to files in official, public locations.
To get it out of the private location |
That's horrifying.
Is it documented somewhere? For anything that depends on a compilation unit - asm, object or llvm files, each file gets a suffix that depends on codegen unit somehow, making public locations for those means either documenting this suffix or inventing a new mapping structure. |
You may want to get artifacts for non-local dependencies of a crate. For those there is no official, public location to copy the artifacts too. |
I guess that makes it harder to go route (1) but okay with (2). |
For future reference, we discussed this more in Office Hour last week and another potential route is to see if rustc is open to expanding their CLI for overriding where to emit to from taking a file path to also taking a directory root. |
Problem
You can pass
--json=artifacts
torustc
and it will emit json messages like{"$message_type":"artifact","artifact":"/path/to/target/release/deps/libsample-fb5d74408737397e.rlib","emit":"link"}
tostderr
.cargo
then parses them and mostly ignores:cargo/src/cargo/core/compiler/mod.rs
Lines 1803 to 1810 in a59aba1
later emitting its own version:
cargo/src/cargo/core/compiler/mod.rs
Line 563 in a59aba1
I'm extending
--json=artifacts
inrustc
to include files produced by--emit
(rust-lang/rust#122597) to avoid doing fragile guesswork incargo-show-asm
, but right now this information won't be accessible whenrustc
is invoked viacargo
.Proposed Solution
cargo
should collect this information when present and output it as part of its own notifications, including cases whererustc
wasn't actually invoked if source files staid the same.Notes
The alternative is for me to invoke
rustc
directly - fragile or to do nothing - currently I have to passcodegen-units=1
- potentially confusing behavior.If approved - I can look into implementing required change myself.
The text was updated successfully, but these errors were encountered: