LukeMathWalker / LukeMathWalker/cargo-px

Can cargo px run a command after a crate is built?

Open
#12 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
63
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Cargo still doesn't support something like [postbuild.rs](https://github.com/rust-lang/cargo/issues/545) which would run after the build (like `build.rs` runs before the build). The usual workaround is to build with another tool that first calls `cargo build`, then run the other command if the build is successful. Something like `make` or whatnot.

But, `cargo px` *is* another tool, one that was created explicitly to address shortcomings of Cargo. Could it maybe support this use case? (at least until Cargo has this feature natively).

Now, I had [another idea](https://github.com/rust-lang/cargo/issues/545#issuecomment-1502436045) to workaround this issue, which is basically to use the [xtask pattern](https://github.com/matklad/cargo-xtask) to drive the build (calling first `cargo build`, then the postbuild command). But I would like to avoid this if `cargo px` had a `postbuild` option.

Contributor guide

No contributing guide indexed for this repository

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 tracing cargo px's command entry point and how it invokes `cargo build`; compare the requested flow with the linked Cargo postbuild discussion and xtask pattern. Define how a postbuild command is configured and ensure it runs only after a successful build, then verify the behavior with the project's existing checks.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.