Skip to content

Commit e69c74d

Browse files
authored
[native_assets_cli] Document exit code behavior (#1762)
Closes: #33 The behavior is already tested by pkgs/native_assets_builder/test/build_runner/build_runner_build_output_format_test.dart.
1 parent 081b195 commit e69c74d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

pkgs/native_assets_cli/lib/src/api/build.dart

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import '../validation.dart';
1111

1212
/// Runs a native assets build.
1313
///
14+
/// Meant to be used in build hooks (`hook/build.dart`).
15+
///
1416
/// Can build native assets which are not already available, or expose existing
1517
/// files. Each individual asset is assigned a unique asset ID.
1618
///
@@ -87,6 +89,11 @@ import '../validation.dart';
8789
/// });
8890
/// }
8991
/// ```
92+
///
93+
/// If the [builder] fails, it must `throw`. Build hooks are guaranteed to be
94+
/// invoked with a process invocation and should return a non-zero exit code on
95+
/// failure. Throwing will lead to an uncaught exception, causing a non-zero
96+
/// exit code.
9097
Future<void> build(
9198
List<String> arguments,
9299
Future<void> Function(BuildConfig config, BuildOutputBuilder output) builder,

pkgs/native_assets_cli/lib/src/api/link.dart

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import '../validation.dart';
1111

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

0 commit comments

Comments
 (0)