rust-lang / rust-lang/cargo

Add a method for a dependency to 'push' an artifact up the dependency tree

Open
#5,644 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-crate-dependencies C-feature-request S-needs-rfc
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Motivation: https://github.com/jwilm/alacritty/pull/1374#issuecomment-397724021

In the case above our binary crate depends on another binary (winpty-agent) which is built by one of it's dependants. At the moment there is no easy way for our crate to access artifacts produced in a dependencies target directory, unless it's a library linked by cargo.

alacritty <- Binary needed here
    winpty
        winpty-sys <- Binary built here

My suggestion is too add an output to the build script called 'publishes' which contains a name of an artifact produced by the build script. Setting this will make cargo copy it into any crates which require it as a dependency. In this scenario winpty-sys AND winpty would set publishes to the name of the binary. It would be copied into winpty's target directory, then into alacritty's target directory.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading Cargo's build-script output handling and how dependency target directories are populated. Trace the binary-artifact path from winpty-sys through winpty to alacritty, using the dependency tree in the issue as the entry point. Done would require an agreed design and verified propagation of the named artifact through each dependent target directory.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.