Skip to content

Commit

Permalink
update build_output_CHANGELOG.md and add note about dependency manage…
Browse files Browse the repository at this point in the history
…ment to `LinkConfig.{codeAssets,dataAssets}.all`
  • Loading branch information
mkustermann committed Oct 4, 2024
1 parent be7e9ed commit 01c97bc
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkgs/native_assets_cli/lib/src/code_assets/code_asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ extension CodeAssetsLinkConfig on LinkConfig {
}

extension type LinkConfigCodeAssets(LinkConfig _config) {
// Returns the code assets that were sent to this linker.
//
// NOTE: If the linker implementation depends on the contents of the files the
// code assets refer (e.g. looks at static archives and links them) then the
// linker script has to add those files as dependencies via
// [LinkOutput.addDependency] to ensure the linker script will be re-run if
// the content of the files changes.
Iterable<CodeAsset> get all => _config.encodedAssets
.where((e) => e.type == CodeAsset.type)
.map(CodeAsset.fromEncoded);
Expand Down
7 changes: 7 additions & 0 deletions pkgs/native_assets_cli/lib/src/data_assets/data_asset.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ extension DataAssetsLinkConfig on LinkConfig {
}

extension type LinkConfigDataAssets(LinkConfig _config) {
// Returns the data assets that were sent to this linker.
//
// NOTE: If the linker implementation depends on the contents of the files of
// the data assets (e.g. by transforming them, merging with other files, etc)
// then the linker script has to add those files as dependencies via
// [LinkOutput.addDependency] to ensure the linker script will be re-run if
// the content of the files changes.
Iterable<DataAsset> get all => _config.encodedAssets
.where((e) => e.type == DataAsset.type)
.map(DataAsset.fromEncoded);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
## 1.6.0

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

## 1.5.0

Expand Down

0 comments on commit 01c97bc

Please sign in to comment.