[M5+] add resolver::conan_probe

This commit is contained in:
2026-05-10 10:14:38 +00:00
parent e63ac69239
commit e5c173b466
8 changed files with 352 additions and 2 deletions

View File

@@ -51,4 +51,24 @@ auto nix_cmake_scan(const std::filesystem::path& store_path,
const std::string& package_name)
-> util::Result<NixCmakeCandidate>;
// Output of a conan-center-index recipe scrape.
struct ConanRecipe {
std::string find_package; // e.g. "fmt CONFIG REQUIRED"
std::vector<std::string> targets; // e.g. ["fmt::fmt"]
};
// Pure: scrapes a conanfile.py text for `cmake_target_name` and
// `cmake_file_name`. Handles both the modern
// `cpp_info.set_property("cmake_target_name", "...")` form and the
// legacy `cpp_info.names["cmake_find_package"] = "..."` form. Returns
// ResolutionUnknownPackage when no recognizable recipe is found.
auto parse_conanfile(std::string_view conanfile_text, const std::string& fallback_name)
-> util::Result<ConanRecipe>;
// Fetches https://raw.githubusercontent.com/conan-io/conan-center-index/
// master/recipes/<name>/all/conanfile.py via `curl` and feeds it through
// parse_conanfile. 404 → ResolutionUnknownPackage; transport errors →
// ResolutionNetworkError.
auto conan_probe(const std::string& name) -> util::Result<ConanRecipe>;
} // namespace cargoxx::resolver