-
Notifications
You must be signed in to change notification settings - Fork 28.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add experimental data assets from hooks #164094
base: master
Are you sure you want to change the base?
Conversation
5e36ce4
to
9a2f7e6
Compare
There seems to be a test failure related to the ordering of stdouts at https://github.com/mosuem/flutter/blob/rebaseMartinsDataAssets/packages/flutter_tools/test/integration.shard/overall_experience_test.dart#L123 - not sure if this is intentional or not. |
840b811
to
f71c5e9
Compare
The ordering of the patterns in Multiple(
<Pattern>[
RegExp(
r'^Reloaded 0 libraries in [0-9]+ms \(compile: \d+ ms, reload: \d+ ms, reassemble: \d+ ms\)\.$',
),
'called reassemble',
'called paint',
],
handler: (String line) {
processManager.killPid(pid, ProcessSignal.sigusr2);
return null;
},
), is not relevant. You can see how |
The root cause I believe is the modified code (which should be reverted - as mentioned earlier):
This |
079d1ad
to
08b1bde
Compare
final _Asset asset = _Asset( | ||
baseDir: baseDir, | ||
relativeUri: relativeUri, | ||
entryUri: Uri.parse('packages/${dataAsset.package}/${dataAsset.name}'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just confirming, has this been tested on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The windows test was failing - I applied for the cloudtop permissions and can now finally debug it!
packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
Show resolved
Hide resolved
packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
Outdated
Show resolved
Hide resolved
packages/flutter_tools/lib/src/isolated/native_assets/native_assets.dart
Outdated
Show resolved
Hide resolved
7721ce5
to
5d27153
Compare
This reverts commit 5d27153.
required Map<String, String> environmentDefines, | ||
required FlutterNativeAssetsBuildRunner buildRunner, | ||
required List<Architecture> architectures, | ||
required Uri projectUri, | ||
required FileSystem fileSystem, | ||
required OS? targetOS, | ||
required bool linkingEnabled, | ||
required bool codeAssetSupport, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we want to run this method with two modes after this PR:
- CodeAssets + DataAssets
- DataAssets (web only)
It seems weird that we can have codeAssetSupport: false
but we still need to supply an OS
and Architecture
s
I suggest packaging the codeAssetSupport
(with architectures
and os
), dataAssetSupport
and isWeb
in objects.
sealed class FlutterAssetConfig {}
class FlutterDataAssetConfig extends FlutterAssetConfig {}
class FlutterCodeAssetConfig extends FlutterAssetConfig {
FlutterCodeAssetConfig(this.architectures, this.os);
final List<Architecture> architectures;
final OS os;
}
Since we seem to run this method with multiple asset types at the same time (and then invoke the hooks for the asset types separately in this method), the param needs to be as follows:
Future<DartHookResult> _runDartHooks({
required List<FlutterAssetConfig> assetConfigurations, // or a Set, but that adds hashing
// ...
@@ -400,8 +414,39 @@ class ManifestAssetBundle implements AssetBundle { | |||
} | |||
} | |||
|
|||
for (final DataAsset dataAsset in dartHookResult?.dataAssets ?? <DataAsset>[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in the isolated directory, so we can't use DataAsset
s here. The HookResult
should contain something else than DataAsset
and CodeAsset
, it should return the info in a format not requiring to import package:native_assets_cli
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we can't use package:native_assets_cli
outside of isolated
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrrect, you can't use it here. We'll have to extract the info you need from DataAsset
s inside isolated/
and then make that info available here.
root.path, | ||
<Transition>[ | ||
Barrier.contains( | ||
'Conflicting assets: The asset "asset: packages/data_asset_dependency/id1.txt" was declared in the pubspec and the hook', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can logic such as this be tested on the general shard (unit tests that mock running the hooks)? That requires less resources to run.
See test/general.shard/isolated/native_assets_test.dart with buildRunner: FakeFlutterNativeAssetsBuildRunner(
.
I'll leave the balance between mocked-out-tests and full integration tests is something for Ben to decide on.
Rebase of #159675
This PR adds bundling support for the experimental dart data asset feature: Dart packages with hooks can now emit data assets which the flutter tool will bundle.
It relies on flutter's existing asset bundling mechanism (e.g. entries in
AssetManifest.json
, DevFS syncing in reload/restart, ...).The support is added under an experimental flag (similar to the existing native assets experimental flag).
Also,
kNativeAssets
is removed to also bundle data assets onflutter build bundle
.cc @bkonyi
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.