mirror of
https://github.com/flutter/flutter
synced 2024-10-13 03:32:55 +00:00
Always link desktop platforms (#44753)
This commit is contained in:
parent
47f71ba3c3
commit
3383b564a1
|
@ -193,6 +193,19 @@ class KernelSnapshot extends Target {
|
|||
targetPlatform == TargetPlatform.fuchsia_arm64) {
|
||||
targetModel = TargetModel.flutterRunner;
|
||||
}
|
||||
// Force linking of the platform for desktop embedder targets since these
|
||||
// do not correctly load the core snapshots in debug mode.
|
||||
// See https://github.com/flutter/flutter/issues/44724
|
||||
bool forceLinkPlatform;
|
||||
switch (targetPlatform) {
|
||||
case TargetPlatform.darwin_x64:
|
||||
case TargetPlatform.windows_x64:
|
||||
case TargetPlatform.linux_x64:
|
||||
forceLinkPlatform = true;
|
||||
break;
|
||||
default:
|
||||
forceLinkPlatform = false;
|
||||
}
|
||||
|
||||
final CompilerOutput output = await compiler.compile(
|
||||
sdkRoot: artifacts.getArtifactPath(
|
||||
|
@ -206,7 +219,7 @@ class KernelSnapshot extends Target {
|
|||
targetModel: targetModel,
|
||||
outputFilePath: environment.buildDir.childFile('app.dill').path,
|
||||
packagesPath: packagesPath,
|
||||
linkPlatformKernelIn: buildMode.isPrecompiled,
|
||||
linkPlatformKernelIn: forceLinkPlatform || buildMode.isPrecompiled,
|
||||
mainPath: targetFileAbsolute,
|
||||
depFilePath: environment.buildDir.childFile('kernel_snapshot.d').path,
|
||||
extraFrontEndOptions: extraFrontEndOptions,
|
||||
|
|
|
@ -205,6 +205,39 @@ flutter_tools:lib/''');
|
|||
KernelCompilerFactory: () => MockKernelCompilerFactory(),
|
||||
}));
|
||||
|
||||
test('kernel_snapshot forces platform linking on debug for darwin target platforms', () => testbed.run(() async {
|
||||
final MockKernelCompiler mockKernelCompiler = MockKernelCompiler();
|
||||
when(kernelCompilerFactory.create(any)).thenAnswer((Invocation _) async {
|
||||
return mockKernelCompiler;
|
||||
});
|
||||
when(mockKernelCompiler.compile(
|
||||
sdkRoot: anyNamed('sdkRoot'),
|
||||
aot: anyNamed('aot'),
|
||||
buildMode: anyNamed('buildMode'),
|
||||
trackWidgetCreation: anyNamed('trackWidgetCreation'),
|
||||
targetModel: anyNamed('targetModel'),
|
||||
outputFilePath: anyNamed('outputFilePath'),
|
||||
depFilePath: anyNamed('depFilePath'),
|
||||
packagesPath: anyNamed('packagesPath'),
|
||||
mainPath: anyNamed('mainPath'),
|
||||
extraFrontEndOptions: anyNamed('extraFrontEndOptions'),
|
||||
fileSystemRoots: anyNamed('fileSystemRoots'),
|
||||
fileSystemScheme: anyNamed('fileSystemScheme'),
|
||||
linkPlatformKernelIn: true,
|
||||
dartDefines: anyNamed('dartDefines'),
|
||||
)).thenAnswer((Invocation _) async {
|
||||
return const CompilerOutput('example', 0, <Uri>[]);
|
||||
});
|
||||
|
||||
await const KernelSnapshot().build(androidEnvironment
|
||||
..defines[kTargetPlatform] = 'darwin-x64'
|
||||
..defines[kBuildMode] = 'debug'
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
KernelCompilerFactory: () => MockKernelCompilerFactory(),
|
||||
}));
|
||||
|
||||
|
||||
test('kernel_snapshot does use track widget creation on debug builds', () => testbed.run(() async {
|
||||
final MockKernelCompiler mockKernelCompiler = MockKernelCompiler();
|
||||
when(kernelCompilerFactory.create(any)).thenAnswer((Invocation _) async {
|
||||
|
|
Loading…
Reference in a new issue