-
Notifications
You must be signed in to change notification settings - Fork 29.8k
build bundle with assemble #37508
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
build bundle with assemble #37508
Conversation
Codecov Report
@@ Coverage Diff @@
## master #37508 +/- ##
==========================================
+ Coverage 58.92% 59.08% +0.16%
==========================================
Files 192 192
Lines 18442 18527 +85
==========================================
+ Hits 10867 10947 +80
- Misses 7575 7580 +5
Continue to review full report at Codecov.
|
…to bundle_assemble
|
This should be less risky now, and gives us a path to incrementally adopting assemble. |
|
|
||
| @override | ||
| List<Source> get outputs => const <Source>[ | ||
| Source.pattern('{BUILD_DIR}/vm_snapshot_data'), |
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.
Are these going to get converted to OUTPUT_DIR in https://github.com/flutter/flutter/pull/39274/files?
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.
Yeah, if I land the output dir change this is all much simpler
| targetModel: TargetModel.flutter, | ||
| targetProductVm: buildMode == BuildMode.release, | ||
| outputFilePath: environment.buildDir.childFile('app.dill').path, | ||
| depFilePath: null, |
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/can you use the kernel compiler depfile as a sanity check?
|
|
||
| @override | ||
| List<Target> get dependencies => const <Target>[ | ||
| CopyAssets(), |
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.
Library prefixes could help with namespacing targets, at least internally.
| applicationKernelFilePath ??= getDefaultApplicationKernelPath(trackWidgetCreation: trackWidgetCreation); | ||
| final FlutterProject flutterProject = FlutterProject.current(); | ||
|
|
||
| if (shouldBuildWithAssemble) { |
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.
do you plan to enable assemble for the remaining cases?
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.
I think we could, but I'd like to be conservative here
| const _BundleTarget(); | ||
|
|
||
| @override | ||
| Future<void> build(List<File> inputFiles, Environment environment) async { } |
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.
Would it be common to have an empty build method if the target is used to combine other targets? If that is the case, maybe it needs a lower abstraction (e.g. without build)?
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 what the planning phase is attempting to address, but until that lands it is necessary for now
| flutterProject: FlutterProject.current(), | ||
| mainPath: fs.path.join('lib', 'main.dart'), | ||
| outputDir: 'example', | ||
| targetPlatform: TargetPlatform.ios |
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.
nit: trailing comma
|
Updated to use the new OUTPUT_DIR pattern, and to produce a correct depfile for gradle (it was excluding all of the flutter assets). @blasten, were the flutter assets being included as a dependency in some other way? |
| @required String mainPath, | ||
| @required String outputDir, | ||
| }) async { | ||
| final Environment environment = Environment( |
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.
@jmagman This is an example of mapping a build * command to an assemble command. For example, in the iOS framework case this could include multiple calls if need be.
…to bundle_assemble
|
This change requires #39654 to land |
| try { | ||
| final File file = fs.file(fs.path.join(environment.outputDir.path, entry.key)); | ||
| file.parent.createSync(recursive: true); | ||
| await file.writeAsBytes(await entry.value.contentsAsBytes()); |
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.
How about testing if entry.value is a DevFSFileContent and if so use File.copy() instead?
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.
Done
|
Landed the perquisite PR, will attempt to land if CI passes. |
|
Per my discussion with @yjbanov, I'm going to ignore web failures on this (since it is unrelated). Will land once build is green |
| } catch (e) { | ||
| } catch (e, st) { | ||
| print(e); | ||
| print(st); |
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.
nit: this print and the one above
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.
Oops!
|
We believe that the web tests are broken and have disabled them. I'm ignoring them for this PR. |
This reverts commit a7aff56.
Description
Update build bundle to delegate the call to build bundle to flutter assemble. Then copy the required assets out of the cache directory and into the build/* directory, or where told.
Problem: depfile generated by dart rule will have the wrong paths. I don't really think we should hack around this, and instead work on shrinking flutter gradle to a single assemble invocation. The tool can then output inputs/outputs in a depfile format