mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tool] Various fixes for 'run' for Fuchisa. (#44920)
This commit is contained in:
parent
55530d905a
commit
afe4830a9d
18
examples/flutter_gallery/fuchsia/meta/flutter_gallery.cmx
Normal file
18
examples/flutter_gallery/fuchsia/meta/flutter_gallery.cmx
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"program": {
|
||||
"data": "data/flutter_gallery"
|
||||
},
|
||||
"sandbox": {
|
||||
"services": [
|
||||
"fuchsia.cobalt.LoggerFactory",
|
||||
"fuchsia.fonts.Provider",
|
||||
"fuchsia.logger.LogSink",
|
||||
"fuchsia.modular.Clipboard",
|
||||
"fuchsia.sys.Environment",
|
||||
"fuchsia.sys.Launcher",
|
||||
"fuchsia.ui.input.ImeService",
|
||||
"fuchsia.ui.policy.Presenter",
|
||||
"fuchsia.ui.scenic.Scenic"
|
||||
]
|
||||
}
|
||||
}
|
18
examples/hello_world/fuchsia/meta/hello_world.cmx
Normal file
18
examples/hello_world/fuchsia/meta/hello_world.cmx
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"program": {
|
||||
"data": "data/hello_world"
|
||||
},
|
||||
"sandbox": {
|
||||
"services": [
|
||||
"fuchsia.cobalt.LoggerFactory",
|
||||
"fuchsia.fonts.Provider",
|
||||
"fuchsia.logger.LogSink",
|
||||
"fuchsia.modular.Clipboard",
|
||||
"fuchsia.sys.Environment",
|
||||
"fuchsia.sys.Launcher",
|
||||
"fuchsia.ui.input.ImeService",
|
||||
"fuchsia.ui.policy.Presenter",
|
||||
"fuchsia.ui.scenic.Scenic"
|
||||
]
|
||||
}
|
||||
}
|
@ -102,7 +102,7 @@ class FuchsiaAmberCtl {
|
||||
/// the Fuchsia package server that it was accessing via [serverUrl].
|
||||
Future<bool> pkgCtlRepoRemove(FuchsiaDevice device, FuchsiaPackageServer server) async {
|
||||
final String repoUrl = 'fuchsia-pkg://${server.name}';
|
||||
final RunResult result = await device.shell('pkgctl repo remove --repo-url $repoUrl');
|
||||
final RunResult result = await device.shell('pkgctl repo rm $repoUrl');
|
||||
return result.exitCode == 0;
|
||||
}
|
||||
}
|
||||
|
@ -246,14 +246,25 @@ class FuchsiaDevice extends Device {
|
||||
printError('Failed to find a free port');
|
||||
return LaunchResult.failed();
|
||||
}
|
||||
|
||||
// Try Start with a fresh package repo in case one was left over from a
|
||||
// previous run.
|
||||
final Directory packageRepo =
|
||||
fs.directory(fs.path.join(getFuchsiaBuildDirectory(), '.pkg-repo'));
|
||||
packageRepo.createSync(recursive: true);
|
||||
try {
|
||||
if (packageRepo.existsSync()) {
|
||||
packageRepo.deleteSync(recursive: true);
|
||||
}
|
||||
packageRepo.createSync(recursive: true);
|
||||
} catch (e) {
|
||||
printError('Failed to create Fuchisa package repo directory '
|
||||
'at ${packageRepo.path}: $e');
|
||||
return LaunchResult.failed();
|
||||
}
|
||||
|
||||
final String appName = FlutterProject.current().manifest.appName;
|
||||
|
||||
final Status status = logger.startProgress(
|
||||
'Starting Fuchsia application...',
|
||||
'Starting Fuchsia application $appName...',
|
||||
timeout: null,
|
||||
);
|
||||
FuchsiaPackageServer fuchsiaPackageServer;
|
||||
@ -332,8 +343,7 @@ class FuchsiaDevice extends Device {
|
||||
}
|
||||
|
||||
// Instruct tiles_ctl to start the app.
|
||||
final String fuchsiaUrl =
|
||||
'fuchsia-pkg://$packageServerName/$appName#meta/$appName.cmx';
|
||||
final String fuchsiaUrl = 'fuchsia-pkg://$packageServerName/$appName#meta/$appName.cmx';
|
||||
if (!await fuchsiaDeviceTools.tilesCtl.add(this, fuchsiaUrl, <String>[])) {
|
||||
printError('Failed to add the app to tiles');
|
||||
return LaunchResult.failed();
|
||||
@ -345,8 +355,15 @@ class FuchsiaDevice extends Device {
|
||||
await fuchsiaDeviceTools.amberCtl.pkgCtlRepoRemove(this, fuchsiaPackageServer);
|
||||
}
|
||||
// Shutdown the package server and delete the package repo;
|
||||
printTrace('Shutting down the tool\'s package server.');
|
||||
fuchsiaPackageServer?.stop();
|
||||
packageRepo.deleteSync(recursive: true);
|
||||
printTrace('Removing the tool\'s package repo: at ${packageRepo.path}');
|
||||
try {
|
||||
packageRepo.deleteSync(recursive: true);
|
||||
} catch (e) {
|
||||
printError('Failed to remove Fuchsia package repo directory '
|
||||
'at ${packageRepo.path}: $e.');
|
||||
}
|
||||
status.cancel();
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,9 @@ class FuchsiaKernelCompiler {
|
||||
'--filesystem-root', fsRoot,
|
||||
'--packages', '$multiRootScheme:///$relativePackagesFile',
|
||||
'--output', fs.path.join(outDir, '$appName.dil'),
|
||||
'--no-link-platform',
|
||||
// TODO(zra): Add back when this is supported again.
|
||||
// See: https://github.com/flutter/flutter/issues/44925
|
||||
// '--no-link-platform',
|
||||
'--split-output-by-packages',
|
||||
'--manifest', manifestPath,
|
||||
'--component-name', appName,
|
||||
|
Loading…
Reference in New Issue
Block a user