prebuilt_code_assets library
Shared build and link hook infrastructure for Dart packages with prebuilt and source-built native code assets.
Classes
- BuildOptions
- Parsed user-defines configuration for native asset hooks.
- CargoSourceBuilder
-
Reusable Rust/Cargo source builder (
cargo rustc --crate-type=...) shared by Rust FFI packages such aspackage:icu4xandpackage:sigstore. - CLibrary
- Specification for building and linking a library with a C compiler.
- Language
- A programming language that can be selected for compilation of source files.
- OptimizationLevel
- Optimization level for code compilation.
- PrebuiltLibrary
-
Declarative specification for building, fetching, and tree-shaking a native
library across
hook/build.dart,hook/link.dart, and standalone maintainer scripts. - PrebuiltReleaseConfig
- Configuration for fetching and verifying prebuilt release binaries.
- SymbolsResolvers
-
Standard SymbolsResolver factories for
ffigenand Diplomat bindings.
Enums
- BuildMode
- How the build hook should obtain the native library.
Constants
-
defaultNativeSourceExtensions
→ const Set<
String> - Default file extensions tracked as native source build dependencies.
-
supportedTargets
→ const List<
TargetSpec> - Canonical list of supported native targets across mobile and desktop platforms.
Functions
-
asRustTarget(
OS os, Architecture arch, {IOSSdk? iosSdk}) → String -
Converts
os,arch, and optionaliosSdkinto a Rust target triple. -
asRustTargetForConfig(
CodeConfig code) → String -
Converts a Dart
CodeConfiginto a Rust target triple. -
createWindowsLinkerOptions(
{required Uri outputDirectory, required String libraryName, required Uri staticLibrary, required List< String> ? symbols, Iterable<String> ? allKnownSymbols, int maxCommandLineChars = 24000}) → Future<LinkerOptions> -
Creates
LinkerOptionsfor linking a Windows DLL exportingsymbols(or all bound functions inallKnownSymbolsifsymbolsisnull). -
definedBindingsInCoffArchive(
Uint8List archive, Iterable< String> candidateSymbols) → Set<String> -
Returns the subset of
candidateSymbolsthat the COFFarchivedefines. -
fetchPrebuiltLibrary(
HookInput input, PrebuiltReleaseConfig releaseConfig, {required bool static, String? prebuiltDirectory, String fallbackBuildModeName = 'checkout'}) → Future< Uri?> -
Resolves or downloads the pre-built library for the target of
inputusingreleaseConfig, caching it inHookInput.outputDirectorySharedunder an ABI-specific subdirectory so the leaf filename matches the canonical OS library name (required for iOS/macOS XCFrameworks). -
findSourceBuildDependencies(
Uri root, List< String> relativeDirectories, {Set<String> extensions = defaultNativeSourceExtensions}) → Iterable<Uri> -
Recursively collects source files matching
extensionsunderrelativeDirectories(resolved againstroot) forBuildOutputBuilder.dependencies. -
parseCoffArchiveSymbols(
Uint8List archive) → Set< String> -
Reads the symbols defined by the members of a Windows COFF
.libarchivefrom its first linker member. -
targetTripleFor(
OS os, Architecture arch, {IOSSdk? iosSdk}) → String -
Formats a canonical target identifier, including
iosSdkwhen targeting iOS so device (iphoneos) and simulator (iphonesimulator) binaries do not collide onios-arm64. -
targetTripleForConfig(
CodeConfig code) → String -
Formats the canonical target identifier for
code.
Typedefs
- AssetNameResolver = String Function(OS os, Architecture arch, {IOSSdk? iosSdk, required bool static})
- Resolves the remote release asset filename for a target and link mode.
- BuildModeEnum = BuildMode
- Backwards-compatible alias for BuildMode.
- DownloadUriResolver = Uri Function(String version, String assetRemoteName)
-
Resolves the download Uri for a given release
versionandassetRemoteName. - LibraryFileNameResolver = String Function(OS os, {required bool static})
-
Resolves the local OS-specific library filename for
osandstatic. -
SourceBuildCallback
= Future<
Uri> Function(BuildInput input, BuildOutputBuilder output, {Uri? checkoutPath, required bool static}) - Callback that compiles the native library from source and returns the Uri of the built static or dynamic library file.
-
SymbolsResolver
= List<
String> Function(Recordings recordedUses) -
Extracts the list of native C/Rust symbol names used by the application from
recordedUses. - TargetSpec = (OS, Architecture, IOSSdk?)
-
A target tuple consisting of
OS,Architecture, and optionalIOSSdk.