Skip to content

Commit

Permalink
[native_assets_cli] Document exit code behavior (#1762)
Browse files Browse the repository at this point in the history
Closes: #33

The behavior is already tested by pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart.
  • Loading branch information
dcharkes authored Nov 28, 2024
1 parent 081b195 commit e69c74d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkgs/native_assets_cli/lib/src/api/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import '../validation.dart';

/// Runs a native assets build.
///
/// Meant to be used in build hooks (`hook/build.dart`).
///
/// Can build native assets which are not already available, or expose existing
/// files. Each individual asset is assigned a unique asset ID.
///
Expand Down Expand Up @@ -87,6 +89,11 @@ import '../validation.dart';
/// });
/// }
/// ```
///
/// If the [builder] fails, it must `throw`. Build hooks are guaranteed to be
/// invoked with a process invocation and should return a non-zero exit code on
/// failure. Throwing will lead to an uncaught exception, causing a non-zero
/// exit code.
Future<void> build(
List<String> arguments,
Future<void> Function(BuildConfig config, BuildOutputBuilder output) builder,
Expand Down
6 changes: 6 additions & 0 deletions pkgs/native_assets_cli/lib/src/api/link.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import '../validation.dart';

/// Runs a native assets link.
///
/// Meant to be used in link hooks (`hook/link.dart`).
///
/// Can link native assets which are not already available, or expose existing
/// files. Each individual asset is assigned a unique asset ID.
///
Expand All @@ -30,6 +32,10 @@ import '../validation.dart';
/// });
/// }
/// ```
/// If the [linker] fails, it must `throw`. Link hooks are guaranteed to be
/// invoked with a process invocation and should return a non-zero exit code on
/// failure. Throwing will lead to an uncaught exception, causing a non-zero
/// exit code.
Future<void> link(
List<String> arguments,
Future<void> Function(LinkConfig config, LinkOutputBuilder output) linker,
Expand Down

0 comments on commit e69c74d

Please sign in to comment.