Skip to content

Commit 01c97bc

Browse files
committed
update build_output_CHANGELOG.md and add note about dependency management to LinkConfig.{codeAssets,dataAssets}.all
1 parent be7e9ed commit 01c97bc

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

pkgs/native_assets_cli/lib/src/code_assets/code_asset.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,13 @@ extension CodeAssetsLinkConfig on LinkConfig {
216216
}
217217

218218
extension type LinkConfigCodeAssets(LinkConfig _config) {
219+
// Returns the code assets that were sent to this linker.
220+
//
221+
// NOTE: If the linker implementation depends on the contents of the files the
222+
// code assets refer (e.g. looks at static archives and links them) then the
223+
// linker script has to add those files as dependencies via
224+
// [LinkOutput.addDependency] to ensure the linker script will be re-run if
225+
// the content of the files changes.
219226
Iterable<CodeAsset> get all => _config.encodedAssets
220227
.where((e) => e.type == CodeAsset.type)
221228
.map(CodeAsset.fromEncoded);

pkgs/native_assets_cli/lib/src/data_assets/data_asset.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ extension DataAssetsLinkConfig on LinkConfig {
118118
}
119119

120120
extension type LinkConfigDataAssets(LinkConfig _config) {
121+
// Returns the data assets that were sent to this linker.
122+
//
123+
// NOTE: If the linker implementation depends on the contents of the files of
124+
// the data assets (e.g. by transforming them, merging with other files, etc)
125+
// then the linker script has to add those files as dependencies via
126+
// [LinkOutput.addDependency] to ensure the linker script will be re-run if
127+
// the content of the files changes.
121128
Iterable<DataAsset> get all => _config.encodedAssets
122129
.where((e) => e.type == DataAsset.type)
123130
.map(DataAsset.fromEncoded);

pkgs/native_assets_cli/lib/src/model/build_output_CHANGELOG.md renamed to pkgs/native_assets_cli/lib/src/model/hook_config_CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
## 1.6.0
22

33
- No changes, but rev version due to BuildConfig change.
4+
- **Breaking change** Link hooks now have to explicitly add any file contents
5+
they rely on via `output.addDependency()` to ensure they re-run if the
6+
content of those files changes. (Previously if a linker script obtained code
7+
or data assets, the files referred to by those assets were implicitly added as
8+
a dependency, but adding custom asset types changed this behavior)
9+
NOTE: Newer Dart & Flutter SDKs will no longer add those dependencies
10+
implicitly which may make some older linker implementations that do not add
11+
dependencies explicitly not work correctly anymore: The linker scripts have
12+
to be updated to add those dependencies explicitly.
413

514
## 1.5.0
615

0 commit comments

Comments
 (0)