Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Try more versions of crate updates
Browse files Browse the repository at this point in the history
...with various degrees of semver compatibility strictness.

Test: ran it
Change-Id: I21189ed59b7d2229fd587a20ff07b98b2a8779ed
  • Loading branch information
jfgoog committed Jan 23, 2025
1 parent 5aaffb2 commit 1d15ead
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tools/crate-updater/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,21 @@ fn sync_to_green(monorepo_path: &Path) -> Result<()> {

fn get_suggestions(monorepo_path: &Path) -> Result<Vec<(String, String)>> {
// 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::<Vec<_>>();
if words.len() != 6 {
println!("Failed to parse suggestion {suggestion}");
}
(words[2].to_string(), words[5].to_string())
})
.collect::<Vec<_>>();
}));
}

// Return suggestions in random order. This reduces merge conflicts and ensures
// all crates eventually get tried, even if something goes wrong and the program
Expand Down

0 comments on commit 1d15ead

Please sign in to comment.