未验证 提交 d29c7db7 编写于 作者: J James D. Lin 提交者: GitHub

Add logging if FlutterDartProject fails to load the application kernel snapshot (#6257)

To make "Engine run configuration was invalid." failures (e.g.
https://github.com/flutter/flutter/issues/20777) a bit easier to
diagnose, add some more logging to `FlutterDartProject` to verify
that snapshot assets were properly bundled.
上级 2a1debfc
......@@ -98,21 +98,22 @@ static blink::Settings DefaultSettingsForProcess(NSBundle* bundle = nil) {
NSString* assetsName = [FlutterDartProject flutterAssetsName:bundle];
NSString* assetsPath = [mainBundle pathForResource:assetsName ofType:@""];
if (assetsPath.length > 0) {
if (assetsPath.length == 0) {
NSLog(@"Failed to find assets path for \"%@\"", assetsName);
} else {
settings.assets_path = assetsPath.UTF8String;
// Check if there is an application kernel snapshot in the assets directory we could
// potentially use. Looking for the snapshot makes sense only if we have a VM that can use
// it.
if (!blink::DartVM::IsRunningPrecompiledCode()) {
// Looking for the various script and kernel snapshot buffers only makes sense if we have a
// VM that can use these buffers.
{
// Check if there is an application kernel snapshot in the assets directory we could
// potentially use.
NSURL* applicationKernelSnapshotURL =
[NSURL URLWithString:@(kApplicationKernelSnapshotFileName)
relativeToURL:[NSURL fileURLWithPath:assetsPath]];
if ([[NSFileManager defaultManager] fileExistsAtPath:applicationKernelSnapshotURL.path]) {
settings.application_kernel_asset = applicationKernelSnapshotURL.path.UTF8String;
}
NSURL* applicationKernelSnapshotURL =
[NSURL URLWithString:@(kApplicationKernelSnapshotFileName)
relativeToURL:[NSURL fileURLWithPath:assetsPath]];
if ([[NSFileManager defaultManager] fileExistsAtPath:applicationKernelSnapshotURL.path]) {
settings.application_kernel_asset = applicationKernelSnapshotURL.path.UTF8String;
} else {
NSLog(@"Failed to find snapshot: %@", applicationKernelSnapshotURL.path);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册