9.1 KiB
9.1 KiB
Changelog
All notable changes to cargoxx will be documented in this file.
[Unreleased]
Added
- M0 repo skeleton: hand-written
CMakeLists.txt, bootstrapflake.nix, empty C++23 module units for every component listed inTECH_SPEC.md§1 (util,exec,manifest,lockfile,layout,linkdb,resolver,codegen,cli), root modulecargoxx, and a stubmain.cppthat builds an emptycargoxxbinary. .clang-format(LLVM, 100-column) and.gitignore.SPEC.md,TECH_SPEC.md.- M1 foundation in
cargoxx.util:ErrorCode(numbers perTECH_SPEC.md§4),Error,Result<T> = std::expected<T, Error>, andformat(Error)renderingerror[Ennnn]: ...with optional--> path:line:colandhint:lines.formatlives insrc/util/error.cppas a module implementation unit. Catch2 v3wired throughflake.nix(libc++-built override) and registered in CMake;tests/util_error.cppcovers six format cases viacatch_discover_tests.cargoxx.manifestpublic types (Package,Dependency,BuildSettings,Edition,Manifest) andparse(path)returningResult<Manifest>, backed by toml++ vendored asthird_party/toml.hpp. Unknown keys in[package]/[build]and unknown top-level keys are rejected; reserved fields (description,repository,[dev-dependencies],[features],[workspace]) are accepted.tests/manifest_parse.cppcovers 17 cases.manifest::write(m, path)serializes aManifestas TOML using toml++. Dependencies are emitted alphabetically (matches Cargo). Round-trip property is exercised bytests/manifest_write.cpp(9 cases). Defaultedoperator==on the manifest structs supports comparison.cargoxx.layoutpublic types (Target,TargetKind,DiscoveredLayout) anddiscover(project_root, package_name). Walkssrc/recursively for the library (excluding thesrc/bin/subtree), enumeratessrc/main.cpp,src/bin/*.cpp,tests/*.cpp,examples/*.cppflat, sorts results for deterministic output, and returnsLayoutNoTargetwhen neither a library nor any binary is present.tests/layout_discovery.cppcovers 12 cases.cargoxx new <name>andcargoxx new --lib <name>scaffold a project directory withCargoxx.toml,src/main.cpporsrc/lib.cppm, and a minimal.gitignore. Hyphens in the package name are mapped to underscores when generating the module/namespace identifier. Codegen offlake.nix/CMakeLists.txtis intentionally deferred to M3. CLI11 v2.6.2 vendored atthird_party/CLI11.hpp; entry point is nowcargoxx::cli::run(argc, argv).tests/cmd_new.cppcovers 9 cases.util::satisfies(version, range)— minimal semver range matcher supporting*,==/>=/<=/>/<operators, and comma-separated AND clauses. Versions are zero-padded to three components.tests/semver_satisfies.cppcovers 7 cases.cargoxx.linkdb:Recipe,Database::open(),Database::resolve(...)for curated lookups. The curated database ships atdata/linkdb.jsonwith all 25 packages fromSPEC.md§11. Component-substitution helpers expand{{components}}(space-joined) infind_packageand fan out{{component}}per-target. Path is injected via theCARGOXX_LINKDB_DEFAULT_PATHcompile definition. nlohmann/json 3.12.0 vendored atthird_party/json.hpp. SQLite overlay andadd_manualare deferred to the M2 follow-up commit.tests/linkdb_lookup.cppcovers 13 cases including a smoke test that resolves all 25 curated packages.cargoxx.lockfile:Lockfile,LockfilePackagetypes andparse(path)/write(lock, path)matching the format inSPEC.md§5. AlsoLockfile::nixpkgs_rev()returns the shared revision (codegen will consume this in M3).tests/lockfile_round_trip.cppcovers 9 cases.cargoxx.codegen:GenerateInputsplus the pure functionflake_nix(in) -> std::string. Substitutes the package name, the resolved nixpkgs revision (defaulting tonixos-unstablewhen the lockfile pins none), and a deduplicated list of depnixpkgs_attrentries intobuildInputs. Output is byte-deterministic.tests/codegen_flake.cppcovers 7 cases. Note: SPEC §7's template did not showbuildInputs; we add one betweennativeBuildInputsand theenv.NIX_CFLAGS_COMPILEblock as the natural slot for the deps that TECH_SPEC §10 says we splice in.codegen::cmake_lists(in) -> std::stringperSPEC.md§8 andTECH_SPEC.md§9:find_packageper dep, optional library target with module units + private impl sources, primary binary<pkg>_binlinked against the library, additional binaries fromsrc/bin/, tests withenable_testing()+add_test, examples, and[build]honoringwarnings_as_errorsandsanitizers. Source paths emitted relative tobuild/(i.e. prefixed with../). Output is deterministic.tests/codegen_cmake.cppcovers 11 cases.cargoxx add <pkg>[@<version>] [--components a,b]editsCargoxx.toml, validates the new dep against the curated linkdb (so unknown packages and missing components fail before any disk write), and rejects already-declared deps. Version is now optional; an omitted version is stored as"*"and resolves against the linkdb's first matching recipe. Generatedflake.nixcontinues to track thenixos-unstablebranch when the lockfile carries no rev.util::satisfiestreatsversion == "*"as a match against any range, mirroring the existingrange == "*"shortcut.cargoxx remove <pkg>drops a declared dep fromCargoxx.toml, errors when the dep is not declared. Other deps are preserved.- End-to-end verified on a freshly-scaffolded project.
tests/cmd_add.cppandtests/cmd_remove.cppcover 9 cases. Known cosmetic issue: toml++ writes top-level sections alphabetically, so[package]may end up after[dependencies]post-mutation; logged for M6 polish. cargoxx run [--release] [--bin <name>] [-- <args>...],cargoxx test [--release], andcargoxx clean.runbuilds first, picks the binary (errors with the available list when the project has multiple bins and--binis omitted), and execs it with the process exit code propagated.testinvokesnix develop -c ctest --test-dir build/<profile> --output-on-failure.cleanremovesbuild/while leavingCargoxx.lockandflake.lockintact. End-to-end verified against a freshly-scaffolded project.tests/cmd_run.cppandtests/cmd_clean.cppcover 6 cases.cargoxx build(without--no-build) now drives the full build:nix develop -c cmake -B build/<profile> -S build -G Ninja -DCMAKE_BUILD_TYPE=<Profile>thennix develop -c cmake --buildwith optional--target, both withinherit_stdio = trueso the user sees compilation output live. Non-zero cmake exit returnsBuildCmakeFailed. End-to-end verified:cargoxx new myapp && cargoxx buildproduces a workingbuild/debug/myappthat printsHello from myapp!.- Generated
build/CMakeLists.txtnow opts into the experimentalimport std;UUID +CMAKE_CXX_MODULE_STD ON, and setsCMAKE_CXX_EXTENSIONS ON(deviation from SPEC §8 — required for libc++'s std module to load withoutmodule-file-config-mismatchon clang 21). Without these the templates fromcargoxx newfail to compile. cargoxx.exec:ExecResult,ExecOptions, andrun(program, args, opts)— argv-only subprocess wrapper around reproc 14.2.4. Captures stdout/stderr (or inherits stdio whenopts.inherit_stdiois set), supportscwd,env_overrides, and atimeout(enforced viareproc_options.deadlineso drains returnREPROC_ETIMEDOUTinstead of blocking on long-lived streams). On destruction reproc terminates and then kills any still-running child. ReturnsExecToolNotFoundforENOENTandExecCommandFailedfor other failures including timeouts.tests/exec_run.cppcovers 9 cases.cargoxx build --no-buildend-to-end. ReadsCargoxx.toml, discovers the layout, opens the curated linkdb, resolves aRecipeper manifest dep, synthesizes a freshCargoxx.lock, and writesflake.nix,build/CMakeLists.txt, andCargoxx.lock. With no resolver yet (M5),nixpkgs_revis left null and the generated flake falls back to thenixos-unstablebranch. Without--no-build, the command still generates files but returns aNotImplementederror pointing at M4.tests/cmd_build.cppcovers 8 cases.- SQLite overlay:
Database::open(overlay_path)now opens (and creates, if missing) a per-userlinkdb.sqlitecache, applying the schema fromSPEC.md§9 idempotently. Default path is$XDG_CACHE_HOME/cargoxx/linkdb.sqlite(falling back to$HOME/.cache/cargoxx/...); tests pass an explicit temp path so they never touch the user cache.Database::add_manual(pkg, range, recipe)inserts a row withsource = 'manual'andverified_at = now();resolve()consults the overlay first and falls back to curated when no overlay row matches the requested version range. Manual entries never expire;nix-probe(v0.2) entries respect a 30-day freshness window.tests/linkdb_overlay.cppcovers 7 cases (insert/persist, override-curated, version-range gating, components rejection, move semantics).