[M6] preserve every probe's scratch under last-failure/<pkg>/
This commit is contained in:
@@ -77,9 +77,12 @@ auto record_lockfile_rev(const fs::path& project_root, const std::string& name,
|
||||
return lockfile::write(lock, lock_path);
|
||||
}
|
||||
|
||||
// Drives the resolver chain (Conan → vcpkg → nix-cmake-scan), running a
|
||||
// real `cmd_build` against each candidate via verify_link. On success the
|
||||
// overlay carries a confirmed row for the package.
|
||||
// Drives the resolver chain (Conan → vcpkg → nix-cmake-scan → pc-scan),
|
||||
// running a real `cmd_build` against each candidate via verify_link.
|
||||
// On success the overlay carries a confirmed row for the package.
|
||||
// Every probe's scratch project is preserved under
|
||||
// `<XDG>/cargoxx/last-failure/<name>/<NN>-<probe>/` for inspection;
|
||||
// the dir is wiped clean at the start of each call.
|
||||
auto run_auto_resolution(const std::string& name, const std::string& version,
|
||||
const std::vector<std::string>& components,
|
||||
const fs::path& overlay_path) -> util::Result<void> {
|
||||
@@ -87,17 +90,18 @@ auto run_auto_resolution(const std::string& name, const std::string& version,
|
||||
return cmd_build(root, /*no_build=*/false, /*release=*/false,
|
||||
/*target=*/std::nullopt, overlay_path);
|
||||
};
|
||||
const auto scratch_root =
|
||||
std::filesystem::temp_directory_path() /
|
||||
std::format("cargoxx-discover-{}", std::random_device{}());
|
||||
const auto scratch_root = resolver::last_failure_dir(name);
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(scratch_root, ec);
|
||||
std::filesystem::create_directories(scratch_root, ec);
|
||||
|
||||
auto disc = resolver::discover(name, version, components, overlay_path,
|
||||
scratch_root, build_fn);
|
||||
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(scratch_root, ec);
|
||||
|
||||
if (!disc) {
|
||||
std::cerr << std::format(
|
||||
"note: every probe attempt's scratch project is preserved at\n"
|
||||
" {}/ — re-run cmake inside any subdir to reproduce.\n",
|
||||
scratch_root.string());
|
||||
return std::unexpected(disc.error());
|
||||
}
|
||||
return {};
|
||||
|
||||
@@ -160,14 +160,17 @@ auto cmd_build(const fs::path& project_root, bool no_build, bool release,
|
||||
return cmd_build(root, /*no_build=*/false, /*release=*/false,
|
||||
/*target=*/std::nullopt, effective_overlay);
|
||||
};
|
||||
const auto scratch_root =
|
||||
std::filesystem::temp_directory_path() /
|
||||
std::format("cargoxx-discover-{}", std::random_device{}());
|
||||
auto disc = resolver::discover(name, version, components,
|
||||
effective_overlay, scratch_root, build_fn);
|
||||
const auto scratch_root = resolver::last_failure_dir(name);
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(scratch_root, ec);
|
||||
std::filesystem::create_directories(scratch_root, ec);
|
||||
auto disc = resolver::discover(name, version, components,
|
||||
effective_overlay, scratch_root, build_fn);
|
||||
if (!disc) {
|
||||
std::cerr << std::format(
|
||||
"note: every probe attempt's scratch project is preserved at\n"
|
||||
" {}/ — re-run cmake inside any subdir to reproduce.\n",
|
||||
scratch_root.string());
|
||||
return std::unexpected(disc.error());
|
||||
}
|
||||
return {};
|
||||
|
||||
Reference in New Issue
Block a user