[M5+] add resolver::vcpkg_probe

This commit is contained in:
2026-05-10 10:23:57 +00:00
parent e5c173b466
commit 941d5b3284
8 changed files with 319 additions and 2 deletions

View File

@@ -71,4 +71,22 @@ auto parse_conanfile(std::string_view conanfile_text, const std::string& fallbac
// ResolutionNetworkError.
auto conan_probe(const std::string& name) -> util::Result<ConanRecipe>;
// Output of a microsoft/vcpkg port usage-file scrape.
struct VcpkgRecipe {
std::string find_package; // e.g. "fmt CONFIG REQUIRED"
std::vector<std::string> targets; // e.g. ["fmt::fmt"]
};
// Pure: scrape a vcpkg port `usage` file (plain CMake) for the first
// find_package(...) arguments and the targets named in the corresponding
// target_link_libraries(...) call. Returns ResolutionUnknownPackage when
// no find_package directive appears.
auto parse_vcpkg_usage(std::string_view usage_text)
-> util::Result<VcpkgRecipe>;
// Fetches https://raw.githubusercontent.com/microsoft/vcpkg/master/ports/<name>/usage
// via `curl` and feeds it through parse_vcpkg_usage. 404 →
// ResolutionUnknownPackage; transport errors → ResolutionNetworkError.
auto vcpkg_probe(const std::string& name) -> util::Result<VcpkgRecipe>;
} // namespace cargoxx::resolver