Skip to content

Commit e4b34d0

Browse files
committed
fix: correct msrvcheck and include python project
1 parent a5fabdf commit e4b34d0

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

dev/msrvcheck/src/main.rs

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,45 +27,49 @@ fn main() -> CargoResult<()> {
2727
let gctx = GlobalContext::default()?;
2828
// This is the path for the depcheck binary
2929
let path = env::var("CARGO_MANIFEST_DIR").unwrap();
30-
let root_cargo_toml = Path::new(&path)
30+
let root_folder = Path::new(&path)
3131
// dev directory
3232
.parent()
3333
.expect("Can not find dev directory")
3434
// project root directory
3535
.parent()
36-
.expect("Can not find project root directory")
37-
.join("Cargo.toml");
36+
.expect("Can not find project root directory");
3837

39-
println!(
40-
"Checking for MSRV dependencies in {}",
41-
root_cargo_toml.display()
42-
);
38+
let rust_folder = root_folder.join("Cargo.toml");
39+
let python_folder = root_folder.join("python").join("Cargo.toml");
4340

44-
let workspace = cargo::core::Workspace::new(&root_cargo_toml, &gctx)?;
45-
let project_msrv = workspace.lowest_rust_version().unwrap(); // there should be a MSRV project wise
41+
for root_cargo_toml in [rust_folder, python_folder] {
42+
println!(
43+
"Checking for MSRV dependencies in {}",
44+
root_cargo_toml.display()
45+
);
4646

47-
let (_, resolve) = cargo::ops::resolve_ws(&workspace, false)?;
48-
let packages_with_rust_version: Vec<_> = resolve
49-
.iter()
50-
.filter(|id| id.name().starts_with("datafusion"))
51-
.map(|e| resolve.summary(e))
52-
.map(|e| (e.name(), e.rust_version()))
53-
.collect();
47+
let workspace = cargo::core::Workspace::new(&root_cargo_toml, &gctx)?;
48+
let project_msrv = workspace.lowest_rust_version().unwrap(); // there should be a MSRV project wise
5449

55-
println!("Current project MSRV: {}", project_msrv);
50+
let (_, resolve) = cargo::ops::resolve_ws(&workspace, false)?;
51+
let packages_with_rust_version: Vec<_> = resolve
52+
.iter()
53+
.filter(|id| id.name().starts_with("datafusion"))
54+
.map(|e| resolve.summary(e))
55+
.map(|e| (e.name(), e.rust_version()))
56+
.collect();
5657

57-
for (package, version) in packages_with_rust_version {
58-
if let Some(v) = version {
59-
if !v.is_compatible_with(project_msrv.as_partial()) {
60-
panic!(
61-
"package '{package}' has MSRV {v} not compatible with current project MSRV {project_msrv}",
62-
);
63-
}
58+
println!("Current project MSRV: {}", project_msrv);
59+
60+
for (package, version) in packages_with_rust_version {
61+
if let Some(v) = version {
62+
if !project_msrv.is_compatible_with(v.as_partial()) {
63+
panic!(
64+
"package '{package}' has MSRV {v} not compatible with current project MSRV {project_msrv}",
65+
);
66+
}
6467

65-
println!("{package} MSRV: {v}");
68+
println!("{package} MSRV: {v}");
69+
}
6670
}
67-
}
6871

69-
println!("No inconsistent MSRV found");
72+
println!("No inconsistent MSRV found");
73+
}
7074
Ok(())
7175
}

0 commit comments

Comments
 (0)