-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 doesn't include actual filename of binary targets #5866
Comments
This is similar to #3670. Do you explicitly need to use |
Yes, it's preferred as I want to set up my config/paths before running the build. I also have an option to let user call the build themselves and just let me pack the results, so even build output wouldn't be sufficient in all cases. |
@kornelski curious, would The "binary name" is a tricky business, because binary is not necessary a single file. Debug info might be a separate file, and I believe at least at some point WASM targter generated a |
Nah, it's hacky. I'd have to scan the directory and guess what is a main binary and what is some debug or temp file. Could you expose something like: "main_binary": "target/triple/release/file.exe",
"auxiliary_files": ["target/triple/release/file.dsym"], |
|
This may be a dupe of #2508. |
Given that the subject seems to be executables, does it make sense to put such functionality behind a sort of |
A different angle of attack - how complicated is this logic actually? Isn't the list of executables given by something like:
i.e. for every |
Finding the TARGET_DIR might be a bit harder as the platform varies between projects. The platform can be specified in the
and
and of course a project might not have a config file at all. One would have to look at the cargo specs to be sure that this covers all options. |
If you are ok doing this with a build, you can use something like escargot to run a build and to capture what executables were made. I use this in compile-examples to test my examples. |
In my case there is required to be a strict separation between building and other steps so escargot won't work for that project but I might try it somewhere else. Thanks for the pointer! |
This is still an issue. In both cargo-xcode and cargo-deb I have to hardcode assumptions about the directory and file name of the binaries. |
I'm writing a tool that needs to compile a Cargo project, and copy all executables out of it. This seems to be impossible to do with only the information that Cargo provides.
cargo metadata
includes a list of binary targets and their names, but mapping from name to filename is target-specific (e.g..exe
appended on Windows). This is further complicated by cross-compilation, sostd
'sEXE_SUFFIX
constant is not sufficient.Could you expand
cargo metadata
output to include names of executables? Ideally with a path including the target directory, because that too is variable depending on environment and target.The text was updated successfully, but these errors were encountered: