-
Notifications
You must be signed in to change notification settings - Fork 6k
Allow hot reload without syncing all asset files to devFS #21436
Changes from 10 commits
d870dea
847b53d
62cea76
ec3ba29
9ebdec9
262912a
0ebce10
5a95412
cb3e7b1
32f85bd
f42dd5e
f004337
ee6772a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1404,6 +1404,17 @@ bool Shell::OnServiceProtocolRunInView( | |
| configuration.AddAssetResolver( | ||
| std::make_unique<DirectoryAssetBundle>(fml::OpenDirectory( | ||
| asset_directory_path.c_str(), false, fml::FilePermission::kRead))); | ||
| // Add the original asset directory to the resolvers so that unmodified assets | ||
| // bundled with the application specific format (APK, IPA) can be used without | ||
| // syncing to the Dart devFS. | ||
| if (fml::UniqueFD::traits_type::IsValid(settings_.assets_dir)) { | ||
| configuration.AddAssetResolver(std::make_unique<DirectoryAssetBundle>( | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can the code that constructs this asset resolver be broken out into a function shared between this and OnServiceProtocolSetAssetBundlePath?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added a function that creates the resolver, PTAL and let me know if I'm following the proper flutter engine/c++ idioms |
||
| fml::Duplicate(settings_.assets_dir))); | ||
| } else { | ||
| configuration.AddAssetResolver( | ||
| std::make_unique<DirectoryAssetBundle>(fml::OpenDirectory( | ||
| settings_.assets_path.c_str(), false, fml::FilePermission::kRead))); | ||
| } | ||
|
|
||
| auto& allocator = response->GetAllocator(); | ||
| response->SetObject(); | ||
|
|
@@ -1516,6 +1527,17 @@ bool Shell::OnServiceProtocolSetAssetBundlePath( | |
|
|
||
| auto asset_manager = std::make_shared<AssetManager>(); | ||
|
|
||
| // Add the original asset directory to the resolvers so that unmodified assets | ||
| // bundled with the application specific format (APK, IPA) can be used without | ||
| // syncing to the Dart devFS. | ||
| if (fml::UniqueFD::traits_type::IsValid(settings_.assets_dir)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. change to
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do I need to import another file for this to work?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my mistake - |
||
| asset_manager->PushFront(std::make_unique<DirectoryAssetBundle>( | ||
| fml::Duplicate(settings_.assets_dir))); | ||
| } else { | ||
| asset_manager->PushFront( | ||
| std::make_unique<DirectoryAssetBundle>(fml::OpenDirectory( | ||
| settings_.assets_path.c_str(), false, fml::FilePermission::kRead))); | ||
| } | ||
| asset_manager->PushFront(std::make_unique<DirectoryAssetBundle>( | ||
| fml::OpenDirectory(params.at("assetDirectory").data(), false, | ||
| fml::FilePermission::kRead))); | ||
|
|
||
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.
This all seems much simpler