未验证 提交 366d0e3e 编写于 作者: C Chinmay Garde 提交者: GitHub

Fix Dart project configuration for headless Dart runners. (#5461)

上级 3d87b271
......@@ -17,6 +17,7 @@
#include "flutter/shell/common/switches.h"
#include "flutter/shell/common/thread_host.h"
#include "flutter/shell/platform/darwin/common/command_line.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
#include "lib/fxl/functional/make_copyable.h"
static std::unique_ptr<shell::PlatformView> CreateHeadlessPlatformView(shell::Shell& shell) {
......@@ -72,10 +73,16 @@ static std::unique_ptr<shell::Rasterizer> CreateHeadlessRasterizer(shell::Shell&
return;
}
FlutterDartProject* project =
[[[FlutterDartProject alloc] initFromDefaultSourceForConfiguration] autorelease];
auto config = project.runConfiguration;
config.SetEntrypoint(entrypoint.UTF8String);
// Override the default run configuration with the specified entrypoint.
_shell->GetTaskRunners().GetUITaskRunner()->PostTask(
fxl::MakeCopyable([engine = _shell->GetEngine(),
config = shell::RunConfiguration::InferFromSettings(settings)]() mutable {
fxl::MakeCopyable([engine = _shell->GetEngine(), config = std::move(config)]() mutable {
if (!engine || !engine->Run(std::move(config))) {
FXL_LOG(ERROR) << "Could not launch engine with configuration.";
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册