Skip to content

Commit 140bb2d

Browse files
committed
ensure_version_or_cargo_install: logging and assert
1 parent 7d2fcd9 commit 140bb2d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/build_helper/src/util.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub fn ensure_version_or_cargo_install(
9797

9898
let tool_root_dir = build_dir.join("misc-tools");
9999
let tool_bin_dir = tool_root_dir.join("bin");
100+
eprintln!("building external tool {bin_name} from package {pkg_name}@{version}");
100101
// use --force to ensure that if the required version is bumped, we update it.
101102
// use --target-dir to ensure we have a build cache so repeated invocations aren't slow.
102103
// modify PATH so that cargo doesn't print a warning telling the user to modify the path.
@@ -120,5 +121,10 @@ pub fn ensure_version_or_cargo_install(
120121
if !cargo_exit_code.success() {
121122
return Err(io::Error::other("cargo install failed"));
122123
}
123-
return Ok(tool_bin_dir.join(bin_name));
124+
let bin_path = tool_bin_dir.join(bin_name);
125+
assert!(
126+
matches!(bin_path.try_exists(), Ok(true)),
127+
"cargo install did not produce the expected binary"
128+
);
129+
Ok(bin_path)
124130
}

0 commit comments

Comments
 (0)