[M7] lockfile carries full recipe (find_package, targets, pkg_config_module, brute_force_*)
This commit is contained in:
@@ -79,6 +79,33 @@ auto parse_package(const toml::table& tbl, const std::filesystem::path& path)
|
||||
if (auto v = tbl["linkdb_source"].value<std::string>()) {
|
||||
pkg.linkdb_source = *v;
|
||||
}
|
||||
if (auto v = tbl["find_package"].value<std::string>()) {
|
||||
pkg.find_package = *v;
|
||||
}
|
||||
if (const auto* arr = tbl["targets"].as_array()) {
|
||||
auto r = extract_string_array(*arr, "targets", path);
|
||||
if (!r) {
|
||||
return std::unexpected(r.error());
|
||||
}
|
||||
pkg.targets = std::move(*r);
|
||||
}
|
||||
if (auto v = tbl["pkg_config_module"].value<std::string>()) {
|
||||
pkg.pkg_config_module = *v;
|
||||
}
|
||||
if (const auto* arr = tbl["brute_force_libs"].as_array()) {
|
||||
auto r = extract_string_array(*arr, "brute_force_libs", path);
|
||||
if (!r) {
|
||||
return std::unexpected(r.error());
|
||||
}
|
||||
pkg.brute_force_libs = std::move(*r);
|
||||
}
|
||||
if (const auto* arr = tbl["brute_force_includes"].as_array()) {
|
||||
auto r = extract_string_array(*arr, "brute_force_includes", path);
|
||||
if (!r) {
|
||||
return std::unexpected(r.error());
|
||||
}
|
||||
pkg.brute_force_includes = std::move(*r);
|
||||
}
|
||||
|
||||
return pkg;
|
||||
}
|
||||
@@ -149,6 +176,33 @@ auto write(const Lockfile& lock, const std::filesystem::path& path) -> util::Res
|
||||
if (p.linkdb_source) {
|
||||
tbl.insert_or_assign("linkdb_source", *p.linkdb_source);
|
||||
}
|
||||
if (p.find_package) {
|
||||
tbl.insert_or_assign("find_package", *p.find_package);
|
||||
}
|
||||
if (!p.targets.empty()) {
|
||||
toml::array arr;
|
||||
for (const auto& t : p.targets) {
|
||||
arr.push_back(t);
|
||||
}
|
||||
tbl.insert_or_assign("targets", std::move(arr));
|
||||
}
|
||||
if (p.pkg_config_module) {
|
||||
tbl.insert_or_assign("pkg_config_module", *p.pkg_config_module);
|
||||
}
|
||||
if (!p.brute_force_libs.empty()) {
|
||||
toml::array arr;
|
||||
for (const auto& l : p.brute_force_libs) {
|
||||
arr.push_back(l);
|
||||
}
|
||||
tbl.insert_or_assign("brute_force_libs", std::move(arr));
|
||||
}
|
||||
if (!p.brute_force_includes.empty()) {
|
||||
toml::array arr;
|
||||
for (const auto& i : p.brute_force_includes) {
|
||||
arr.push_back(i);
|
||||
}
|
||||
tbl.insert_or_assign("brute_force_includes", std::move(arr));
|
||||
}
|
||||
packages.push_back(std::move(tbl));
|
||||
}
|
||||
root.insert_or_assign("package", std::move(packages));
|
||||
|
||||
Reference in New Issue
Block a user