|
2 | 2 | // for details. All rights reserved. Use of this source code is governed by a |
3 | 3 | // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
|
| 5 | +/// @docImport 'package:hooks/hooks.dart'; |
5 | 6 | /// @docImport 'src/code_assets/code_asset.dart'; |
6 | 7 | /// @docImport 'src/code_assets/config.dart'; |
7 | 8 |
|
8 | | -/// Code asset support for hook authors. |
| 9 | +/// This package provides the API for code assets to be used with |
| 10 | +/// [`package:hooks`](https://pub.dev/packages/hooks). |
| 11 | +/// |
| 12 | +/// A [CodeAsset] is an asset containing executable code which respects the |
| 13 | +/// native application binary interface (ABI). These assets are bundled with a |
| 14 | +/// Dart or Flutter application. They can be produced by compiling C, C++, |
| 15 | +/// Objective-C, Rust, or Go code for example. |
9 | 16 | /// |
10 | | -/// A code asset is an asset containing executable code which respects the |
11 | | -/// native application binary interface (ABI). |
| 17 | +/// This package is used in a build hook (`hook/build.dart`) to inform the Dart |
| 18 | +/// and Flutter SDKs about the code assets that need to be bundled with an |
| 19 | +/// application. |
12 | 20 | /// |
13 | | -/// Code assets can be added in a build hook as follows: |
| 21 | +/// [CodeAsset] can be added to the [BuildOutputBuilder] a build hook as |
| 22 | +/// follows: |
14 | 23 | /// |
15 | 24 | /// <!-- file://./../example/api/code_assets_snippet.dart --> |
16 | 25 | /// ```dart |
|
34 | 43 | /// } |
35 | 44 | /// ``` |
36 | 45 | /// |
37 | | -/// See [CodeAsset] and [BuildOutputCodeAssetBuilder.add] for more details. |
| 46 | +/// The [CodeConfig] nested in the [HookInput] gives access to configuration |
| 47 | +/// specifically for compiling code assets. For example [CodeConfig.targetOS] |
| 48 | +/// and [CodeConfig.targetArchitecture] give access to the target OS and |
| 49 | +/// architecture that the code assets are compiled for: |
38 | 50 | /// |
39 | | -/// For more documentation of hooks, refer to the API docs of |
40 | | -/// [`package:hooks`](https://pub.dev/packages/hooks). |
| 51 | +/// <!-- file://./../example/api/code_config_snippet.dart --> |
| 52 | +/// ```dart |
| 53 | +/// import 'package:code_assets/code_assets.dart'; |
| 54 | +/// import 'package:hooks/hooks.dart'; |
| 55 | +/// |
| 56 | +/// void main(List<String> args) async { |
| 57 | +/// await build(args, (input, output) async { |
| 58 | +/// if (input.config.buildCodeAssets) { |
| 59 | +/// final codeConfig = input.config.code; |
| 60 | +/// final targetOS = codeConfig.targetOS; |
| 61 | +/// final targetArchitecture = codeConfig.targetArchitecture; |
| 62 | +/// |
| 63 | +/// // Add some code assets. |
| 64 | +/// } |
| 65 | +/// }); |
| 66 | +/// } |
| 67 | +/// ``` |
41 | 68 | /// |
42 | | -/// When compiling C, C++ or Objective-C code from source, consider using |
43 | | -/// [`package:native_toolchain_c`](https://pub.dev/packages/native_toolchain_c). |
| 69 | +/// For more information about build hooks see |
| 70 | +/// [dart.dev/tools/hooks](https://dart.dev/tools/hooks). |
44 | 71 | library; |
45 | 72 |
|
46 | 73 | export 'src/code_assets/architecture.dart' show Architecture; |
|
0 commit comments