feat(args): add LLAR formula - #127
Conversation
There was a problem hiding this comment.
Review: mbits-libs/args recipes
Two new .gox build recipes (v0.10.0, v0.12.1) plus versions.json. The recipes are clean and follow the established structure: versions.json matches the peer shape, both onTest blocks build the consumer in an independent _llar_consumer tree (cache-hit safe, as the cglm/json-c recipes document), and the v0.12.1 export patch is internally consistent (install(EXPORT mbits ...) → lib/cmake/mbits.cmake → mbits::args).
A few points below are worth addressing before merge; none are blocking.
| patchFile := ctx.SourceDir+"/_llar.patch" | ||
|
|
||
| os.writeFile(patchFile, []byte(sourcePatch), 0644)! |
There was a problem hiding this comment.
[P1] git apply is not idempotent on re-run / cache-hit rebuilds
onBuild writes and applies the source patch unconditionally against ctx.SourceDir. If onBuild ever runs again against an already-patched tree (a reused/cached source checkout, a partial cache, or a retried build), git apply fails with "patch does not apply", and the following lastErr! aborts the build. Consider guarding the step so it is safe to re-run, e.g. skip when git apply --reverse --check succeeds (patch already applied), or apply with git apply --3way. The sibling recipes deliberately structure their steps to survive cache hits.
| tc.build | ||
|
|
There was a problem hiding this comment.
[P2] Test asserts only exit code, not the computed result
The consumer prints 6 for --sum 1 2 3, but the test only checks the process exit status. A build that links and runs yet computes the wrong result (or silently ignores --sum) would still pass. Capturing stdout via capout and asserting it equals 6 — as the cglm/json-c recipes do for their pkg-config queries — would turn this into a functional test rather than a smoke test. Applies identically to the v0.10.0 recipe (lines 80-81).
| "strings" | ||
| ) | ||
|
|
||
| const consumerSource = `#include <args/parser.hpp> |
There was a problem hiding this comment.
[P3] Consumer C++ source duplicated verbatim across both versions
consumerSource (lines 6-38) is byte-identical to the same block in v0.10.0/args_llar.gox, so a fix must be made in two places and can drift. If the recipe format offers no shared-include mechanism this is an accepted constraint — but worth confirming, and otherwise a brief comment noting the intentional duplication would help maintainers.
|
|
||
| const consumerCMakeLists = `cmake_minimum_required(VERSION 3.12) | ||
| project(args_consumer LANGUAGES CXX) | ||
| set(CMAKE_CXX_STANDARD 17) |
There was a problem hiding this comment.
[P3] Recipes lack the explanatory comments peer recipes carry
Both new files have no comments, whereas the cglm and json-c recipes document the build contract, option rationale, metadata strategy, and cache-hit-safe test design. The v0.12.1 sourcePatch in particular (why the export target and BUILD/INSTALL interface generator expressions are needed, and why v0.10.0 links args by raw path while v0.12.1 uses the installed CMake export) is the least self-explanatory part of the change and would benefit most from a short comment. Bringing these up to the repo's documentation bar aids future maintenance.
Add an LLAR Formula for
mbits-libs/argsacross the verifiedv0.10.0throughv0.12.3range.The implementation includes:
v0.10.0and add the upstream export/install patch fromv0.12.1onward.argstarget.v0.9.9, and re-runv0.12.3against the cache-hit install.This completes the closed mbits-args translation with version-specific install behavior and verified consumer coverage.
Closes #112