This PR adds a new `cargo xtask licenses` command for finding crates with missing license files. A number of crates were uncovered that were missing a license file, and have had the appropriate license file added. Release Notes: - N/A
18 lines
486 B
Rust
18 lines
486 B
Rust
use std::fs;
|
|
|
|
use anyhow::{anyhow, Result};
|
|
use cargo_toml::{Manifest, Workspace};
|
|
use toml;
|
|
|
|
/// Returns the Cargo workspace.
|
|
pub fn load_workspace() -> Result<Workspace> {
|
|
let workspace_cargo_toml = fs::read_to_string("Cargo.toml")?;
|
|
let workspace_cargo_toml: Manifest = toml::from_str(&workspace_cargo_toml)?;
|
|
|
|
let workspace = workspace_cargo_toml
|
|
.workspace
|
|
.ok_or_else(|| anyhow!("top-level Cargo.toml is not a Cargo workspace"))?;
|
|
|
|
Ok(workspace)
|
|
}
|