-
Notifications
You must be signed in to change notification settings - Fork 29.7k
[flutter_tools] Deferred components build system #76192
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
Conversation
|
Still plan on adding additional tests, but requesting review now for more preliminary feedback! |
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.
Should there be some more validation here? Could you have deferred components and no component names?
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.
That particular case is a valid use case. Developers can include no component names to generate the loading units without packing them into dynamic features during development.
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.
document what this is
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.
Pull this into a helper method
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.
globals.fs.path should have a path separator.
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.
Since we can't build a split aot in debug mode, could we structure this so that the calling code always passes false for debug and otherwise leaves the build mode out of the asset system?
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 manifest doesn't get produced if its not a split AOT right?
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.
Correct. I'll change this to track the manifest in the depfile in case the app does not include any loading units.
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.
Pass this through as a build define instead of creating a special argument for it. The build apk/appbundle et cetera commands should have the well documented arg
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 should all be performed in the build system, why move it out here?
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.
Like we talked about, no usage of the build system outside of assemble
8e596b7 to
09a2dcc
Compare
|
We don't have a super verbose mode, but if you want to see why the targets are re-running, I would recommend adding logging to https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/build_system/build_system.dart#L806-L856 |
t # This is a combination of 3 commits. Separate prebuild and build tooling, early working(ish) version Refactor, cleanup Integrate dart library names golden generation refactor REmove extra deps Remove conflicts Sync version numbers with local.properties in modules Remove no-use-bare-instructions Use strings.xml for loading unit -> module mapping Copy assets prototype Begin assets packaging Pack assets into split mdoule Package assets Fix after rebase Add shrinking disable back to support multi-apk builds Rename to deferred_component_config Move commands to proper location Move commands to new locations, cleanup Additional cleanup, rename to deferred d components Begin transition into single command setup Basic one-command verification and setup Build multiple ABIs Assets work Working intermediates system Shift .so multiplexing into dart, cleanup Consolidation and additional cleanup Goldens work Migrate so copy to new target Move setup to prebuild Working prebuild for setup Setup verification work Working setup system Cleanup and begin backwards/debug compatibility Cleanup More cleanup: Refactor verification and setup into calss, split into two parts: pre and post assembly Refactor setup code, address comments Refactoring, begin templates impl, address comments Working template based generation Docs, refactor, rename Refactor, libs copy depfile More depfiles work, debug run assets working Add dynamicFeatures build.gradle programmatically More refactoring, depfile fixes, improvement to copying and loading unit parsing Include unused loading units in base module Crash fixes: Prevent validation on debug builds, fix flutter run behavior Flutter run working again AndroidManifest.xml validation and writing Move check to Target to track dependencies. Resolve various crashes and flutter run issues Fix multi-split assets Generate diff Message formatting, async fixes Fix strings.xml edits and log recommended command to apply diff Improve strings.xml algorithm Improve regex, Add unit tests Begin validator tests, custom loggers Null safety Passing initial tests Add many validator tests Component android dir tests Add tests for AndroidManifest mapping and string.xml names Finish validator tests Test for deferred components .so copying Add validator Target test flutter manifest tests Round 1 analyzer fixes Refactor, passes analyzer Fix casts Merge with upstream Merge Fix abi mismatch when switching targets between builds Pass abi to validator Switch to BufferLogger Begin integration tests for tooling Building deferred components apps works in integration test Passing build appbundle integration tests Fix tests and analyzer, cleanup: Whitespaces Update diff Sync with validator PR Sync with validator PR tests Integrate with new validator Sync with splitbuild Fix null dep Merge changes Add tests for target
Refactor abi extraction to within target
Analyzer Fix null bool
Analyzer Buildsystem Non-null splitDeferredAssets
Remove extra input Oops
Fix analyzer Fix edge case
| if (!_allTargetsCached(file)) { | ||
| print('${red}Not all build targets cached after second run.$reset'); | ||
| print('The target performance data was: ${file.readAsStringSync()}'); | ||
| print('The target performance data was: ${file.readAsStringSync().replaceAll('},', '},\n')}'); |
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.
Makes the log much more readable. Quick fix for me totally missing the "skipped: false" entries in this line because it was 90% cut off onscreen.
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.
awesome!
jonahwilliams
left a comment
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.
LGTM
I would like to see some of the usages of flutter project to pass config in the build rules cleaned up a bit, but we can handle that in a follow up
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.
You could lose a level of indentation here by doing an early return if components is null.
| if (!_allTargetsCached(file)) { | ||
| print('${red}Not all build targets cached after second run.$reset'); | ||
| print('The target performance data was: ${file.readAsStringSync()}'); | ||
| print('The target performance data was: ${file.readAsStringSync().replaceAll('},', '},\n')}'); |
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.
awesome!
|
I'll definitely follow up with additional cleanup and I do also want to add additional tests in areas. |
|
This pull request is not suitable for automatic merging in its current state.
|
|
Ahh, the change in the asset manager API needs to be updated in g3 too. You'll need to make a g3fix using frob |
This PR adds the full build system that allows building deferred components apps using
flutter build appbundleBehavior is controlled via two negatable flags:
--[no-]deferred-componentsand--[no-]-verify-deferred-componentsSplit off of #63773