cargo_wrap

Crates.iocargo_wrap
lib.rscargo_wrap
version0.1.5
created_at2025-03-20 11:34:54.406054+00
updated_at2025-04-08 12:52:46.498219+00
descriptionA small rust wrapper that allows the usage of cargo as a library
homepage
repositoryhttps://github.com/mrLochness350/cargo_wrap
max_upload_size
id1599112
size18,805
(mrLochness350)

documentation

README

Cargo-Wrap

Crates.io Version

This crate is basically just Rust bindings for cargo. For now supports the following flags and features:

Features

  • Verbose logging (--verbose)
  • Release or Debug build modes (--release)
  • Custom job counts (--jobs N)
  • Custom target output directories (CARGO_TARGET_DIR)
  • Specify build targets (--target X)
  • Feature listing and activation (--features X, --no-default-features)
  • Binary/Library build selection (--bin X, --lib X)
  • Extra rustc flags (RUSTFLAGS)

Installation

cargo add cargo_wrap
cargo_wrap = "0.1.5"

Examples

Basic Build

use cargo_wrap::{Builder, ProjectSettings};
use std::io;

fn main() -> io::Result<()> {
    let mut settings = ProjectSettings::new("/path/to/project", None, None, false);
    settings.set_release();

    let builder = Builder::new(settings, 0, Some("output.log"))?;
    builder.build()?;

    Ok(())
}

Enable Features

use cargo_wrap::{Builder, ProjectSettings};
use std::io;

fn main() -> io::Result<()> {
    let mut settings = ProjectSettings::new("/path/to/project", None, None, false);
    settings.add_feature("my_feature".to_string());

    let builder = Builder::new(settings, 0, None)?;
    builder.build()?;

    Ok(())
}

Changelog

0.1.0

  • Initial commit

0.1.1

  • Added additional rustc flag support

0.1.2

  • Added #[derive(Clone)] support for the ProjectSettings struct

0.1.3

  • Added support for manually setting build targets
  • Added support for manually setting the output path

0.1.4

  • Added support for manually setting the project path

0.1.5

  • Fixed feature bug

License

MIT

Commit count: 13

cargo fmt