File tree Expand file tree Collapse file tree 10 files changed +44
-9
lines changed Expand file tree Collapse file tree 10 files changed +44
-9
lines changed Original file line number Diff line number Diff line change 1+ ## 0.19.9
2+
3+ - Document that asset file paths must be absolute.
4+
15## 0.19.8
26
37- Polished README.md, Dartdocs, and examples.
Original file line number Diff line number Diff line change @@ -60,10 +60,11 @@ final class CodeAsset {
6060 /// Either dynamic loading or static linking.
6161 final LinkMode linkMode;
6262
63- /// The file to be bundled with the Dart or Flutter application.
63+ /// The native library to be bundled with the Dart or Flutter application.
6464 ///
6565 /// If the [linkMode] is [DynamicLoadingBundled] , the file must be provided
66- /// and exist.
66+ /// and exist. The path must be an absolute path. Prefer constructing the path
67+ /// via [HookInput.outputDirectoryShared] or [HookInput.outputDirectory] .
6768 ///
6869 /// If the [linkMode] is [DynamicLoadingSystem] , the file must be provided,
6970 /// and not exist.
Original file line number Diff line number Diff line change @@ -165,10 +165,18 @@ final class BuildOutputCodeAssetBuilder {
165165 BuildOutputCodeAssetBuilder ._(this ._output);
166166
167167 /// Adds the given [asset] to the hook output with [routing] .
168+ ///
169+ /// The [CodeAsset.file] , if provided, must be an absolute path. Prefer
170+ /// constructing the path via [HookInput.outputDirectoryShared] or
171+ /// [HookInput.outputDirectory] .
168172 void add (CodeAsset asset, {AssetRouting routing = const ToAppBundle ()}) =>
169173 _output.addEncodedAsset (asset.encode (), routing: routing);
170174
171175 /// Adds the given [assets] to the hook output with [routing] .
176+ ///
177+ /// The [CodeAsset.file] s, if provided, must be absolute paths. Prefer
178+ /// constructing the paths via [HookInput.outputDirectoryShared] or
179+ /// [HookInput.outputDirectory] .
172180 void addAll (
173181 Iterable <CodeAsset > assets, {
174182 AssetRouting routing = const ToAppBundle (),
Original file line number Diff line number Diff line change @@ -301,7 +301,10 @@ ValidationErrors _validateFile(
301301}) {
302302 final errors = < String > [];
303303 if (mustBeAbsolute && ! uri.isAbsolute) {
304- errors.add ('$name (${uri .toFilePath ()}) must be an absolute path.' );
304+ errors.add (
305+ '$name (${uri .toFilePath ()}) must be an absolute path. '
306+ 'Prefer constructing it via `input.outputDirectoryShared`.' ,
307+ );
305308 }
306309 if (mustExist && ! File .fromUri (uri).existsSync ()) {
307310 errors.add ('$name (${uri .toFilePath ()}) does not exist as a file.' );
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ description: >-
33 This library contains the hook protocol specification for bundling native code
44 with Dart packages.
55
6- version : 0.19.8
6+ version : 0.19.9
77
88repository : https://github.com/dart-lang/native/tree/main/pkgs/code_assets
99
Original file line number Diff line number Diff line change 1+ ## 0.19.4
2+
3+ - Document that asset file paths must be absolute.
4+
15## 0.19.3
26
37- Added a library comment detailing how to use the package.
Original file line number Diff line number Diff line change @@ -119,10 +119,20 @@ final class BuildOutputDataAssetsBuilder {
119119 BuildOutputDataAssetsBuilder ._(this ._output);
120120
121121 /// Adds the given [asset] to the hook output with [routing] .
122+ ///
123+ /// The [DataAsset.file] must be an absolute path. Prefer constructing the
124+ /// path via [HookInput.outputDirectoryShared] or [HookInput.outputDirectory]
125+ /// for files emitted during a hook, and via [HookInput.packageRoot] for files
126+ /// which are part of the package.
122127 void add (DataAsset asset, {AssetRouting routing = const ToAppBundle ()}) =>
123128 _output.addEncodedAsset (asset.encode (), routing: routing);
124129
125130 /// Adds the given [assets] to the hook output with [routing] .
131+ ///
132+ /// The [DataAsset.file] s must be absolute paths. Prefer constructing the
133+ /// path via [HookInput.outputDirectoryShared] or [HookInput.outputDirectory]
134+ /// for files emitted during a hook, and via [HookInput.packageRoot] for files
135+ /// which are part of the package.
126136 void addAll (
127137 Iterable <DataAsset > assets, {
128138 AssetRouting routing = const ToAppBundle (),
Original file line number Diff line number Diff line change @@ -18,9 +18,10 @@ import 'syntax.g.dart';
1818final class DataAsset {
1919 /// The file to be bundled with the Dart or Flutter application.
2020 ///
21- /// The file can also be omitted for asset types which refer to an asset
22- /// already present on the target system or an asset already present in Dart
23- /// or Flutter.
21+ /// The path must be an absolute path. Prefer constructing the path via
22+ /// [HookInput.outputDirectoryShared] or [HookInput.outputDirectory] for files
23+ /// emitted during a hook, and via [HookInput.packageRoot] for files which are
24+ /// part of the package.
2425 final Uri file;
2526
2627 /// The name of this asset, which must be unique for the package.
Original file line number Diff line number Diff line change @@ -129,7 +129,11 @@ ValidationErrors _validateFile(
129129}) {
130130 final errors = < String > [];
131131 if (mustBeAbsolute && ! uri.isAbsolute) {
132- errors.add ('$name (${uri .toFilePath ()}) must be an absolute path.' );
132+ errors.add (
133+ '$name (${uri .toFilePath ()}) must be an absolute path. '
134+ 'Prefer constructing it via `input.outputDirectoryShared` or '
135+ '`input.packageRoot`.' ,
136+ );
133137 }
134138 if (mustExist && ! File .fromUri (uri).existsSync ()) {
135139 errors.add ('$name (${uri .toFilePath ()}) does not exist as a file.' );
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ description: >-
33 This library contains the hook protocol specification for bundling data assets
44 with Dart packages.
55
6- version : 0.19.3
6+ version : 0.19.4
77
88repository : https://github.com/dart-lang/native/tree/main/pkgs/data_assets
99
You can’t perform that action at this time.
0 commit comments