-
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
"cargo metadata" should contain metadata and extra_filename #3109
Comments
cc #1924 |
I don't know how exactly mixing metadata into the file name works, but looks like it is produced during a build to disambiguate possibly identically named artifacts. So perhaps this info should be not the part of |
I had thought about that, but I'd prefer to decouple build from getting the metadata. I'm actually going to be building the crates multiple times (for different versions of libc/gcc), but I want to use a single set of metadata to describe those builds (since they're all logically the same entity). My understanding of the code is that the metadata is only dependent on the package name, the registry it came from, its version, and a salt-like thing indicating its use (lib, test, etc), so it should work out. It's just that the use-salt is localized to the build path and not shared by the |
Ah, I can get per-target metadata which seems to be what I want. So I just need to work out the registry remapping issue. |
Agreed that this should be part of |
Yes, |
Oh yeah handing |
I believe this was fixed in #3319. Please reopen if I'm mistaken! Thank you! |
Hit this issue in 1.64.0. It's NOT resolved by #3319 and should be re-opened. The problem is caused by the suggestion #3319 (comment) from @jsgf, we special case the rlib and bin to the linked path Currently {
"reason": "compiler-message",
"package_id": "testt 0.1.0 (path+file:///home/oxa/tmp/testt)",
"manifest_path": "/home/oxa/tmp/testt/Cargo.toml",
"target": {
"kind": [
"bin"
],
"crate_types": [
"bin"
],
"name": "testt",
"src_path": "/home/oxa/tmp/testt/src/main.rs",
"edition": "2021",
"doc": true,
"doctest": false,
"test": true
},
"message": {
"rendered": "error: aborting due to previous error\n\n",
"children": [],
"code": null,
"level": "error",
"message": "aborting due to previous error",
"spans": []
}
} For rlibs, it is kind of better. But we still need to parse the "filenames": [
"/home/oxa/.cache/testt-target/debug/libtestt.rlib",
"/home/oxa/.cache/testt-target/debug/deps/libtestt-dfaee7c0138c0340.rmeta"
], The extra-filenames (hash part) is important to retrieve all outputs produced by rustc. Especially when we use something like |
Right now, it's impossible to know what the filename of a generated .rlib for a library crate is.
Most of the path can be derived, except for metadata:
target/<buildmode>/lib<cratename>-<metadata>.rlib
It would be useful if
cargo metadata
included either the metadata portion, or the complete generated lib name (but not the whole path, since that's build-mode dependent, and metadata doesn't have the build mode - and presumably because its invariant to build mode?).This is for integration with external build tools, so they can use cargo to generate the .rlib, then use it as part of another build process.
The text was updated successfully, but these errors were encountered: