native_prebuilt 0.0.10 copy "native_prebuilt: ^0.0.10" to clipboard
native_prebuilt: ^0.0.10 copied to clipboard

Reusable infrastructure for Dart packages that ship prebuilt native libraries from GitHub or GitLab releases. Provides build-hook integration, manifest generation, download/verify/cache pipelines, and [...]

native_prebuilt #

Reusable infrastructure for Dart packages that ship prebuilt native libraries from GitHub or GitLab releases.

What it provides #

  • PrebuiltCodeAssetBuilder for hook/build.dart
  • PrebuiltManifest / PrebuiltArtifact immutable release metadata
  • ArtifactInstaller for download → verify → extract → validate → cache
  • PrebuiltResolver chain for override / local / cached / downloaded prebuilts
  • NativeBinaryInspector and library-name helpers
  • CLI tooling for manifest generation, fetch, verification, and workflow templates
  • Reusable GitHub Actions workflow templates

Install #

dependencies:
  native_prebuilt: ^0.0.10

Hook usage #

import 'package:hooks/hooks.dart';
import 'package:native_prebuilt/hooks.dart';
import 'package:my_package/src/hook/prebuilts.g.dart';

void main(List<String> args) async {
  await build(args, (input, output) async {
    await PrebuiltCodeAssetBuilder(
      assetName: 'my_bindings.dart',
      libraryStem: 'mylib',
      manifest: myPrebuilts,
      linkModeResolver: (_) => DynamicLoadingBundled(),
      fallback: CallbackBuilder((input, output) async {
        // build from source
      }),
    ).run(input: input, output: output, logger: null);
  });
}

Manifest format #

native_prebuilt expects a YAML config file like:

schema: 1
package: my_package
asset_name: my_bindings.dart
library_stem: mylib
release:
  provider: github
  repository: myorg/myrepo
  tag: mylib-v1.0.0
artifacts:
  linux-x64:
    archive: mylib-linux-x64.tar.gz
    payload:
      type: dynamic_library

Use:

dart run native_prebuilt manifest update \
  --config native_prebuilt.yaml \
  --output lib/src/hook/prebuilts.g.dart \
  --built-library-dir built-library
dart run native_prebuilt manifest verify \
  --config native_prebuilt.yaml \
  --output lib/src/hook/prebuilts.g.dart \
  --built-library-dir built-library

Fetch locally #

dart run native_prebuilt fetch --config native_prebuilt.yaml --platform linux-x64

Workflow templates #

GitHub Actions:

dart run native_prebuilt workflow init

This now also writes a repo-level prebuilt.yml workflow alongside the reusable workflow templates, and tag runs publish GitHub release assets. GitLab CI generated from the same command now uploads GitLab release assets too.

GitLab CI (defaults to the platforms declared in native_prebuilt.yaml):

dart run native_prebuilt workflow init --gitlab --config native_prebuilt.yaml

Notes #

  • hooks.user_defines is preferred for local override paths.
  • Use release.provider: gitlab and release.project for GitLab release assets.
  • workflow init --platform ... is repeatable; omit it to scaffold the platforms declared in the manifest.
  • Generated GitLab scaffolds stage built libraries in built-library/ and use the manifest to decide which platform jobs to emit.
  • The package exports OS, Architecture, and IOSSdk from code_assets.
  • The cache and installer are designed for repeated hook runs and concurrent builds.
0
likes
0
points
1.18k
downloads

Publisher

unverified uploader

Weekly Downloads

Reusable infrastructure for Dart packages that ship prebuilt native libraries from GitHub or GitLab releases. Provides build-hook integration, manifest generation, download/verify/cache pipelines, and binary validation.

Repository (GitHub)
View/report issues

Topics

#native #prebuilt #build-hook #code-assets

License

unknown (license)

Dependencies

archive, artisanal, code_assets, crypto, hooks, logging, path, yaml

More

Packages that depend on native_prebuilt