Add xtask for finding crates with missing licenses (#11776)
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
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user