Skip to content

feat(args): add LLAR formula - #127

Open
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:issue/112-mbits-args
Open

feat(args): add LLAR formula#127
MeteorsLiu wants to merge 1 commit into
xgo-dev:mainfrom
MeteorsLiu:issue/112-mbits-args

Conversation

@MeteorsLiu

Copy link
Copy Markdown
Collaborator

Add an LLAR Formula for mbits-libs/args across the verified v0.10.0 through v0.12.3 range.

The implementation includes:

  • Keep the legacy CMake contract at v0.10.0 and add the upstream export/install patch from v0.12.1 onward.
  • Publish the header-only consumer metadata without inventing dependencies or a comparator.
  • Add an independent C++ consumer test using the installed args target.
  • Validate every served upstream version, reject v0.9.9, and re-run v0.12.3 against the cache-hit install.

This completes the closed mbits-args translation with version-specific install behavior and verified consumer coverage.

Closes #112

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.cmakembits::args).

A few points below are worth addressing before merge; none are blocking.

Comment on lines +86 to +88
patchFile := ctx.SourceDir+"/_llar.patch"

os.writeFile(patchFile, []byte(sourcePatch), 0644)!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Comment on lines +113 to +114
tc.build

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Translate Conan Center mbits-args recipe to LLAR

1 participant