rust-lang / rust-lang/cargo

Hook for any successful build

Open
#756 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-build-execution A-tooling S-propose-close
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

It would be great to have a way to invoke an external command on successful build of crate or any dependency with at least the following info:

  • target
  • crate name
  • source dir
  • dest dir
  • lib file (if not lib.rs)

For example, if I have the following manifest:

[package]
name = "foo"
on_build_success = "update_src_indexes.sh"

[dependencies.bar]
git="https://github.com/foo/bar"

[dependencies.baz]
git="https://github.com/foo/baz" 

On the first build when everything builds, that external tool will be called with:

  • target=x86_64-apple-darwin, name=bar, source=~/.cargo/path_to_bar, dest=./target/path_to_bar_lib
  • target=x86_64-apple-darwin, name=baz, source=~/.cargo/path_to_baz, dest=./target/path_to_baz_lib
  • target=x86_64-apple-darwin, name=foo, source=., dest=./target/path_to_baz_lib

The idea is that after any rebuild to be able to do some external processing like indexing sources.

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

Review Cargo's build lifecycle and dependency handling in relation to the manifest hook described here. Determine how successful builds would invoke an external command for crates and dependencies, including the target, crate name, source directory, destination directory, and library file. Done means the hook behavior and argument contract are implemented and verified for the example scenarios.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, tooling
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.