Skip to content

How to retrieve build artifact paths? #3757

Closed
@Jascha-N

Description

@Jascha-N

How do I determine which artifacts cargo produced and where? The used target directory depends on multiple environment variables (e.g. CARGO_TARGETDIR), configuration settings (e.g. build.target-dir and build.target), command-line arguments (--target, --release). Not to mention it gets even more complicated when the package is part of a workspace. Of course it also depends on settings inside Cargo.toml but at least for these settings there's the cargo metadata command.

Now my question is if there is any easy way to know which artifacts were produced and where? Or do I have to parse all of the stuff above and mimic undocumented implementation details of how cargo determines output locations and names? If the latter is the case, then this greatly complicates integrating cargo into any other build system. For my specific use case, I need to provide a post-build step that is project-agnostic, i.e. all of the variables above might change. How should I go about?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions