-
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
artifact-dependencies doesn't support building binaries for multiple targets #12374
Comments
@tamird I feel like just giving an undifferentiated list is less usable than providing per-target information. People using artifact deps for multiple targets seem likely to use each dependency separately in some way, rather than just having a list that mixes the builds for each target. My go-to example is "firmware for an emulator that emulates multiple targets". I'd expect the crate depending on that firmware to need to use (say) aarch64 firmware in a different way than x86-64 firmware, and reference them in different places. Hence giving them different crate names. If someone just wants them in an array, it's easy to turn them into an array, but it's more annoying to go the other direction. |
That's fair, and perhaps the suggested solution of exposing a list isn't right; the interface should definitely indicate which path was compiled for which target. Is there more fidelity that's missing in this proposal versus RFC-3176? |
Doing this as a list would also break anything that relies on these environment variables not being lists, which would mean we'd have to gate stabilizing bindeps on this and make people dealing with single-target bindeps also deal with it. Using separate environment variables avoids that. |
Separate environment variables is fine by me -- my point is that I would like to not have to declare the same dependency multiple times, possibly with contrived aliases each time. How does that sound? |
I could imagine an approach where we could provide a shorthand that automatically generates those distinct crate names using the target name. For my part, though, I think I'd rather use In any case, I think we should wait to consider such a shorthand until there's usage of artifact dependencies and we have some use cases to evaluate, at which point we could consider potential shorthands if they'd help. |
Thanks for citing that. I think we should allow both -- if I want convention over configuration, I'll use a list of targets, and if I need the control, I can use multiple names. We should be cognizant of pushing meaningless choices onto users (while allowing them to make such choices if they are meaningful to them). I agree that this can wait. |
Problem
build.target
supports multiple targets, and the documentation indicates that it will be built for all of them. The equivalent behavior can be very useful for bindeps as well, e.g. when the binary is to be embedded into another binary, as is commonly done with BPF programs.Proposed Solution
Accept an array of targets and expose
CARGO_<ARTIFACT-TYPE>_DIR_<DEP>
andCARGO_<ARTIFACT-TYPE>_FILE_<DEP>_<NAME>
as lists in the manner ofCARGO_ENCODED_RUSTFLAGS
.Notes
RFC-3176 (#10030, #10061) address the same desired functionality in a different way. If there is a reason that accepting a string of multiple versions was considered and rejected, it is not documented. cc @joshtriplett @Byron
The text was updated successfully, but these errors were encountered: