[M8] cargoxx-git dependencies: { git = ..., rev = ... } deps

This commit is contained in:
2026-05-17 18:31:13 +00:00
parent e6c39914b3
commit 09f151ad82
12 changed files with 310 additions and 28 deletions

View File

@@ -112,6 +112,15 @@ auto parse_package(const toml::table& tbl, const std::filesystem::path& path)
if (auto v = tbl["source_path"].value<std::string>()) {
pkg.source_path = *v;
}
if (auto v = tbl["source_git_url"].value<std::string>()) {
pkg.source_git_url = *v;
}
if (auto v = tbl["source_git_commit"].value<std::string>()) {
pkg.source_git_commit = *v;
}
if (auto v = tbl["source_git_sha256"].value<std::string>()) {
pkg.source_git_sha256 = *v;
}
return pkg;
}
@@ -227,6 +236,15 @@ auto write(const Lockfile& lock, const std::filesystem::path& path) -> util::Res
if (p.source_path) {
tbl.insert_or_assign("source_path", *p.source_path);
}
if (p.source_git_url) {
tbl.insert_or_assign("source_git_url", *p.source_git_url);
}
if (p.source_git_commit) {
tbl.insert_or_assign("source_git_commit", *p.source_git_commit);
}
if (p.source_git_sha256) {
tbl.insert_or_assign("source_git_sha256", *p.source_git_sha256);
}
packages.push_back(std::move(tbl));
}
root.insert_or_assign("package", std::move(packages));

View File

@@ -18,10 +18,15 @@ struct LockfilePackage {
std::optional<std::string> pkg_config_module;
std::vector<std::string> brute_force_libs;
std::vector<std::string> brute_force_includes;
// For cargoxx-source deps (not nixpkgs/linkdb-resolved). v1 supports
// "cargoxx-path"; "cargoxx-git" / "cargoxx-registry" land in 1c/1d.
// For cargoxx-source deps (not nixpkgs/linkdb-resolved).
// "cargoxx-path" → source_path only
// "cargoxx-git" → source_git_url + source_git_commit + source_git_sha256
// "cargoxx-registry" → (1d)
std::optional<std::string> source_kind;
std::optional<std::string> source_path;
std::optional<std::string> source_git_url;
std::optional<std::string> source_git_commit;
std::optional<std::string> source_git_sha256;
bool operator==(const LockfilePackage&) const = default;
};