Exclude version numbers from cargo/licenses.json

Version numbers are not required by the license, and keeping them in means
the build breaks after merging in a dependabot update.
This commit is contained in:
Damien Elmes 2025-08-19 23:48:04 +10:00
parent 37f7872565
commit e676e1a484
5 changed files with 2589 additions and 3213 deletions

1
Cargo.lock generated
View file

@ -3959,6 +3959,7 @@ dependencies = [
"anki_process",
"anyhow",
"camino",
"serde_json",
"walkdir",
"which",
]

View file

@ -169,7 +169,7 @@ fn build_rsbridge(build: &mut Build) -> Result<()> {
pub fn check_rust(build: &mut Build) -> Result<()> {
let inputs = inputs![
glob!("{rslib/**,pylib/rsbridge/**,ftl/**,build/**,qt/launcher/**}"),
glob!("{rslib/**,pylib/rsbridge/**,ftl/**,build/**,qt/launcher/**,tools/minilints/**}"),
"Cargo.lock",
"Cargo.toml",
"rust-toolchain.toml",

File diff suppressed because it is too large Load diff

View file

@ -12,5 +12,6 @@ anki_io.workspace = true
anki_process.workspace = true
anyhow.workspace = true
camino.workspace = true
serde_json.workspace = true
walkdir.workspace = true
which.workspace = true

View file

@ -2,6 +2,7 @@
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
use std::cell::LazyCell;
use std::collections::BTreeMap;
use std::collections::HashSet;
use std::env;
use std::fs;
@ -267,5 +268,16 @@ fn generate_licences() -> Result<String> {
"--manifest-path",
"rslib/Cargo.toml",
])?;
Ok(output.stdout)
let licenses: Vec<BTreeMap<String, serde_json::Value>> = serde_json::from_str(&output.stdout)?;
let filtered: Vec<BTreeMap<String, serde_json::Value>> = licenses
.into_iter()
.map(|mut entry| {
entry.remove("version");
entry
})
.collect();
Ok(serde_json::to_string_pretty(&filtered)?)
}