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
[flutter_tool] Use engine flutter_runner prebuilts #43381
Conversation
@@ -106,7 +106,7 @@ void _rewriteCmx(BuildMode mode, File src, File dst) { | |||
throwToolExit('Fuchsia does not support build mode "$mode"'); | |||
break; | |||
} | |||
cmx['runner'] = 'fuchsia-pkg://fuchsia.com/$runner#meta/$runner.cmx'; | |||
cmx['runner'] = 'fuchsia-pkg://flutter_tool/$runner#meta/$runner.cmx'; |
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 this works blows my mind
String flutterRunnerName = 'flutter_jit_runner'; | ||
if (!debuggingOptions.buildInfo.isDebug && | ||
!debuggingOptions.buildInfo.isProfile) { | ||
flutterRunnerName = 'flutter_jit_product_runner'; |
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.
we should use the aot runner
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 be a separate PR of course)
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, the tool doesn't know how to build aot Fuchsia packages, yet, so that'll probably be a bigger change.
} | ||
final String appName = flutterProject.fuchsia.project.manifest.appName; | ||
final String cmxPath = fs.path.join( | ||
flutterProject.fuchsia.meta.path, '$appName.cmx'); | ||
final File cmxFile = fs.file(cmxPath); | ||
if (!cmxFile.existsSync()) { | ||
throwToolExit('Fuchsia build requires a .cmx file at $cmxPath for the app'); | ||
throwToolExit('The Fuchsia build requires a .cmx file at $cmxPath for the app.'); |
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.
Could we link to an example cmx file 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.
Added a cmx file for the stocks example.
final File farArchive = package.farArchive( | ||
debuggingOptions.buildInfo.mode); | ||
if (!await fuchsiaPackageServer.addPackage(farArchive)) { | ||
printError('Failed to add package to the package server'); | ||
return LaunchResult.failed(); | ||
} | ||
|
||
// Serve the flutter_runner. |
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.
Could this use the existing artifacts.getArtifactPath(...)
APIs 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.
help: 'The package source to use for the flutter_runner. ' | ||
'"fuchsia.com" implies using a runner in the installed Fuchsia image. ' | ||
'"flutter_tool" implies using a runner distributed with Flutter.', | ||
allowed: <String>['fuchsia.com', 'flutter_tool'], |
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: represent this as an enum/class or create const values to avoid stringly-typed issues.
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.
case Artifact.fuchsiaPlatformDill: | ||
case Artifact.fuchsiaPatchedSdk: | ||
case Artifact.fuchsiaFlutterJitRunner: | ||
assert(false, 'Invalid local engine artifact $artifact.'); |
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.
@iskakaushik Do you know where these would be in a local engine 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.
Sorry, missed this somehow. They would be in the out/fuchsia_x64_.../flutter_aot_runner.far
for example.
ptal |
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 with nit
Co-Authored-By: Jonah Williams <jonahwilliams@google.com>
* [flutter_tool] Use engine flutter_runner prebuilts * Update packages/flutter_tools/lib/src/fuchsia/fuchsia_build.dart Co-Authored-By: Jonah Williams <jonahwilliams@google.com>
Description
This PR switches Fuchsia targets to use the engine prebuilts instead of the prebuilts bundled with the Fuchsia SDK. The prebuilts bundled with the Fuchsia SDK are to be removed as part of the flutter_runner migration to the engine repo.
Tests
Updated existing tests, and added tests for querying
FuchsiaDevice.targetPlatform
.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?