cargo-post

A cargo wrapper that executes a post build script after a successful build.

Installation

cargo install cargo-post

Usage

Execute cargo CMD [ARGS] and run post_build.rs afterwards:

cargo post CMD [ARGS]

The post_build.rs is only run if CMD is a build command like build or xbuild.

Examples:

Build the crate and run post_build.rs afterwards:

cargo post build

Build the crate in release mode and run post_build.rs afterwards:

cargo post build --release

Builds the crate using cargo-xbuild:

cargo post xbuild

Check the crate without executing post_build:

cargo post check

The build script is not executed because cargo check is not a build command. The same behavior occurs for cargo post doc or cargo post update.

Post-Build Script Format

Post-build scripts are similar to cargo build scripts, but they get a different set of environment variables:

Dependencies

Dependencies for post build scripts can be specified in a [package.metadata.cargo-post.dependencies] table in your Cargo.toml.

Example

```rust use std::env;

fn main() { println!("Hello from post build script!"); for (key, value) in env::vars() { if key.startswith("CRATE") { println!("{}: {}", key, value); } } } ```

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.