diff --git a/engine/src/flutter/frontend_server/BUILD.gn b/engine/src/flutter/frontend_server/BUILD.gn index 7d3dfd5f68..28d2d18eb9 100644 --- a/engine/src/flutter/frontend_server/BUILD.gn +++ b/engine/src/flutter/frontend_server/BUILD.gn @@ -50,6 +50,7 @@ if (is_fuchsia_host || is_fuchsia) { training_args = [ "--train", "--sdk-root=$flutter_patched_sdk", + rebase_path(main_dart), ] frontend_server_files = diff --git a/engine/src/flutter/frontend_server/lib/server.dart b/engine/src/flutter/frontend_server/lib/server.dart index b3a61f181e..c2f81292fe 100644 --- a/engine/src/flutter/frontend_server/lib/server.dart +++ b/engine/src/flutter/frontend_server/lib/server.dart @@ -92,6 +92,11 @@ Future starter( } if (options['train']) { + if (!options.rest.isNotEmpty) { + throw Exception('Must specify input.dart'); + } + + final String input = options.rest[0]; final String sdkRoot = options['sdk-root']; final Directory temp = Directory.systemTemp.createTempSync('train_frontend_server'); try { @@ -105,7 +110,7 @@ Future starter( ]); compiler ??= _FlutterFrontendCompiler(output); - await compiler.compile(Platform.script.toFilePath(), options); + await compiler.compile(input, options); compiler.acceptLastDelta(); await compiler.recompileDelta(); compiler.acceptLastDelta(); diff --git a/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn b/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn index 3116502547..72651af12a 100644 --- a/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn +++ b/engine/src/flutter/shell/platform/fuchsia/dart/BUILD.gn @@ -15,7 +15,10 @@ application_snapshot("kernel_compiler") { dot_packages = rebase_path("//third_party/dart/.packages") - training_args = [ "--train" ] + training_args = [ + "--train", + rebase_path(main_dart), + ] kernel_compiler_files = exec_script("//third_party/dart/tools/list_dart_files.py",