feat(asyncplusplus): add Amanieu/asyncplusplus LLAR formula - #120
feat(asyncplusplus): add Amanieu/asyncplusplus LLAR formula#120fennoai[bot] wants to merge 1 commit into
Conversation
Translate the Conan Center asyncplusplus recipe (version 1.2) into an idiomatic LLAR formula. - fromVer v1.1: the Conan "all" folder serves 1.1 and 1.2, and both upstream tags share an identical CMake build/install contract. - No onRequire: upstream declares no external packages; it only needs the system threads library (find_package(Threads)). - onBuild builds the static library via the CMake helper (BUILD_SHARED_LIBS OFF, matching the Conan shared=False default) and installs the full public interface into ctx.outputDir. - Metadata is derived from the installed interface (no pkg-config file upstream): -DLIBASYNC_STATIC -lasync++ -lpthread. - onTest compiles and runs a small consumer (derived from the Conan test_package) against the installed artifacts in an independent build tree so it also passes on a cache hit. Verified with `llar test -v` for v1.2 and v1.1 (host --os/--arch linux with amd64 and arm64), plus a cache-hit re-run exercising onTest against cached artifacts. Closes #52 Co-authored-by: fennoai[bot] <231223108+fennoai[bot]@users.noreply.github.com> Co-authored-by: MeteorsLiu <17515813+MeteorsLiu@users.noreply.github.com>
There was a problem hiding this comment.
Review: Amanieu/asyncplusplus formula
I verified the formula against the current upstream goplus/llar DSL (formula/classfile.go, formula/project.go, x/cmake/cmake.go) and the current demo/testdata formulas, not just the local .claude/skills/write-formula/SKILL.md, which is out of date relative to the shipped API.
The formula conforms to the current API. Note for anyone cross-referencing the local skill doc — these are all correct as written and should not be "fixed":
onBuild ctx => {(single param) matchesOnBuild(func(ctx *Context)).onTest ctx => {matchesOnTest(func(ctx *Context))(post-build verification hook).ctx.setMetadatamatchesfunc (c *Context) SetMetadata(...).installDir := ctx.outputDirmatchesOutputDir__0() string(now returns a bare string, no error).c.configure/c.build/c.installas bare statements are correct — thesecmakemethods return no error.Asyncplusplus_llar.goxcasing matches the current convention (Liba_llar.gox,Jsondep_llar.gox, localZlib_llar.gox).
The build logic (Release, CMAKE_POLICY_VERSION_MINIMUM shim, static lib via BUILD_SHARED_LIBS=OFF, derived -DLIBASYNC_STATIC -lasync++ -lpthread metadata) and the cache-safe independent _test build tree are sound. exec is used in the safe variadic (non-shell) form, and file modes (0o755/0o644) are conventional — no security concerns.
One suggestion (non-blocking, inline): the cmake build runs single-threaded because CMake.Build does not add a parallel flag by default.
No blocking issues.
| c.defineBool "BUILD_SHARED_LIBS", false | ||
|
|
||
| c.configure | ||
| c.build |
There was a problem hiding this comment.
Optional performance improvement: c.build compiles single-threaded here. CMake.Build (in x/cmake/cmake.go) runs cmake --build <dir> --config Release with no --parallel/-j, so only one core is used for the whole compile.
Consider c.build "--parallel" (portable; CMake picks the core count) to speed up the build. Non-blocking.
Summary
Adds
Amanieu/asyncplusplusto llarhub, translated from the Conan Centerasyncplusplusrecipe (version1.2, snapshotffe30df).Closes #52.
Formula design
fromVer "v1.1"— the Conanallrecipe folder serves1.1and1.2; both upstream tags (v1.1,v1.2) share an identical CMake build/install contract (verified against each revision), so a single formula covers the range.onRequire— upstream declares no external packages. It only needs the system threads library (find_package(Threads)), which is resolved by the toolchain, not an LLAR dependency. This matches the Conan recipe, which has norequirements.onBuild— builds the static library with the CMake helper (BUILD_SHARED_LIBS=OFF, matching the Conanshared=Falsedefault; upstream then definesLIBASYNC_STATICon the target). UsesCMAKE_POLICY_VERSION_MINIMUM=3.5because upstream declarescmake_minimum_required(VERSION 3.1). Installs the complete public interface (include/async++.h,include/async++/*.h,lib/libasync++.a, CMake package config) intoctx.outputDir.-DLIBASYNC_STATIC -lasync++ -lpthread(the define andpthreadlink match both upstream CMake and the Conanpackage_info).onTest— compiles and runs a small consumer derived from the Conantest_package(spawn/then/when_all/parallel_reduce) against the installed artifacts, in an independent_testbuild tree so it also passes on a cache hit.Note on the
sharedoptionThe Conan recipe exposes a
sharedoption, but llarv0.3.0provides no way to read the active matrix selection inside a formula (Contexthas noCurrentMatrix), so a functional shared/static toggle cannot be verified. The formula therefore produces the default static build only, rather than claiming an unverifiable option.Validation
llar test -v(built fromgithub.com/goplus/llar/cmd/llar@v0.3.0) all passing:@v1.2(Conan1.2)@v1.1(range boundary)@v1.2re-runonTestonly ✅@v1.2The consumer prints
async++ ok: 10and exits 0 in every case; metadata resolves to-DLIBASYNC_STATIC -lasync++ -lpthread.Scope
Change is limited to the
Amanieu/asyncplusplusmodule files (versions.json,v1.1/Asyncplusplus_llar.gox). No generic Conan importer and no changes to the formula skill.