hook library
For build hooks of the emon packages (hook/build.dart): fetch the prebuilt C library, verify it, and declare its files as code assets.
WHERE THE LIBRARIES COME FROM, in order:
- a local directory (development, CI, offline): the hook user-define
native_dirof the package (pubspechooks: user_defines:), or the environment variableEMON_NATIVE_DIR. It is the directory that holds the archivesbb package --host c/bb mobilewrite (emon-c-<version>-<triple>.tar.gz), or one such archive, or an unpacked archive (it haslib/). - the release:
https://github.com/3sln/emon/releases/download/v<version>/emon-c-<version>-<triple>.tar.gz, verified against the SHA-256 table generated into the package at release time (kNativeAssets); an archive that does not match is never used. A table with no entry for the target (a checkout, or a target a release does not ship) is an error that says so.
The user-define native_dir of the package whose hook runs wins over the environment, and a hook run by flutter build sees a stripped
environment, so an app that needs a local directory sets the user-define for each emon package (or the one they all share).
Classes
- NativeArchive
-
One archive:
emon-c-<version>-<triple>.tar.gzand what it must hash to. - NativeAssetTable
-
The table of a release, by target triple. Generated at release time from the release's
SHA256SUMS(bb dart --sha-table): the committed table is empty, so a build from a checkout names a local directory of libraries instead (resolveNativeSource). - NativeLibrary
- One library to bundle.
Functions
-
addNativeAssets(
BuildInput input, BuildOutputBuilder output, List< NativeLibrary> libraries) → Future<void> -
Fetch (or find) the C library for the target of
input, and declare each oflibrariesas a bundled code asset of its package. -
resolveNativeSource(
BuildInput input, BuildOutputBuilder output, String triple) → Future< String> -
The root of an unpacked archive for
triple: a local directory (see the library comment), else the release's, downloaded and verified. -
targetTriple(
CodeConfig code) → String? -
The target triple of a code config (the names
bb nativeand the release archives use), or null for a target emon does not ship a library for and an app can build anyway: the Intel iOS simulator (DEVLOG D885: Flutter builds both simulator slices; the Apple-silicon one is what runs on a Mac of this decade). An app built only for it fails at run time, by name.