From 1d15ead158f67039df2a05f85cb07d6f0738f799 Mon Sep 17 00:00:00 2001 From: James Farrell Date: Thu, 23 Jan 2025 00:55:36 +0000 Subject: [PATCH] Try more versions of crate updates ...with various degrees of semver compatibility strictness. Test: ran it Change-Id: I21189ed59b7d2229fd587a20ff07b98b2a8779ed --- tools/crate-updater/src/main.rs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tools/crate-updater/src/main.rs b/tools/crate-updater/src/main.rs index b5fe89b832..a06bf00067 100644 --- a/tools/crate-updater/src/main.rs +++ b/tools/crate-updater/src/main.rs @@ -147,22 +147,21 @@ fn sync_to_green(monorepo_path: &Path) -> Result<()> { fn get_suggestions(monorepo_path: &Path) -> Result> { // TODO: Improve update suggestion algorithm, and produce output in machine-readable format. - let output = Command::new(monorepo_path.join("crate_tool")) - .args(["suggest-updates", "--patches"]) - .current_dir(monorepo_path) - .output()? - .success_or_error()?; - let mut suggestions = from_utf8(&output.stdout)? - .trim() - .lines() - .map(|suggestion| { + let mut suggestions = Vec::new(); + for compatibility in ["ignore", "loose", "strict"] { + let output = Command::new(monorepo_path.join("crate_tool")) + .args(["suggest-updates", "--patches", "--semver-compatibility", compatibility]) + .current_dir(monorepo_path) + .output()? + .success_or_error()?; + suggestions.extend(from_utf8(&output.stdout)?.trim().lines().map(|suggestion| { let words = suggestion.split_whitespace().collect::>(); if words.len() != 6 { println!("Failed to parse suggestion {suggestion}"); } (words[2].to_string(), words[5].to_string()) - }) - .collect::>(); + })); + } // Return suggestions in random order. This reduces merge conflicts and ensures // all crates eventually get tried, even if something goes wrong and the program