Skip to content

feat(asyncplusplus): add Amanieu/asyncplusplus LLAR formula - #120

Open
fennoai[bot] wants to merge 1 commit into
mainfrom
fennoai/issue-52-1785407817
Open

feat(asyncplusplus): add Amanieu/asyncplusplus LLAR formula#120
fennoai[bot] wants to merge 1 commit into
mainfrom
fennoai/issue-52-1785407817

Conversation

@fennoai

@fennoai fennoai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Summary

Adds Amanieu/asyncplusplus to llarhub, translated from the Conan Center asyncplusplus recipe (version 1.2, snapshot ffe30df).

Closes #52.

Formula design

  • fromVer "v1.1" — the Conan all recipe folder serves 1.1 and 1.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.
  • No 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 no requirements.
  • onBuild — builds the static library with the CMake helper (BUILD_SHARED_LIBS=OFF, matching the Conan shared=False default; upstream then defines LIBASYNC_STATIC on the target). Uses CMAKE_POLICY_VERSION_MINIMUM=3.5 because upstream declares cmake_minimum_required(VERSION 3.1). Installs the complete public interface (include/async++.h, include/async++/*.h, lib/libasync++.a, CMake package config) into ctx.outputDir.
  • Metadata — upstream installs no pkg-config file, so consumer flags are derived from the installed interface: -DLIBASYNC_STATIC -lasync++ -lpthread (the define and pthread link match both upstream CMake and the Conan package_info).
  • onTest — compiles and runs a small consumer derived from the Conan test_package (spawn / then / when_all / parallel_reduce) against the installed artifacts, in an independent _test build tree so it also passes on a cache hit.

Note on the shared option

The Conan recipe exposes a shared option, but llar v0.3.0 provides no way to read the active matrix selection inside a formula (Context has no CurrentMatrix), 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 from github.com/goplus/llar/cmd/llar@v0.3.0) all passing:

Selection os/arch Result
@v1.2 (Conan 1.2) linux / amd64 build + test + metadata ✅
@v1.1 (range boundary) linux / amd64 build + test + metadata ✅
@v1.2 re-run linux / amd64 cache hit, onTest only ✅
@v1.2 linux / arm64 build + test + metadata ✅

The consumer prints async++ ok: 10 and exits 0 in every case; metadata resolves to -DLIBASYNC_STATIC -lasync++ -lpthread.

Scope

Change is limited to the Amanieu/asyncplusplus module files (versions.json, v1.1/Asyncplusplus_llar.gox). No generic Conan importer and no changes to the formula skill.

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>

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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) matches OnBuild(func(ctx *Context)).
  • onTest ctx => { matches OnTest(func(ctx *Context)) (post-build verification hook).
  • ctx.setMetadata matches func (c *Context) SetMetadata(...).
  • installDir := ctx.outputDir matches OutputDir__0() string (now returns a bare string, no error).
  • c.configure / c.build / c.install as bare statements are correct — these cmake methods return no error.
  • Asyncplusplus_llar.gox casing matches the current convention (Liba_llar.gox, Jsondep_llar.gox, local Zlib_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

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

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.

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 asyncplusplus recipe to LLAR

0 participants