Skip to content
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

Keeping compilation artifacts of each run #243

Open
cyqsimon opened this issue Apr 1, 2024 · 2 comments
Open

Keeping compilation artifacts of each run #243

cyqsimon opened this issue Apr 1, 2024 · 2 comments
Assignees
Labels
C-enhancement Category: A new feature or an improvement for an existing one

Comments

@cyqsimon
Copy link
Contributor

cyqsimon commented Apr 1, 2024

Is there a way for me to make cargo-hack keep the compiled binary after each run? I'm thinking of something like this:

# Assume crate foo has features alpha and bravo
$ cargo hack build --feature-powerset --keep-artifacts
$ ls target/debug/cargo-hack-artifacts
foo
foo-alpha
foo-bravo
foo-alpha-bravo

This would be useful if for example, you would like to upload them as CI artifacts.

If this is currently not possible, I would like to volunteer to work on a PR, thanks.

@taiki-e
Copy link
Owner

taiki-e commented Apr 1, 2024

It is probably possible to write a script that does this using --print-command-list (#175), but adding a flag to do this in a single command seems reasonable to me.

@taiki-e taiki-e added the C-enhancement Category: A new feature or an improvement for an existing one label Apr 1, 2024
@cyqsimon
Copy link
Contributor Author

cyqsimon commented Apr 3, 2024

I'm in the middle of implementing this, and it turns out it's quite complicated with a lot to add.

First of all, cargo can produce a lot of different types of binary objects, and they are all placed under different paths. The behaviour is well-documented here, but still it's a lot of work to implement.

Second, cargo allows target selection (not to be confused with the target triple) using flags like --lib, --bins, --bin, etc. See cargo build -h. Right now these flags are of "passthrough" type, but they need to be changed to "propagated" type instead so that we can know which objects to copy.

This is all to say that it's more work than I expected. Not too difficult; just tedious. Give me some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: A new feature or an improvement for an existing one
Projects
None yet
Development

No branches or pull requests

2 participants