From 0a0d2041869923ad6f82bbab678363b13868999c Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 26 Mar 2024 11:18:14 +0100 Subject: [PATCH 1/3] [native_assets_cli] Improve documentation for `DynamicLoadingBundled` --- pkgs/native_assets_cli/CHANGELOG.md | 4 ++++ .../lib/src/api/native_code_asset.dart | 14 ++++++++++---- pkgs/native_assets_cli/pubspec.yaml | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pkgs/native_assets_cli/CHANGELOG.md b/pkgs/native_assets_cli/CHANGELOG.md index c9a79e67d1..7cb4bce9af 100644 --- a/pkgs/native_assets_cli/CHANGELOG.md +++ b/pkgs/native_assets_cli/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.5.4 + +- Update documentation about providing `NativeCodeAsset.file` in dry runs. + ## 0.5.3 - Fix V1_0_0 dry run backwards compatibility. diff --git a/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart b/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart index 83ecb31f01..70a0749183 100644 --- a/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart +++ b/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart @@ -64,8 +64,9 @@ abstract final class NativeCodeAsset implements Asset { /// How this file is bundled depends on the kind of asset, represented by a /// concrete subtype of [Asset], and the SDK (Dart or Flutter). /// - /// If the [linkMode] is [DynamicLoadingBundled], the file most be provided in - /// the [BuildOutput] for [BuildConfig.dryRun]. + /// If the [linkMode] is [DynamicLoadingBundled], the file must be provided in + /// the [BuildOutput] for [BuildConfig.dryRun]. Supplying a file name instead + /// of an absolute path is enough for [BuildConfig.dryRun]. /// /// If the [linkMode] is [DynamicLoadingSystem], [LookupInProcess], or /// [LookupInExecutable] the file must be omitted in the [BuildOutput] for @@ -126,8 +127,13 @@ abstract final class DynamicLoading implements LinkMode {} /// At runtime, the dynamic library will be loaded and the symbols will be /// looked up in this dynamic library. /// -/// An asset with this dynamic loading method must provide a [Asset.file]. The -/// Dart and Flutter SDK will bundle this code in the final application. +/// An asset with this dynamic loading method must provide a +/// [NativeCodeAsset.file]. The Dart and Flutter SDK will bundle this code in +/// the final application. +/// +/// During a [BuildConfig.dryRun], the [NativeCodeAsset.file] can be a file name +/// instead of a the full path. (The file name is used by the Flutter SDK to +/// decide where to bundle ) abstract final class DynamicLoadingBundled implements DynamicLoading { factory DynamicLoadingBundled() = DynamicLoadingBundledImpl; } diff --git a/pkgs/native_assets_cli/pubspec.yaml b/pkgs/native_assets_cli/pubspec.yaml index 081d6a6546..e567de6278 100644 --- a/pkgs/native_assets_cli/pubspec.yaml +++ b/pkgs/native_assets_cli/pubspec.yaml @@ -4,7 +4,7 @@ description: >- native assets CLI. # Note: Bump BuildConfig.version and BuildOutput.version on breaking changes! -version: 0.5.3 +version: 0.5.4 repository: https://github.com/dart-lang/native/tree/main/pkgs/native_assets_cli topics: From a7a01ae45c628fa7a49a08cc83ace94a7dc9eb7b Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 26 Mar 2024 11:45:49 +0100 Subject: [PATCH 2/3] Clarify whether the file has to exist --- .../lib/src/api/native_code_asset.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart b/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart index 70a0749183..f5c86e6098 100644 --- a/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart +++ b/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart @@ -64,9 +64,10 @@ abstract final class NativeCodeAsset implements Asset { /// How this file is bundled depends on the kind of asset, represented by a /// concrete subtype of [Asset], and the SDK (Dart or Flutter). /// - /// If the [linkMode] is [DynamicLoadingBundled], the file must be provided in - /// the [BuildOutput] for [BuildConfig.dryRun]. Supplying a file name instead - /// of an absolute path is enough for [BuildConfig.dryRun]. + /// If the [linkMode] is [DynamicLoadingBundled], the file name must be + /// provided in the [BuildOutput] for [BuildConfig.dryRun]. Supplying a file + /// name instead of an absolute path is enough for [BuildConfig.dryRun]. The + /// file does not have to exist on disk during a dry run. /// /// If the [linkMode] is [DynamicLoadingSystem], [LookupInProcess], or /// [LookupInExecutable] the file must be omitted in the [BuildOutput] for @@ -132,8 +133,7 @@ abstract final class DynamicLoading implements LinkMode {} /// the final application. /// /// During a [BuildConfig.dryRun], the [NativeCodeAsset.file] can be a file name -/// instead of a the full path. (The file name is used by the Flutter SDK to -/// decide where to bundle ) +/// instead of a the full path. The file does not have to exist during a dry run. abstract final class DynamicLoadingBundled implements DynamicLoading { factory DynamicLoadingBundled() = DynamicLoadingBundledImpl; } From 73279b34fe76685bb3ee1c45841830edc7670f50 Mon Sep 17 00:00:00 2001 From: Daco Harkes Date: Tue, 26 Mar 2024 11:47:37 +0100 Subject: [PATCH 3/3] formatting --- pkgs/native_assets_cli/lib/src/api/native_code_asset.dart | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart b/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart index f5c86e6098..b5f08f79a1 100644 --- a/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart +++ b/pkgs/native_assets_cli/lib/src/api/native_code_asset.dart @@ -133,7 +133,8 @@ abstract final class DynamicLoading implements LinkMode {} /// the final application. /// /// During a [BuildConfig.dryRun], the [NativeCodeAsset.file] can be a file name -/// instead of a the full path. The file does not have to exist during a dry run. +/// instead of a the full path. The file does not have to exist during a dry +/// run. abstract final class DynamicLoadingBundled implements DynamicLoading { factory DynamicLoadingBundled() = DynamicLoadingBundledImpl; }