mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tool] Use engine flutter_runner prebuilts (#43381)
* [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>
This commit is contained in:
parent
ab260bacd2
commit
0dfabb2ae1
22
examples/stocks/fuchsia/meta/stocks.cmx
Normal file
22
examples/stocks/fuchsia/meta/stocks.cmx
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"program": {
|
||||||
|
"data": "data/stocks"
|
||||||
|
},
|
||||||
|
"sandbox": {
|
||||||
|
"services": [
|
||||||
|
"fuchsia.cobalt.LoggerFactory",
|
||||||
|
"fuchsia.fonts.Provider",
|
||||||
|
"fuchsia.logger.LogSink",
|
||||||
|
"fuchsia.modular.Clipboard",
|
||||||
|
"fuchsia.modular.ContextWriter",
|
||||||
|
"fuchsia.modular.DeviceMap",
|
||||||
|
"fuchsia.modular.ModuleContext",
|
||||||
|
"fuchsia.sys.Environment",
|
||||||
|
"fuchsia.sys.Launcher",
|
||||||
|
"fuchsia.testing.runner.TestRunner",
|
||||||
|
"fuchsia.ui.input.ImeService",
|
||||||
|
"fuchsia.ui.policy.Presenter",
|
||||||
|
"fuchsia.ui.scenic.Scenic"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -69,7 +69,8 @@ class ApplicationPackageFactory {
|
|||||||
return applicationBinary == null
|
return applicationBinary == null
|
||||||
? WindowsApp.fromWindowsProject(FlutterProject.current().windows)
|
? WindowsApp.fromWindowsProject(FlutterProject.current().windows)
|
||||||
: WindowsApp.fromPrebuiltApp(applicationBinary);
|
: WindowsApp.fromPrebuiltApp(applicationBinary);
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
return applicationBinary == null
|
return applicationBinary == null
|
||||||
? FuchsiaApp.fromFuchsiaProject(FlutterProject.current().fuchsia)
|
? FuchsiaApp.fromFuchsiaProject(FlutterProject.current().fuchsia)
|
||||||
: FuchsiaApp.fromPrebuiltApp(applicationBinary);
|
: FuchsiaApp.fromPrebuiltApp(applicationBinary);
|
||||||
@ -424,7 +425,8 @@ class ApplicationPackageStore {
|
|||||||
case TargetPlatform.ios:
|
case TargetPlatform.ios:
|
||||||
iOS ??= await IOSApp.fromIosProject(FlutterProject.current().ios);
|
iOS ??= await IOSApp.fromIosProject(FlutterProject.current().ios);
|
||||||
return iOS;
|
return iOS;
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
fuchsia ??= FuchsiaApp.fromFuchsiaProject(FlutterProject.current().fuchsia);
|
fuchsia ??= FuchsiaApp.fromFuchsiaProject(FlutterProject.current().fuchsia);
|
||||||
return fuchsia;
|
return fuchsia;
|
||||||
case TargetPlatform.darwin_x64:
|
case TargetPlatform.darwin_x64:
|
||||||
|
@ -58,6 +58,12 @@ enum Artifact {
|
|||||||
skyEnginePath,
|
skyEnginePath,
|
||||||
/// The location of the macOS engine podspec file.
|
/// The location of the macOS engine podspec file.
|
||||||
flutterMacOSPodspec,
|
flutterMacOSPodspec,
|
||||||
|
|
||||||
|
// Fuchsia artifacts from the engine prebuilts.
|
||||||
|
fuchsiaKernelCompiler,
|
||||||
|
fuchsiaPlatformDill,
|
||||||
|
fuchsiaPatchedSdk,
|
||||||
|
fuchsiaFlutterJitRunner,
|
||||||
}
|
}
|
||||||
|
|
||||||
String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) {
|
String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMode mode ]) {
|
||||||
@ -130,6 +136,17 @@ String _artifactToFileName(Artifact artifact, [ TargetPlatform platform, BuildMo
|
|||||||
return 'FlutterMacOS.podspec';
|
return 'FlutterMacOS.podspec';
|
||||||
case Artifact.webPlatformKernelDill:
|
case Artifact.webPlatformKernelDill:
|
||||||
return 'flutter_ddc_sdk.dill';
|
return 'flutter_ddc_sdk.dill';
|
||||||
|
case Artifact.fuchsiaKernelCompiler:
|
||||||
|
return 'kernel_compiler.snapshot';
|
||||||
|
case Artifact.fuchsiaPlatformDill:
|
||||||
|
return 'platform_strong.dill';
|
||||||
|
case Artifact.fuchsiaPatchedSdk:
|
||||||
|
return 'flutter_runner_patched_sdk';
|
||||||
|
case Artifact.fuchsiaFlutterJitRunner:
|
||||||
|
if (mode == BuildMode.debug || mode == BuildMode.profile) {
|
||||||
|
return 'flutter_jit_runner-0.far';
|
||||||
|
}
|
||||||
|
return 'flutter_jit_product_runner-0.far';
|
||||||
}
|
}
|
||||||
assert(false, 'Invalid artifact $artifact.');
|
assert(false, 'Invalid artifact $artifact.');
|
||||||
return null;
|
return null;
|
||||||
@ -190,8 +207,10 @@ class CachedArtifacts extends Artifacts {
|
|||||||
return _getIosArtifactPath(artifact, platform, mode);
|
return _getIosArtifactPath(artifact, platform, mode);
|
||||||
case TargetPlatform.darwin_x64:
|
case TargetPlatform.darwin_x64:
|
||||||
return _getDarwinArtifactPath(artifact, platform, mode);
|
return _getDarwinArtifactPath(artifact, platform, mode);
|
||||||
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
|
return _getFuchsiaArtifactPath(artifact, platform, mode);
|
||||||
case TargetPlatform.linux_x64:
|
case TargetPlatform.linux_x64:
|
||||||
case TargetPlatform.fuchsia:
|
|
||||||
case TargetPlatform.windows_x64:
|
case TargetPlatform.windows_x64:
|
||||||
case TargetPlatform.tester:
|
case TargetPlatform.tester:
|
||||||
case TargetPlatform.web_javascript:
|
case TargetPlatform.web_javascript:
|
||||||
@ -258,6 +277,28 @@ class CachedArtifacts extends Artifacts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String _getFuchsiaArtifactPath(Artifact artifact, TargetPlatform platform, BuildMode mode) {
|
||||||
|
final String artifactFileName = _artifactToFileName(artifact, platform, mode);
|
||||||
|
final String root = fs.path.join(
|
||||||
|
cache.getArtifactDirectory('flutter_runner').path,
|
||||||
|
'flutter',
|
||||||
|
fuchsiaArchForTargetPlatform(platform),
|
||||||
|
getNameForBuildMode(mode),
|
||||||
|
);
|
||||||
|
switch (artifact) {
|
||||||
|
case Artifact.fuchsiaKernelCompiler:
|
||||||
|
return fs.path.join(root, 'jit', 'dart_binaries', artifactFileName);
|
||||||
|
case Artifact.fuchsiaPlatformDill:
|
||||||
|
return fs.path.join(root, 'jit', 'flutter_runner_patched_sdk', artifactFileName);
|
||||||
|
case Artifact.fuchsiaPatchedSdk:
|
||||||
|
case Artifact.fuchsiaFlutterJitRunner:
|
||||||
|
return fs.path.join(root, 'jit', artifactFileName);
|
||||||
|
default:
|
||||||
|
assert(false, 'Artifact $artifact not available for platform $platform.');
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String _getFlutterPatchedSdkPath(BuildMode mode) {
|
String _getFlutterPatchedSdkPath(BuildMode mode) {
|
||||||
final String engineArtifactsPath = cache.getArtifactDirectory('engine').path;
|
final String engineArtifactsPath = cache.getArtifactDirectory('engine').path;
|
||||||
return fs.path.join(engineArtifactsPath, 'common',
|
return fs.path.join(engineArtifactsPath, 'common',
|
||||||
@ -339,7 +380,8 @@ class CachedArtifacts extends Artifacts {
|
|||||||
}
|
}
|
||||||
final String suffix = mode != BuildMode.debug ? '-${snakeCase(getModeName(mode), '-')}' : '';
|
final String suffix = mode != BuildMode.debug ? '-${snakeCase(getModeName(mode), '-')}' : '';
|
||||||
return fs.path.join(engineDir, platformName + suffix);
|
return fs.path.join(engineDir, platformName + suffix);
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
case TargetPlatform.tester:
|
case TargetPlatform.tester:
|
||||||
case TargetPlatform.web_javascript:
|
case TargetPlatform.web_javascript:
|
||||||
assert(mode == null, 'Platform $platform does not support different build modes.');
|
assert(mode == null, 'Platform $platform does not support different build modes.');
|
||||||
@ -430,6 +472,12 @@ class LocalEngineArtifacts extends Artifacts {
|
|||||||
return fs.path.join(_hostEngineOutPath, _artifactToFileName(artifact));
|
return fs.path.join(_hostEngineOutPath, _artifactToFileName(artifact));
|
||||||
case Artifact.webPlatformKernelDill:
|
case Artifact.webPlatformKernelDill:
|
||||||
return fs.path.join(_getFlutterWebSdkPath(), 'kernel', _artifactToFileName(artifact));
|
return fs.path.join(_getFlutterWebSdkPath(), 'kernel', _artifactToFileName(artifact));
|
||||||
|
case Artifact.fuchsiaKernelCompiler:
|
||||||
|
case Artifact.fuchsiaPlatformDill:
|
||||||
|
case Artifact.fuchsiaPatchedSdk:
|
||||||
|
case Artifact.fuchsiaFlutterJitRunner:
|
||||||
|
assert(false, 'Invalid local engine artifact $artifact.');
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
assert(false, 'Invalid artifact $artifact.');
|
assert(false, 'Invalid artifact $artifact.');
|
||||||
return null;
|
return null;
|
||||||
|
@ -314,7 +314,8 @@ enum TargetPlatform {
|
|||||||
darwin_x64,
|
darwin_x64,
|
||||||
linux_x64,
|
linux_x64,
|
||||||
windows_x64,
|
windows_x64,
|
||||||
fuchsia,
|
fuchsia_arm64,
|
||||||
|
fuchsia_x64,
|
||||||
tester,
|
tester,
|
||||||
web_javascript,
|
web_javascript,
|
||||||
}
|
}
|
||||||
@ -382,8 +383,10 @@ String getNameForTargetPlatform(TargetPlatform platform) {
|
|||||||
return 'linux-x64';
|
return 'linux-x64';
|
||||||
case TargetPlatform.windows_x64:
|
case TargetPlatform.windows_x64:
|
||||||
return 'windows-x64';
|
return 'windows-x64';
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia_arm64:
|
||||||
return 'fuchsia';
|
return 'fuchsia-arm64';
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
|
return 'fuchsia-x64';
|
||||||
case TargetPlatform.tester:
|
case TargetPlatform.tester:
|
||||||
return 'flutter-tester';
|
return 'flutter-tester';
|
||||||
case TargetPlatform.web_javascript:
|
case TargetPlatform.web_javascript:
|
||||||
@ -403,6 +406,10 @@ TargetPlatform getTargetPlatformForName(String platform) {
|
|||||||
return TargetPlatform.android_x64;
|
return TargetPlatform.android_x64;
|
||||||
case 'android-x86':
|
case 'android-x86':
|
||||||
return TargetPlatform.android_x86;
|
return TargetPlatform.android_x86;
|
||||||
|
case 'fuchsia-arm64':
|
||||||
|
return TargetPlatform.fuchsia_arm64;
|
||||||
|
case 'fuchsia-x64':
|
||||||
|
return TargetPlatform.fuchsia_x64;
|
||||||
case 'ios':
|
case 'ios':
|
||||||
return TargetPlatform.ios;
|
return TargetPlatform.ios;
|
||||||
case 'darwin-x64':
|
case 'darwin-x64':
|
||||||
@ -463,6 +470,18 @@ String getPlatformNameForAndroidArch(AndroidArch arch) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String fuchsiaArchForTargetPlatform(TargetPlatform targetPlatform) {
|
||||||
|
switch (targetPlatform) {
|
||||||
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
return 'arm64';
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
|
return 'x64';
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
HostPlatform getCurrentHostPlatform() {
|
HostPlatform getCurrentHostPlatform() {
|
||||||
if (platform.isMacOS) {
|
if (platform.isMacOS) {
|
||||||
return HostPlatform.darwin_x64;
|
return HostPlatform.darwin_x64;
|
||||||
|
@ -10,6 +10,7 @@ import '../base/platform.dart';
|
|||||||
import '../build_info.dart';
|
import '../build_info.dart';
|
||||||
import '../cache.dart';
|
import '../cache.dart';
|
||||||
import '../fuchsia/fuchsia_build.dart';
|
import '../fuchsia/fuchsia_build.dart';
|
||||||
|
import '../fuchsia/fuchsia_pm.dart';
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
import '../runner/flutter_command.dart' show FlutterCommandResult;
|
||||||
import 'build.dart';
|
import 'build.dart';
|
||||||
@ -19,6 +20,17 @@ class BuildFuchsiaCommand extends BuildSubCommand {
|
|||||||
BuildFuchsiaCommand({bool verboseHelp = false}) {
|
BuildFuchsiaCommand({bool verboseHelp = false}) {
|
||||||
usesTargetOption();
|
usesTargetOption();
|
||||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
addBuildModeFlags(verboseHelp: verboseHelp);
|
||||||
|
argParser.addOption(
|
||||||
|
'runner-source',
|
||||||
|
help: 'The package source to use for the flutter_runner. '
|
||||||
|
'"${FuchsiaPackageServer.deviceHost}" implies using a runner already on the device. '
|
||||||
|
'"${FuchsiaPackageServer.toolHost}" implies using a runner distributed with Flutter.',
|
||||||
|
allowed: <String>[
|
||||||
|
FuchsiaPackageServer.deviceHost,
|
||||||
|
FuchsiaPackageServer.toolHost,
|
||||||
|
],
|
||||||
|
defaultsTo: FuchsiaPackageServer.toolHost,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -34,7 +46,7 @@ class BuildFuchsiaCommand extends BuildSubCommand {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get description => 'build the Fuchsia target (Experimental).';
|
String get description => 'Build the Fuchsia target (Experimental).';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<FlutterCommandResult> runCommand() async {
|
Future<FlutterCommandResult> runCommand() async {
|
||||||
@ -42,22 +54,24 @@ class BuildFuchsiaCommand extends BuildSubCommand {
|
|||||||
final BuildInfo buildInfo = getBuildInfo();
|
final BuildInfo buildInfo = getBuildInfo();
|
||||||
final FlutterProject flutterProject = FlutterProject.current();
|
final FlutterProject flutterProject = FlutterProject.current();
|
||||||
if (!platform.isLinux && !platform.isMacOS) {
|
if (!platform.isLinux && !platform.isMacOS) {
|
||||||
throwToolExit('"build Fuchsia" only supported on Linux and MacOS hosts.');
|
throwToolExit('"build fuchsia" is only supported on Linux and MacOS hosts.');
|
||||||
}
|
}
|
||||||
if (!flutterProject.fuchsia.existsSync()) {
|
if (!flutterProject.fuchsia.existsSync()) {
|
||||||
throwToolExit('No Fuchsia project configured.');
|
throwToolExit('No Fuchsia project is configured.');
|
||||||
}
|
}
|
||||||
final String appName = flutterProject.fuchsia.project.manifest.appName;
|
final String appName = flutterProject.fuchsia.project.manifest.appName;
|
||||||
final String cmxPath = fs.path.join(
|
final String cmxPath = fs.path.join(
|
||||||
flutterProject.fuchsia.meta.path, '$appName.cmx');
|
flutterProject.fuchsia.meta.path, '$appName.cmx');
|
||||||
final File cmxFile = fs.file(cmxPath);
|
final File cmxFile = fs.file(cmxPath);
|
||||||
if (!cmxFile.existsSync()) {
|
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.');
|
||||||
}
|
}
|
||||||
await buildFuchsia(
|
await buildFuchsia(
|
||||||
fuchsiaProject: flutterProject.fuchsia,
|
fuchsiaProject: flutterProject.fuchsia,
|
||||||
target: targetFile,
|
target: targetFile,
|
||||||
buildInfo: buildInfo);
|
buildInfo: buildInfo,
|
||||||
|
runnerPackageSource: argResults['runner-source'],
|
||||||
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,7 +178,8 @@ class DeviceManager {
|
|||||||
if (hasSpecifiedAllDevices) {
|
if (hasSpecifiedAllDevices) {
|
||||||
devices = <Device>[
|
devices = <Device>[
|
||||||
for (Device device in devices)
|
for (Device device in devices)
|
||||||
if (await device.targetPlatform != TargetPlatform.fuchsia &&
|
if (await device.targetPlatform != TargetPlatform.fuchsia_arm64 &&
|
||||||
|
await device.targetPlatform != TargetPlatform.fuchsia_x64 &&
|
||||||
await device.targetPlatform != TargetPlatform.web_javascript)
|
await device.targetPlatform != TargetPlatform.web_javascript)
|
||||||
device,
|
device,
|
||||||
];
|
];
|
||||||
@ -339,7 +340,8 @@ abstract class Device {
|
|||||||
case TargetPlatform.darwin_x64:
|
case TargetPlatform.darwin_x64:
|
||||||
case TargetPlatform.linux_x64:
|
case TargetPlatform.linux_x64:
|
||||||
case TargetPlatform.windows_x64:
|
case TargetPlatform.windows_x64:
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,7 @@ Future<void> buildFuchsia({
|
|||||||
@required FuchsiaProject fuchsiaProject,
|
@required FuchsiaProject fuchsiaProject,
|
||||||
@required String target, // E.g., lib/main.dart
|
@required String target, // E.g., lib/main.dart
|
||||||
BuildInfo buildInfo = BuildInfo.debug,
|
BuildInfo buildInfo = BuildInfo.debug,
|
||||||
|
String runnerPackageSource = FuchsiaPackageServer.toolHost,
|
||||||
}) async {
|
}) async {
|
||||||
final Directory outDir = fs.directory(getFuchsiaBuildDirectory());
|
final Directory outDir = fs.directory(getFuchsiaBuildDirectory());
|
||||||
if (!outDir.existsSync()) {
|
if (!outDir.existsSync()) {
|
||||||
@ -50,7 +51,7 @@ Future<void> buildFuchsia({
|
|||||||
await _timedBuildStep('fuchsia-build-assets',
|
await _timedBuildStep('fuchsia-build-assets',
|
||||||
() => _buildAssets(fuchsiaProject, target, buildInfo));
|
() => _buildAssets(fuchsiaProject, target, buildInfo));
|
||||||
await _timedBuildStep('fuchsia-build-package',
|
await _timedBuildStep('fuchsia-build-package',
|
||||||
() => _buildPackage(fuchsiaProject, target, buildInfo));
|
() => _buildPackage(fuchsiaProject, target, buildInfo, runnerPackageSource));
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _buildAssets(
|
Future<void> _buildAssets(
|
||||||
@ -85,7 +86,7 @@ Future<void> _buildAssets(
|
|||||||
await outFile.close();
|
await outFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _rewriteCmx(BuildMode mode, File src, File dst) {
|
void _rewriteCmx(BuildMode mode, String runnerPackageSource, File src, File dst) {
|
||||||
final Map<String, dynamic> cmx = json.decode(src.readAsStringSync());
|
final Map<String, dynamic> cmx = json.decode(src.readAsStringSync());
|
||||||
// If the app author has already specified the runner in the cmx file, then
|
// If the app author has already specified the runner in the cmx file, then
|
||||||
// do not override it with something else.
|
// do not override it with something else.
|
||||||
@ -106,7 +107,7 @@ void _rewriteCmx(BuildMode mode, File src, File dst) {
|
|||||||
throwToolExit('Fuchsia does not support build mode "$mode"');
|
throwToolExit('Fuchsia does not support build mode "$mode"');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
cmx['runner'] = 'fuchsia-pkg://fuchsia.com/$runner#meta/$runner.cmx';
|
cmx['runner'] = 'fuchsia-pkg://$runnerPackageSource/$runner#meta/$runner.cmx';
|
||||||
dst.writeAsStringSync(json.encode(cmx));
|
dst.writeAsStringSync(json.encode(cmx));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +116,7 @@ Future<void> _buildPackage(
|
|||||||
FuchsiaProject fuchsiaProject,
|
FuchsiaProject fuchsiaProject,
|
||||||
String target, // lib/main.dart
|
String target, // lib/main.dart
|
||||||
BuildInfo buildInfo,
|
BuildInfo buildInfo,
|
||||||
|
String runnerPackageSource,
|
||||||
) async {
|
) async {
|
||||||
final String outDir = getFuchsiaBuildDirectory();
|
final String outDir = getFuchsiaBuildDirectory();
|
||||||
final String pkgDir = fs.path.join(outDir, 'pkg');
|
final String pkgDir = fs.path.join(outDir, 'pkg');
|
||||||
@ -132,7 +134,7 @@ Future<void> _buildPackage(
|
|||||||
final File srcCmx =
|
final File srcCmx =
|
||||||
fs.file(fs.path.join(fuchsiaProject.meta.path, '$appName.cmx'));
|
fs.file(fs.path.join(fuchsiaProject.meta.path, '$appName.cmx'));
|
||||||
final File dstCmx = fs.file(fs.path.join(outDir, '$appName.cmx'));
|
final File dstCmx = fs.file(fs.path.join(outDir, '$appName.cmx'));
|
||||||
_rewriteCmx(buildInfo.mode, srcCmx, dstCmx);
|
_rewriteCmx(buildInfo.mode, runnerPackageSource, srcCmx, dstCmx);
|
||||||
|
|
||||||
// Concatenate dilpmanifest and pkgassets into package_manifest.
|
// Concatenate dilpmanifest and pkgassets into package_manifest.
|
||||||
final File manifestFile = fs.file(packageManifest);
|
final File manifestFile = fs.file(packageManifest);
|
||||||
|
@ -272,13 +272,15 @@ class FuchsiaDevice extends Device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start up a package server.
|
// Start up a package server.
|
||||||
const String packageServerName = 'flutter_tool';
|
const String packageServerName = FuchsiaPackageServer.toolHost;
|
||||||
fuchsiaPackageServer = FuchsiaPackageServer(
|
fuchsiaPackageServer = FuchsiaPackageServer(
|
||||||
packageRepo.path, packageServerName, host, port);
|
packageRepo.path, packageServerName, host, port);
|
||||||
if (!await fuchsiaPackageServer.start()) {
|
if (!await fuchsiaPackageServer.start()) {
|
||||||
printError('Failed to start the Fuchsia package server');
|
printError('Failed to start the Fuchsia package server');
|
||||||
return LaunchResult.failed();
|
return LaunchResult.failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Serve the application's package.
|
||||||
final File farArchive = package.farArchive(
|
final File farArchive = package.farArchive(
|
||||||
debuggingOptions.buildInfo.mode);
|
debuggingOptions.buildInfo.mode);
|
||||||
if (!await fuchsiaPackageServer.addPackage(farArchive)) {
|
if (!await fuchsiaPackageServer.addPackage(farArchive)) {
|
||||||
@ -286,6 +288,17 @@ class FuchsiaDevice extends Device {
|
|||||||
return LaunchResult.failed();
|
return LaunchResult.failed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Serve the flutter_runner.
|
||||||
|
final File flutterRunnerArchive = fs.file(artifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaFlutterJitRunner,
|
||||||
|
platform: await targetPlatform,
|
||||||
|
mode: debuggingOptions.buildInfo.mode,
|
||||||
|
));
|
||||||
|
if (!await fuchsiaPackageServer.addPackage(flutterRunnerArchive)) {
|
||||||
|
printError('Failed to add flutter_runner package to the package server');
|
||||||
|
return LaunchResult.failed();
|
||||||
|
}
|
||||||
|
|
||||||
// Teach the package controller about the package server.
|
// Teach the package controller about the package server.
|
||||||
if (!await fuchsiaDeviceTools.amberCtl.addRepoCfg(this, fuchsiaPackageServer)) {
|
if (!await fuchsiaDeviceTools.amberCtl.addRepoCfg(this, fuchsiaPackageServer)) {
|
||||||
printError('Failed to teach amber about the package server');
|
printError('Failed to teach amber about the package server');
|
||||||
@ -293,6 +306,18 @@ class FuchsiaDevice extends Device {
|
|||||||
}
|
}
|
||||||
serverRegistered = true;
|
serverRegistered = true;
|
||||||
|
|
||||||
|
// Tell the package controller to prefetch the flutter_runner.
|
||||||
|
String flutterRunnerName = 'flutter_jit_runner';
|
||||||
|
if (!debuggingOptions.buildInfo.isDebug &&
|
||||||
|
!debuggingOptions.buildInfo.isProfile) {
|
||||||
|
flutterRunnerName = 'flutter_jit_product_runner';
|
||||||
|
}
|
||||||
|
if (!await fuchsiaDeviceTools.amberCtl.pkgCtlResolve(
|
||||||
|
this, fuchsiaPackageServer, flutterRunnerName)) {
|
||||||
|
printError('Failed to get pkgctl to prefetch the flutter_runner');
|
||||||
|
return LaunchResult.failed();
|
||||||
|
}
|
||||||
|
|
||||||
// Tell the package controller to prefetch the app.
|
// Tell the package controller to prefetch the app.
|
||||||
if (!await fuchsiaDeviceTools.amberCtl.pkgCtlResolve(
|
if (!await fuchsiaDeviceTools.amberCtl.pkgCtlResolve(
|
||||||
this, fuchsiaPackageServer, appName)) {
|
this, fuchsiaPackageServer, appName)) {
|
||||||
@ -353,8 +378,30 @@ class FuchsiaDevice extends Device {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TargetPlatform _targetPlatform;
|
||||||
|
|
||||||
|
Future<TargetPlatform> _queryTargetPlatform() async {
|
||||||
|
final RunResult result = await shell('uname -m');
|
||||||
|
if (result.exitCode != 0) {
|
||||||
|
printError('Could not determine Fuchsia target platform type:\n$result\n'
|
||||||
|
'Defaulting to arm64.');
|
||||||
|
return TargetPlatform.fuchsia_arm64;
|
||||||
|
}
|
||||||
|
final String machine = result.stdout.trim();
|
||||||
|
switch (machine) {
|
||||||
|
case 'aarch64':
|
||||||
|
return TargetPlatform.fuchsia_arm64;
|
||||||
|
case 'x86_64':
|
||||||
|
return TargetPlatform.fuchsia_x64;
|
||||||
|
default:
|
||||||
|
printError('Unknown Fuchsia target platform "$machine". '
|
||||||
|
'Defaulting to arm64.');
|
||||||
|
return TargetPlatform.fuchsia_arm64;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<TargetPlatform> get targetPlatform async => TargetPlatform.fuchsia;
|
Future<TargetPlatform> get targetPlatform async => _targetPlatform ??= await _queryTargetPlatform();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<String> get sdkNameAndVersion async {
|
Future<String> get sdkNameAndVersion async {
|
||||||
@ -389,8 +436,16 @@ class FuchsiaDevice extends Device {
|
|||||||
OverrideArtifacts get artifactOverrides {
|
OverrideArtifacts get artifactOverrides {
|
||||||
return _artifactOverrides ??= OverrideArtifacts(
|
return _artifactOverrides ??= OverrideArtifacts(
|
||||||
parent: Artifacts.instance,
|
parent: Artifacts.instance,
|
||||||
platformKernelDill: fuchsiaArtifacts.platformKernelDill,
|
platformKernelDill: fs.file(artifacts.getArtifactPath(
|
||||||
flutterPatchedSdk: fuchsiaArtifacts.flutterPatchedSdk,
|
Artifact.fuchsiaPlatformDill,
|
||||||
|
platform: TargetPlatform.fuchsia_x64,
|
||||||
|
mode: BuildMode.debug,
|
||||||
|
)),
|
||||||
|
flutterPatchedSdk: fs.file(artifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaPatchedSdk,
|
||||||
|
platform: TargetPlatform.fuchsia_x64,
|
||||||
|
mode: BuildMode.debug,
|
||||||
|
)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
OverrideArtifacts _artifactOverrides;
|
OverrideArtifacts _artifactOverrides;
|
||||||
@ -535,7 +590,7 @@ class FuchsiaIsolateDiscoveryProtocol {
|
|||||||
'Waiting for a connection from $_isolateName on ${_device.name}...',
|
'Waiting for a connection from $_isolateName on ${_device.name}...',
|
||||||
timeout: null, // could take an arbitrary amount of time
|
timeout: null, // could take an arbitrary amount of time
|
||||||
);
|
);
|
||||||
_pollingTimer ??= Timer(_pollDuration, _findIsolate);
|
unawaited(_findIsolate()); // Completes the _foundUri Future.
|
||||||
return _foundUri.future.then((Uri uri) {
|
return _foundUri.future.then((Uri uri) {
|
||||||
_uri = uri;
|
_uri = uri;
|
||||||
return uri;
|
return uri;
|
||||||
|
@ -15,8 +15,6 @@ import '../convert.dart';
|
|||||||
import '../globals.dart';
|
import '../globals.dart';
|
||||||
import '../project.dart';
|
import '../project.dart';
|
||||||
|
|
||||||
import 'fuchsia_sdk.dart';
|
|
||||||
|
|
||||||
/// This is a simple wrapper around the custom kernel compiler from the Fuchsia
|
/// This is a simple wrapper around the custom kernel compiler from the Fuchsia
|
||||||
/// SDK.
|
/// SDK.
|
||||||
class FuchsiaKernelCompiler {
|
class FuchsiaKernelCompiler {
|
||||||
@ -30,20 +28,32 @@ class FuchsiaKernelCompiler {
|
|||||||
BuildInfo buildInfo = BuildInfo.debug,
|
BuildInfo buildInfo = BuildInfo.debug,
|
||||||
}) async {
|
}) async {
|
||||||
// TODO(zra): Use filesystem root and scheme information from buildInfo.
|
// TODO(zra): Use filesystem root and scheme information from buildInfo.
|
||||||
if (fuchsiaArtifacts.kernelCompiler == null) {
|
|
||||||
throwToolExit('Fuchisa kernel compiler not found');
|
|
||||||
}
|
|
||||||
const String multiRootScheme = 'main-root';
|
const String multiRootScheme = 'main-root';
|
||||||
final String packagesFile = fuchsiaProject.project.packagesFile.path;
|
final String packagesFile = fuchsiaProject.project.packagesFile.path;
|
||||||
final String outDir = getFuchsiaBuildDirectory();
|
final String outDir = getFuchsiaBuildDirectory();
|
||||||
final String appName = fuchsiaProject.project.manifest.appName;
|
final String appName = fuchsiaProject.project.manifest.appName;
|
||||||
final String fsRoot = fuchsiaProject.project.directory.path;
|
final String fsRoot = fuchsiaProject.project.directory.path;
|
||||||
final String relativePackagesFile =
|
final String relativePackagesFile = fs.path.relative(packagesFile, from: fsRoot);
|
||||||
fs.path.relative(packagesFile, from: fsRoot);
|
|
||||||
final String manifestPath = fs.path.join(outDir, '$appName.dilpmanifest');
|
final String manifestPath = fs.path.join(outDir, '$appName.dilpmanifest');
|
||||||
|
final String kernelCompiler = artifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaKernelCompiler,
|
||||||
|
platform: TargetPlatform.fuchsia_x64, // This file is not arch-specific.
|
||||||
|
mode: BuildMode.debug,
|
||||||
|
);
|
||||||
|
if (!fs.isFileSync(kernelCompiler)) {
|
||||||
|
throwToolExit('Fuchisa kernel compiler not found at "$kernelCompiler"');
|
||||||
|
}
|
||||||
|
final String platformDill = artifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaPlatformDill,
|
||||||
|
platform: TargetPlatform.fuchsia_x64, // This file is not arch-specific.
|
||||||
|
mode: buildInfo.mode,
|
||||||
|
);
|
||||||
|
if (!fs.isFileSync(platformDill)) {
|
||||||
|
throwToolExit('Fuchisa platform file not found at "$platformDill"');
|
||||||
|
}
|
||||||
List<String> flags = <String>[
|
List<String> flags = <String>[
|
||||||
'--target', 'flutter_runner',
|
'--target', 'flutter_runner',
|
||||||
'--platform', fuchsiaArtifacts.platformKernelDill.path,
|
'--platform', platformDill,
|
||||||
'--filesystem-scheme', 'main-root',
|
'--filesystem-scheme', 'main-root',
|
||||||
'--filesystem-root', fsRoot,
|
'--filesystem-root', fsRoot,
|
||||||
'--packages', '$multiRootScheme:///$relativePackagesFile',
|
'--packages', '$multiRootScheme:///$relativePackagesFile',
|
||||||
@ -82,7 +92,7 @@ class FuchsiaKernelCompiler {
|
|||||||
|
|
||||||
final List<String> command = <String>[
|
final List<String> command = <String>[
|
||||||
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
artifacts.getArtifactPath(Artifact.engineDartBinary),
|
||||||
fuchsiaArtifacts.kernelCompiler.path,
|
artifacts.getArtifactPath(Artifact.fuchsiaKernelCompiler),
|
||||||
...flags,
|
...flags,
|
||||||
];
|
];
|
||||||
final Process process = await processUtils.start(command);
|
final Process process = await processUtils.start(command);
|
||||||
|
@ -178,6 +178,9 @@ class FuchsiaPM {
|
|||||||
class FuchsiaPackageServer {
|
class FuchsiaPackageServer {
|
||||||
FuchsiaPackageServer(this._repo, this.name, this._host, this._port);
|
FuchsiaPackageServer(this._repo, this.name, this._host, this._port);
|
||||||
|
|
||||||
|
static const String deviceHost = 'fuchsia.com';
|
||||||
|
static const String toolHost = 'flutter_tool';
|
||||||
|
|
||||||
final String _repo;
|
final String _repo;
|
||||||
final String _host;
|
final String _host;
|
||||||
final int _port;
|
final int _port;
|
||||||
|
@ -102,9 +102,6 @@ class FuchsiaArtifacts {
|
|||||||
FuchsiaArtifacts({
|
FuchsiaArtifacts({
|
||||||
this.sshConfig,
|
this.sshConfig,
|
||||||
this.devFinder,
|
this.devFinder,
|
||||||
this.platformKernelDill,
|
|
||||||
this.flutterPatchedSdk,
|
|
||||||
this.kernelCompiler,
|
|
||||||
this.pm,
|
this.pm,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -119,19 +116,6 @@ class FuchsiaArtifacts {
|
|||||||
// Don't try to find the artifacts on platforms that are not supported.
|
// Don't try to find the artifacts on platforms that are not supported.
|
||||||
return FuchsiaArtifacts();
|
return FuchsiaArtifacts();
|
||||||
}
|
}
|
||||||
final String fuchsia = Cache.instance.getArtifactDirectory('fuchsia').path;
|
|
||||||
final String tools = fs.path.join(fuchsia, 'tools');
|
|
||||||
final String dartPrebuilts = fs.path.join(tools, 'dart_prebuilts');
|
|
||||||
|
|
||||||
final File devFinder = fs.file(fs.path.join(tools, 'dev_finder'));
|
|
||||||
final File platformDill = fs.file(fs.path.join(
|
|
||||||
dartPrebuilts, 'flutter_runner', 'platform_strong.dill'));
|
|
||||||
final File patchedSdk = fs.file(fs.path.join(
|
|
||||||
dartPrebuilts, 'flutter_runner'));
|
|
||||||
final File kernelCompiler = fs.file(fs.path.join(
|
|
||||||
dartPrebuilts, 'kernel_compiler.snapshot'));
|
|
||||||
final File pm = fs.file(fs.path.join(tools, 'pm'));
|
|
||||||
|
|
||||||
// If FUCHSIA_BUILD_DIR is defined, then look for the ssh_config dir
|
// If FUCHSIA_BUILD_DIR is defined, then look for the ssh_config dir
|
||||||
// relative to it. Next, if FUCHSIA_SSH_CONFIG is defined, then use it.
|
// relative to it. Next, if FUCHSIA_SSH_CONFIG is defined, then use it.
|
||||||
// TODO(zra): Consider passing the ssh config path in with a flag.
|
// TODO(zra): Consider passing the ssh config path in with a flag.
|
||||||
@ -142,12 +126,15 @@ class FuchsiaArtifacts {
|
|||||||
} else if (platform.environment.containsKey(_kFuchsiaSshConfig)) {
|
} else if (platform.environment.containsKey(_kFuchsiaSshConfig)) {
|
||||||
sshConfig = fs.file(platform.environment[_kFuchsiaSshConfig]);
|
sshConfig = fs.file(platform.environment[_kFuchsiaSshConfig]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String fuchsia = Cache.instance.getArtifactDirectory('fuchsia').path;
|
||||||
|
final String tools = fs.path.join(fuchsia, 'tools');
|
||||||
|
final File devFinder = fs.file(fs.path.join(tools, 'dev_finder'));
|
||||||
|
final File pm = fs.file(fs.path.join(tools, 'pm'));
|
||||||
|
|
||||||
return FuchsiaArtifacts(
|
return FuchsiaArtifacts(
|
||||||
sshConfig: sshConfig,
|
sshConfig: sshConfig,
|
||||||
devFinder: devFinder.existsSync() ? devFinder : null,
|
devFinder: devFinder.existsSync() ? devFinder : null,
|
||||||
platformKernelDill: platformDill.existsSync() ? platformDill : null,
|
|
||||||
flutterPatchedSdk: patchedSdk.existsSync() ? patchedSdk : null,
|
|
||||||
kernelCompiler: kernelCompiler.existsSync() ? kernelCompiler : null,
|
|
||||||
pm: pm.existsSync() ? pm : null,
|
pm: pm.existsSync() ? pm : null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -163,15 +150,6 @@ class FuchsiaArtifacts {
|
|||||||
/// Fuchsia devices.
|
/// Fuchsia devices.
|
||||||
final File devFinder;
|
final File devFinder;
|
||||||
|
|
||||||
/// The location of the Fuchsia-specific platform dill.
|
|
||||||
final File platformKernelDill;
|
|
||||||
|
|
||||||
/// The directory containing [platformKernelDill].
|
|
||||||
final File flutterPatchedSdk;
|
|
||||||
|
|
||||||
/// The snapshot of the Fuchsia kernel compiler.
|
|
||||||
final File kernelCompiler;
|
|
||||||
|
|
||||||
/// The pm tool.
|
/// The pm tool.
|
||||||
final File pm;
|
final File pm;
|
||||||
}
|
}
|
||||||
|
@ -734,7 +734,8 @@ DevelopmentArtifact _artifactFromTargetPlatform(TargetPlatform targetPlatform) {
|
|||||||
return DevelopmentArtifact.linux;
|
return DevelopmentArtifact.linux;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
case TargetPlatform.fuchsia:
|
case TargetPlatform.fuchsia_arm64:
|
||||||
|
case TargetPlatform.fuchsia_x64:
|
||||||
case TargetPlatform.tester:
|
case TargetPlatform.tester:
|
||||||
// No artifacts currently supported.
|
// No artifacts currently supported.
|
||||||
return null;
|
return null;
|
||||||
|
@ -27,23 +27,18 @@ void main() {
|
|||||||
MockPlatform linuxPlatform;
|
MockPlatform linuxPlatform;
|
||||||
MockPlatform windowsPlatform;
|
MockPlatform windowsPlatform;
|
||||||
MockFuchsiaSdk fuchsiaSdk;
|
MockFuchsiaSdk fuchsiaSdk;
|
||||||
MockFuchsiaArtifacts fuchsiaArtifacts;
|
|
||||||
MockFuchsiaArtifacts fuchsiaArtifactsNoCompiler;
|
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
linuxPlatform = MockPlatform();
|
linuxPlatform = MockPlatform();
|
||||||
windowsPlatform = MockPlatform();
|
windowsPlatform = MockPlatform();
|
||||||
fuchsiaSdk = MockFuchsiaSdk();
|
fuchsiaSdk = MockFuchsiaSdk();
|
||||||
fuchsiaArtifacts = MockFuchsiaArtifacts();
|
|
||||||
fuchsiaArtifactsNoCompiler = MockFuchsiaArtifacts();
|
|
||||||
|
|
||||||
when(linuxPlatform.isLinux).thenReturn(true);
|
when(linuxPlatform.isLinux).thenReturn(true);
|
||||||
when(linuxPlatform.isWindows).thenReturn(false);
|
when(linuxPlatform.isWindows).thenReturn(false);
|
||||||
|
when(linuxPlatform.isMacOS).thenReturn(false);
|
||||||
when(windowsPlatform.isWindows).thenReturn(true);
|
when(windowsPlatform.isWindows).thenReturn(true);
|
||||||
when(windowsPlatform.isLinux).thenReturn(false);
|
when(windowsPlatform.isLinux).thenReturn(false);
|
||||||
when(windowsPlatform.isMacOS).thenReturn(false);
|
when(windowsPlatform.isMacOS).thenReturn(false);
|
||||||
when(fuchsiaArtifacts.kernelCompiler).thenReturn(MockFile());
|
|
||||||
when(fuchsiaArtifactsNoCompiler.kernelCompiler).thenReturn(null);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
group('Fuchsia build fails gracefully when', () {
|
group('Fuchsia build fails gracefully when', () {
|
||||||
@ -58,7 +53,6 @@ void main() {
|
|||||||
Platform: () => linuxPlatform,
|
Platform: () => linuxPlatform,
|
||||||
FileSystem: () => MemoryFileSystem(),
|
FileSystem: () => MemoryFileSystem(),
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('there is no cmx file', () async {
|
testUsingContext('there is no cmx file', () async {
|
||||||
@ -76,7 +70,6 @@ void main() {
|
|||||||
Platform: () => linuxPlatform,
|
Platform: () => linuxPlatform,
|
||||||
FileSystem: () => MemoryFileSystem(),
|
FileSystem: () => MemoryFileSystem(),
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('on Windows platform', () async {
|
testUsingContext('on Windows platform', () async {
|
||||||
@ -99,7 +92,6 @@ void main() {
|
|||||||
Platform: () => windowsPlatform,
|
Platform: () => windowsPlatform,
|
||||||
FileSystem: () => MemoryFileSystem(),
|
FileSystem: () => MemoryFileSystem(),
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('there is no Fuchsia kernel compiler', () async {
|
testUsingContext('there is no Fuchsia kernel compiler', () async {
|
||||||
@ -122,7 +114,6 @@ void main() {
|
|||||||
Platform: () => linuxPlatform,
|
Platform: () => linuxPlatform,
|
||||||
FileSystem: () => MemoryFileSystem(),
|
FileSystem: () => MemoryFileSystem(),
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaArtifacts: () => fuchsiaArtifactsNoCompiler,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -233,7 +224,3 @@ class MockFuchsiaSdk extends Mock implements FuchsiaSdk {
|
|||||||
final FuchsiaKernelCompiler fuchsiaKernelCompiler =
|
final FuchsiaKernelCompiler fuchsiaKernelCompiler =
|
||||||
MockFuchsiaKernelCompiler();
|
MockFuchsiaKernelCompiler();
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockFile extends Mock implements File {}
|
|
||||||
|
|
||||||
class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {}
|
|
||||||
|
@ -57,7 +57,7 @@ void main() {
|
|||||||
webDevice = _MockDevice('webby', 'webby')
|
webDevice = _MockDevice('webby', 'webby')
|
||||||
..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.web_javascript);
|
..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.web_javascript);
|
||||||
fuchsiaDevice = _MockDevice('fuchsiay', 'fuchsiay')
|
fuchsiaDevice = _MockDevice('fuchsiay', 'fuchsiay')
|
||||||
..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.fuchsia);
|
..targetPlatform = Future<TargetPlatform>.value(TargetPlatform.fuchsia_x64);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('chooses ephemeral device', () async {
|
testUsingContext('chooses ephemeral device', () async {
|
||||||
|
@ -12,6 +12,7 @@ import 'package:flutter_tools/src/base/common.dart';
|
|||||||
import 'package:flutter_tools/src/base/context.dart';
|
import 'package:flutter_tools/src/base/context.dart';
|
||||||
import 'package:flutter_tools/src/base/file_system.dart';
|
import 'package:flutter_tools/src/base/file_system.dart';
|
||||||
import 'package:flutter_tools/src/base/io.dart';
|
import 'package:flutter_tools/src/base/io.dart';
|
||||||
|
import 'package:flutter_tools/src/base/process.dart';
|
||||||
import 'package:flutter_tools/src/base/os.dart';
|
import 'package:flutter_tools/src/base/os.dart';
|
||||||
import 'package:flutter_tools/src/base/time.dart';
|
import 'package:flutter_tools/src/base/time.dart';
|
||||||
import 'package:flutter_tools/src/build_info.dart';
|
import 'package:flutter_tools/src/build_info.dart';
|
||||||
@ -36,8 +37,13 @@ import '../../src/context.dart';
|
|||||||
void main() {
|
void main() {
|
||||||
group('fuchsia device', () {
|
group('fuchsia device', () {
|
||||||
MemoryFileSystem memoryFileSystem;
|
MemoryFileSystem memoryFileSystem;
|
||||||
|
MockFile sshConfig;
|
||||||
|
MockProcessUtils mockProcessUtils;
|
||||||
setUp(() {
|
setUp(() {
|
||||||
memoryFileSystem = MemoryFileSystem();
|
memoryFileSystem = MemoryFileSystem();
|
||||||
|
sshConfig = MockFile();
|
||||||
|
mockProcessUtils = MockProcessUtils();
|
||||||
|
when(sshConfig.absolute).thenReturn(sshConfig);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('stores the requested id and name', () {
|
testUsingContext('stores the requested id and name', () {
|
||||||
@ -96,44 +102,78 @@ void main() {
|
|||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('targetPlatform arm64 works', () async {
|
||||||
|
when(mockProcessUtils.run(any)).thenAnswer((Invocation _) {
|
||||||
|
return Future<RunResult>.value(RunResult(ProcessResult(1, 0, 'aarch64', ''), <String>['']));
|
||||||
|
});
|
||||||
|
final FuchsiaDevice device = FuchsiaDevice('123');
|
||||||
|
expect(await device.targetPlatform, TargetPlatform.fuchsia_arm64);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
|
||||||
|
ProcessUtils: () => mockProcessUtils,
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('targetPlatform x64 works', () async {
|
||||||
|
when(mockProcessUtils.run(any)).thenAnswer((Invocation _) {
|
||||||
|
return Future<RunResult>.value(RunResult(ProcessResult(1, 0, 'x86_64', ''), <String>['']));
|
||||||
|
});
|
||||||
|
final FuchsiaDevice device = FuchsiaDevice('123');
|
||||||
|
expect(await device.targetPlatform, TargetPlatform.fuchsia_x64);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
FuchsiaArtifacts: () => FuchsiaArtifacts(sshConfig: sshConfig),
|
||||||
|
ProcessUtils: () => mockProcessUtils,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
group('Fuchsia device artifact overrides', () {
|
group('Fuchsia device artifact overrides', () {
|
||||||
MockFile devFinder;
|
MemoryFileSystem memoryFileSystem;
|
||||||
MockFile sshConfig;
|
File devFinder;
|
||||||
MockFile platformDill;
|
File sshConfig;
|
||||||
MockFile patchedSdk;
|
File platformDill;
|
||||||
|
File patchedSdk;
|
||||||
|
MockArtifacts mockArtifacts;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
devFinder = MockFile();
|
memoryFileSystem = MemoryFileSystem();
|
||||||
sshConfig = MockFile();
|
devFinder = memoryFileSystem.file('dev_finder');
|
||||||
platformDill = MockFile();
|
sshConfig = memoryFileSystem.file('ssh_config');
|
||||||
patchedSdk = MockFile();
|
platformDill = memoryFileSystem.file('platform_strong.dill');
|
||||||
when(devFinder.absolute).thenReturn(devFinder);
|
patchedSdk = memoryFileSystem.file('flutter_runner_patched_sdk');
|
||||||
when(sshConfig.absolute).thenReturn(sshConfig);
|
|
||||||
when(platformDill.absolute).thenReturn(platformDill);
|
mockArtifacts = MockArtifacts();
|
||||||
when(patchedSdk.absolute).thenReturn(patchedSdk);
|
when(mockArtifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaPlatformDill,
|
||||||
|
platform: anyNamed('platform'),
|
||||||
|
mode: anyNamed('mode'),
|
||||||
|
)).thenReturn(platformDill.path);
|
||||||
|
when(mockArtifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaPatchedSdk,
|
||||||
|
platform: anyNamed('platform'),
|
||||||
|
mode: anyNamed('mode'),
|
||||||
|
)).thenReturn(patchedSdk.path);
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('exist', () async {
|
testUsingContext('exist', () async {
|
||||||
final FuchsiaDevice device = FuchsiaDevice('fuchsia-device');
|
final FuchsiaDevice device = FuchsiaDevice('fuchsia-device');
|
||||||
expect(device.artifactOverrides, isNotNull);
|
expect(device.artifactOverrides, isNotNull);
|
||||||
expect(device.artifactOverrides.platformKernelDill, equals(platformDill));
|
expect(device.artifactOverrides.platformKernelDill.path, equals(platformDill.path));
|
||||||
expect(device.artifactOverrides.flutterPatchedSdk, equals(patchedSdk));
|
expect(device.artifactOverrides.flutterPatchedSdk.path, equals(patchedSdk.path));
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
|
FileSystem: () => memoryFileSystem,
|
||||||
FuchsiaArtifacts: () => FuchsiaArtifacts(
|
FuchsiaArtifacts: () => FuchsiaArtifacts(
|
||||||
sshConfig: sshConfig,
|
sshConfig: sshConfig,
|
||||||
devFinder: devFinder,
|
devFinder: devFinder,
|
||||||
platformKernelDill: platformDill,
|
|
||||||
flutterPatchedSdk: patchedSdk,
|
|
||||||
),
|
),
|
||||||
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
});
|
});
|
||||||
|
|
||||||
testUsingContext('are used', () async {
|
testUsingContext('are used', () async {
|
||||||
final FuchsiaDevice device = FuchsiaDevice('fuchsia-device');
|
final FuchsiaDevice device = FuchsiaDevice('fuchsia-device');
|
||||||
expect(device.artifactOverrides, isNotNull);
|
expect(device.artifactOverrides, isNotNull);
|
||||||
expect(device.artifactOverrides.platformKernelDill, equals(platformDill));
|
expect(device.artifactOverrides.platformKernelDill.path, equals(platformDill.path));
|
||||||
expect(device.artifactOverrides.flutterPatchedSdk, equals(patchedSdk));
|
expect(device.artifactOverrides.flutterPatchedSdk.path, equals(patchedSdk.path));
|
||||||
await context.run<void>(
|
await context.run<void>(
|
||||||
body: () {
|
body: () {
|
||||||
expect(Artifacts.instance.getArtifactPath(Artifact.platformKernelDill),
|
expect(Artifacts.instance.getArtifactPath(Artifact.platformKernelDill),
|
||||||
@ -146,12 +186,13 @@ void main() {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
|
FileSystem: () => memoryFileSystem,
|
||||||
FuchsiaArtifacts: () => FuchsiaArtifacts(
|
FuchsiaArtifacts: () => FuchsiaArtifacts(
|
||||||
sshConfig: sshConfig,
|
sshConfig: sshConfig,
|
||||||
devFinder: devFinder,
|
devFinder: devFinder,
|
||||||
platformKernelDill: platformDill,
|
|
||||||
flutterPatchedSdk: patchedSdk,
|
|
||||||
),
|
),
|
||||||
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -339,15 +380,23 @@ void main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
group(FuchsiaIsolateDiscoveryProtocol, () {
|
group(FuchsiaIsolateDiscoveryProtocol, () {
|
||||||
|
MockPortForwarder portForwarder;
|
||||||
|
MockVMService vmService;
|
||||||
|
MockVM vm;
|
||||||
|
|
||||||
|
setUp(() {
|
||||||
|
portForwarder = MockPortForwarder();
|
||||||
|
vmService = MockVMService();
|
||||||
|
vm = MockVM();
|
||||||
|
|
||||||
|
when(vm.vmService).thenReturn(vmService);
|
||||||
|
when(vmService.vm).thenReturn(vm);
|
||||||
|
});
|
||||||
|
|
||||||
Future<Uri> findUri(List<MockFlutterView> views, String expectedIsolateName) {
|
Future<Uri> findUri(List<MockFlutterView> views, String expectedIsolateName) {
|
||||||
final MockPortForwarder portForwarder = MockPortForwarder();
|
when(vm.views).thenReturn(views);
|
||||||
final MockVMService vmService = MockVMService();
|
|
||||||
final MockVM vm = MockVM();
|
|
||||||
vm.vmService = vmService;
|
|
||||||
vmService.vm = vm;
|
|
||||||
vm.views = views;
|
|
||||||
for (MockFlutterView view in views) {
|
for (MockFlutterView view in views) {
|
||||||
view.owner = vm;
|
when(view.owner).thenReturn(vm);
|
||||||
}
|
}
|
||||||
final MockFuchsiaDevice fuchsiaDevice =
|
final MockFuchsiaDevice fuchsiaDevice =
|
||||||
MockFuchsiaDevice('123', portForwarder, false);
|
MockFuchsiaDevice('123', portForwarder, false);
|
||||||
@ -404,11 +453,47 @@ void main() {
|
|||||||
FakeOperatingSystemUtils osUtils;
|
FakeOperatingSystemUtils osUtils;
|
||||||
FakeFuchsiaDeviceTools fuchsiaDeviceTools;
|
FakeFuchsiaDeviceTools fuchsiaDeviceTools;
|
||||||
MockFuchsiaSdk fuchsiaSdk;
|
MockFuchsiaSdk fuchsiaSdk;
|
||||||
|
MockFuchsiaArtifacts fuchsiaArtifacts;
|
||||||
|
MockArtifacts mockArtifacts;
|
||||||
|
|
||||||
|
File compilerSnapshot;
|
||||||
|
File platformDill;
|
||||||
|
File patchedSdk;
|
||||||
|
File runner;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
memoryFileSystem = MemoryFileSystem();
|
memoryFileSystem = MemoryFileSystem();
|
||||||
osUtils = FakeOperatingSystemUtils();
|
osUtils = FakeOperatingSystemUtils();
|
||||||
fuchsiaDeviceTools = FakeFuchsiaDeviceTools();
|
fuchsiaDeviceTools = FakeFuchsiaDeviceTools();
|
||||||
fuchsiaSdk = MockFuchsiaSdk();
|
fuchsiaSdk = MockFuchsiaSdk();
|
||||||
|
fuchsiaArtifacts = MockFuchsiaArtifacts();
|
||||||
|
|
||||||
|
compilerSnapshot = memoryFileSystem.file('kernel_compiler.snapshot')..createSync();
|
||||||
|
platformDill = memoryFileSystem.file('platform_strong.dill')..createSync();
|
||||||
|
patchedSdk = memoryFileSystem.file('flutter_runner_patched_sdk')..createSync();
|
||||||
|
runner = memoryFileSystem.file('flutter_jit_runner')..createSync();
|
||||||
|
|
||||||
|
mockArtifacts = MockArtifacts();
|
||||||
|
when(mockArtifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaKernelCompiler,
|
||||||
|
platform: anyNamed('platform'),
|
||||||
|
mode: anyNamed('mode'),
|
||||||
|
)).thenReturn(compilerSnapshot.path);
|
||||||
|
when(mockArtifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaPlatformDill,
|
||||||
|
platform: anyNamed('platform'),
|
||||||
|
mode: anyNamed('mode'),
|
||||||
|
)).thenReturn(platformDill.path);
|
||||||
|
when(mockArtifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaPatchedSdk,
|
||||||
|
platform: anyNamed('platform'),
|
||||||
|
mode: anyNamed('mode'),
|
||||||
|
)).thenReturn(patchedSdk.path);
|
||||||
|
when(mockArtifacts.getArtifactPath(
|
||||||
|
Artifact.fuchsiaFlutterJitRunner,
|
||||||
|
platform: anyNamed('platform'),
|
||||||
|
mode: anyNamed('mode'),
|
||||||
|
)).thenReturn(runner.path);
|
||||||
});
|
});
|
||||||
|
|
||||||
Future<LaunchResult> setupAndStartApp({
|
Future<LaunchResult> setupAndStartApp({
|
||||||
@ -434,11 +519,12 @@ void main() {
|
|||||||
app = BuildableFuchsiaApp(project: FlutterProject.current().fuchsia);
|
app = BuildableFuchsiaApp(project: FlutterProject.current().fuchsia);
|
||||||
}
|
}
|
||||||
|
|
||||||
final DebuggingOptions debuggingOptions =
|
final DebuggingOptions debuggingOptions = DebuggingOptions.disabled(BuildInfo(mode, null));
|
||||||
DebuggingOptions.disabled(BuildInfo(mode, null));
|
return await device.startApp(
|
||||||
return await device.startApp(app,
|
app,
|
||||||
prebuiltApplication: prebuilt,
|
prebuiltApplication: prebuilt,
|
||||||
debuggingOptions: debuggingOptions);
|
debuggingOptions: debuggingOptions,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
testUsingContext('start prebuilt in release mode', () async {
|
testUsingContext('start prebuilt in release mode', () async {
|
||||||
@ -447,9 +533,11 @@ void main() {
|
|||||||
expect(launchResult.started, isTrue);
|
expect(launchResult.started, isTrue);
|
||||||
expect(launchResult.hasObservatory, isFalse);
|
expect(launchResult.hasObservatory, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => fuchsiaSdk,
|
FuchsiaSdk: () => fuchsiaSdk,
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -472,9 +560,11 @@ void main() {
|
|||||||
expect(launchResult.hasObservatory, isFalse);
|
expect(launchResult.hasObservatory, isFalse);
|
||||||
expect(await device.stopApp(app), isTrue);
|
expect(await device.stopApp(app), isTrue);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => fuchsiaSdk,
|
FuchsiaSdk: () => fuchsiaSdk,
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -485,9 +575,11 @@ void main() {
|
|||||||
expect(launchResult.started, isTrue);
|
expect(launchResult.started, isTrue);
|
||||||
expect(launchResult.hasObservatory, isTrue);
|
expect(launchResult.hasObservatory, isTrue);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => fuchsiaSdk,
|
FuchsiaSdk: () => fuchsiaSdk,
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -498,9 +590,11 @@ void main() {
|
|||||||
expect(launchResult.started, isTrue);
|
expect(launchResult.started, isTrue);
|
||||||
expect(launchResult.hasObservatory, isFalse);
|
expect(launchResult.hasObservatory, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => fuchsiaSdk,
|
FuchsiaSdk: () => fuchsiaSdk,
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -511,9 +605,11 @@ void main() {
|
|||||||
expect(launchResult.started, isTrue);
|
expect(launchResult.started, isTrue);
|
||||||
expect(launchResult.hasObservatory, isTrue);
|
expect(launchResult.hasObservatory, isTrue);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => fuchsiaSdk,
|
FuchsiaSdk: () => fuchsiaSdk,
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -524,9 +620,11 @@ void main() {
|
|||||||
expect(launchResult.started, isFalse);
|
expect(launchResult.started, isFalse);
|
||||||
expect(launchResult.hasObservatory, isFalse);
|
expect(launchResult.hasObservatory, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => MockFuchsiaSdk(devFinder: FailingDevFinder()),
|
FuchsiaSdk: () => MockFuchsiaSdk(devFinder: FailingDevFinder()),
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -537,9 +635,11 @@ void main() {
|
|||||||
expect(launchResult.started, isFalse);
|
expect(launchResult.started, isFalse);
|
||||||
expect(launchResult.hasObservatory, isFalse);
|
expect(launchResult.hasObservatory, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
FuchsiaDeviceTools: () => fuchsiaDeviceTools,
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => MockFuchsiaSdk(pm: FailingPM()),
|
FuchsiaSdk: () => MockFuchsiaSdk(pm: FailingPM()),
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -550,9 +650,11 @@ void main() {
|
|||||||
expect(launchResult.started, isFalse);
|
expect(launchResult.started, isFalse);
|
||||||
expect(launchResult.hasObservatory, isFalse);
|
expect(launchResult.hasObservatory, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(amber: FailingAmberCtl()),
|
FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(amber: FailingAmberCtl()),
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => fuchsiaSdk,
|
FuchsiaSdk: () => fuchsiaSdk,
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -563,9 +665,11 @@ void main() {
|
|||||||
expect(launchResult.started, isFalse);
|
expect(launchResult.started, isFalse);
|
||||||
expect(launchResult.hasObservatory, isFalse);
|
expect(launchResult.hasObservatory, isFalse);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => mockArtifacts,
|
||||||
FileSystem: () => memoryFileSystem,
|
FileSystem: () => memoryFileSystem,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(tiles: FailingTilesCtl()),
|
FuchsiaDeviceTools: () => FakeFuchsiaDeviceTools(tiles: FailingTilesCtl()),
|
||||||
|
FuchsiaArtifacts: () => fuchsiaArtifacts,
|
||||||
FuchsiaSdk: () => fuchsiaSdk,
|
FuchsiaSdk: () => fuchsiaSdk,
|
||||||
OperatingSystemUtils: () => osUtils,
|
OperatingSystemUtils: () => osUtils,
|
||||||
});
|
});
|
||||||
@ -643,10 +747,16 @@ class FuchsiaModulePackage extends ApplicationPackage {
|
|||||||
final String name;
|
final String name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class MockArtifacts extends Mock implements Artifacts {}
|
||||||
|
|
||||||
|
class MockFuchsiaArtifacts extends Mock implements FuchsiaArtifacts {}
|
||||||
|
|
||||||
class MockProcessManager extends Mock implements ProcessManager {}
|
class MockProcessManager extends Mock implements ProcessManager {}
|
||||||
|
|
||||||
class MockProcessResult extends Mock implements ProcessResult {}
|
class MockProcessResult extends Mock implements ProcessResult {}
|
||||||
|
|
||||||
|
class MockProcessUtils extends Mock implements ProcessUtils {}
|
||||||
|
|
||||||
class MockFile extends Mock implements File {}
|
class MockFile extends Mock implements File {}
|
||||||
|
|
||||||
class MockProcess extends Mock implements Process {}
|
class MockProcess extends Mock implements Process {}
|
||||||
@ -690,31 +800,22 @@ class MockFuchsiaDevice extends Mock implements FuchsiaDevice {
|
|||||||
final String id;
|
final String id;
|
||||||
@override
|
@override
|
||||||
final DevicePortForwarder portForwarder;
|
final DevicePortForwarder portForwarder;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<TargetPlatform> get targetPlatform async => TargetPlatform.fuchsia_arm64;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockPortForwarder extends Mock implements DevicePortForwarder {}
|
class MockPortForwarder extends Mock implements DevicePortForwarder {}
|
||||||
|
|
||||||
class MockVMService extends Mock implements VMService {
|
class MockVMService extends Mock implements VMService {}
|
||||||
@override
|
|
||||||
VM vm;
|
|
||||||
}
|
|
||||||
|
|
||||||
class MockVM extends Mock implements VM {
|
class MockVM extends Mock implements VM {}
|
||||||
@override
|
|
||||||
VMService vmService;
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<FlutterView> views;
|
|
||||||
}
|
|
||||||
|
|
||||||
class MockFlutterView extends Mock implements FlutterView {
|
class MockFlutterView extends Mock implements FlutterView {
|
||||||
MockFlutterView(this.uiIsolate);
|
MockFlutterView(this.uiIsolate);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
final Isolate uiIsolate;
|
final Isolate uiIsolate;
|
||||||
|
|
||||||
@override
|
|
||||||
ServiceObjectOwner owner;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockIsolate extends Mock implements Isolate {
|
class MockIsolate extends Mock implements Isolate {
|
||||||
@ -731,6 +832,9 @@ class FuchsiaDeviceWithFakeDiscovery extends FuchsiaDevice {
|
|||||||
FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(String isolateName) {
|
FuchsiaIsolateDiscoveryProtocol getIsolateDiscoveryProtocol(String isolateName) {
|
||||||
return FakeFuchsiaIsolateDiscoveryProtocol();
|
return FakeFuchsiaIsolateDiscoveryProtocol();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<TargetPlatform> get targetPlatform async => TargetPlatform.fuchsia_arm64;
|
||||||
}
|
}
|
||||||
|
|
||||||
class FakeFuchsiaIsolateDiscoveryProtocol implements FuchsiaIsolateDiscoveryProtocol {
|
class FakeFuchsiaIsolateDiscoveryProtocol implements FuchsiaIsolateDiscoveryProtocol {
|
||||||
|
Loading…
Reference in New Issue
Block a user