Skip to main content

cargo_workspace2/
lib.rs

1//! cargo-workspace2 is a library to help manage cargo workspaces
2//!
3//! Out of the box the `cargo` workspace experience leaves a lot to be
4//! desired.  Managing a repo with many crates in it can get out of
5//! hand quickly.  Moreover, other tools that try to solve these
6//! issues often pick _one_ particular usecase of cargo workspaces,
7//! and enforce very strict rules on how to use them.
8//!
9//! This library aims to solve some of the issues of dealing with
10//! workspaces in a way that doesn't enforce a usage mode for the
11//! user.
12//!
13//! This package also publishes a binary (cargo ws2), which is
14//! recommended for most users.  In case the binary handles a use-case
15//! you have in a way that you don't like, this library aims to
16//! provide a fallback so that you don't have to re-implement
17//! everything from scratch.
18//!
19//! ## Using this library
20//!
21//! Parsing happens in stages.  First you need to use the
22//! [`cargo`](./cargo/index.html) module to parse the actual
23//! `Cargo.toml` files.  After that you can use the cargo models in
24//! [`models`](models/index.html) to further process dependencies, and
25//! create a [`DepGraph`](models/struct.DepGraph.html) to resolve queries and make changes.
26
27pub mod cargo;
28pub mod models;
29pub mod ops;
30pub mod query;
31
32#[doc(hidden)]
33pub mod cli;
34
35// extern crate toml;
36// extern crate toml_edit;
37
38// pub use data_models::graph;
39// use data_models::level::Level;
40// use graph::DepGraph;
41// use std::fs::File;
42// pub use utilities::cargo_utils;
43// pub use utilities::utils;
44
45// pub mod data_models;
46// pub mod utilities;
47
48// pub fn do_batch_release(f: File, lvl: &Level) -> DepGraph {
49//     let members = cargo_utils::get_members(f);
50//     let configs = cargo_utils::batch_load_configs(&members);
51
52//     let v = configs
53//         .iter()
54//         .map(|c| cargo_utils::parse_config(c, &members))
55//         .fold(DepGraph::new(), |mut graph, (name, deps)| {
56//             graph.add_node(name.clone());
57
58//             deps.iter()
59//                 .fold(graph, |graph, dep| graph.add_dependency(&name, dep))
60//         });
61
62//     println!("{:#?}", v);
63//     v
64// }