cargo-wop
- cargo without projectWARNING: this package is experimental at the moment.
The ambition is to allow running all cargo commands against a rust source with additional dependency annotations.
This project is heavily inspired by cargo-script,
cargo-eval. In contrast to these projects, cargo-wop
aims to be
as close as possible to cargo and support all sensible arguments.
Usage:
```bash
cargo wop my-script.rs cargo wop run my-script.rs
cargo wop build my-script.rs
cargo wop test my-script.rs ```
At the moment the following cargo commands are supported: bench
, build
,
check
, clean
, clippy
, install
, locate-project
, metadata
, pkgid
,
run
, tree
, test
, verify-project
. For most commands cargo-wop
rewrites
the command-line as follows:
```bash
cargo wop [cargo-command] [script] [args...]
cargo [cargo-command] --manifest-path [generated_manifest] [args...] ```
Some commands use additional rules:
run
: all arguments are passed per default to the script, not to cargo. To
pass arguments to cargo
place them before a --
. For example: cargo wop
run my-script.rs --debug -- ...
build
: is executed twice. Once to build the package and a second time to
determine the generated build artifacts and copy them into the local folderbuild
and run
default to release builds. To disable this behavior, use the
build-debug
and run-debug
commands.install
: no manifest path is added, but the --path
argument to the
manifest directoryCustom commands:
exec
execute the command after the source inside the manifest directorymanifest
: print out the generated manifestDependencies are described in a cargo manifest embedded in the top-level comment. Importantly, the file must start with the comment for the manifest to be recognized. For example:
rust
//! My script
//!
//!
cargo
//! [dependencies]
//! serde = "1.0"
//!
//!
The embedded manifest can contain any keys recognized by cargo. cargo-wop
normalizes this manifest and makes sure the source file is correctly included.
It also normalizes any paths used to specify dependencies. To show the generated
manifest use:
bash
cargo wop manifest my-script.rs
For example, simply specify a [lib]
target with the correct flags set to build
a static C library:
rust
//! My script
//!
//!
cargo
//! [lib]
//! crate-type = ["cdylib"]
//!
//! [dependencies]
//!
This script can be built into a library via:
bash
cargo wop build my-script.rs