[M6] populate Cargoxx.toml; add 'cargoxx linkdb add' CLI; codegen fixes for self-host
This commit is contained in:
@@ -111,7 +111,7 @@ auto emit_library(const layout::Target& lib, const std::string& package_name,
|
||||
out += std::format("add_library({} STATIC)\n", package_name);
|
||||
out += std::format("target_sources({}\n", package_name);
|
||||
out += " PUBLIC\n";
|
||||
out += " FILE_SET CXX_MODULES FILES\n";
|
||||
out += " FILE_SET CXX_MODULES BASE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/.. FILES\n";
|
||||
for (const auto& m : lib.module_units) {
|
||||
out += std::format(" {}\n", rel_to_build(m, project_root));
|
||||
}
|
||||
|
||||
@@ -59,25 +59,24 @@ auto find_lockfile_ref(const lockfile::Lockfile& lock, const std::string& name,
|
||||
|
||||
auto build_bindings(const GenerateInputs& in) -> std::vector<DepBinding> {
|
||||
std::vector<DepBinding> out;
|
||||
out.reserve(in.manifest.dependencies.size());
|
||||
for (std::size_t i = 0; i < in.manifest.dependencies.size(); ++i) {
|
||||
const auto& dep = in.manifest.dependencies[i];
|
||||
const auto& rec = in.recipes[i];
|
||||
out.reserve(in.manifest.dependencies.size() + in.manifest.dev_dependencies.size());
|
||||
auto push = [&](const manifest::Dependency& dep, const linkdb::Recipe& rec) {
|
||||
auto ref = find_lockfile_ref(in.lock, dep.name, dep.version_spec);
|
||||
// For pinned deps the lockfile's nixpkgs_attr is authoritative
|
||||
// (it came from devbox's attr_paths for this specific rev). The
|
||||
// curated recipe's attr only applies to nixos-unstable, so it's
|
||||
// wrong when the dep pulls from a different rev.
|
||||
std::string attr = (ref.attr && !ref.attr->empty()) ? *ref.attr
|
||||
: rec.nixpkgs_attr;
|
||||
DepBinding b{
|
||||
out.push_back(DepBinding{
|
||||
.name = dep.name,
|
||||
.version = dep.version_spec,
|
||||
.nixpkgs_attr = std::move(attr),
|
||||
.sanitized = sanitize_input_attr(dep.name, dep.version_spec),
|
||||
.rev = std::move(ref.rev),
|
||||
};
|
||||
out.push_back(std::move(b));
|
||||
});
|
||||
};
|
||||
for (std::size_t i = 0; i < in.manifest.dependencies.size(); ++i) {
|
||||
push(in.manifest.dependencies[i], in.recipes[i]);
|
||||
}
|
||||
for (std::size_t i = 0; i < in.manifest.dev_dependencies.size(); ++i) {
|
||||
push(in.manifest.dev_dependencies[i], in.dev_recipes[i]);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user