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:
Marshall Bowers
2024-05-13 18:52:12 -04:00
committed by GitHub
parent ff2eacead7
commit b01878aadf
14 changed files with 149 additions and 63 deletions
+17
View File
@@ -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)
}