From 8bd1d0d50eeb760450f075d3f0f1d13353f1559d Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Thu, 1 Mar 2018 14:02:35 -0800 Subject: [PATCH] Move generated entry points JSON out of flutter_patched_sdk, add an option to pass entry points to frontend_server (flutter/engine#4734) Flutter downloads only one version of flutter_patched_sdk, which was obtained from host_debug build on Linux. Generated entry points JSON files are different in profile and release builds (as release build omits observatory), so these files should be downloaded independently of flutter_patched_sdk. This PR moves generated entry points JSON files from flutter_patched_sdk to a separate directory (out/*/dart_entry_points) and adds an option to specify entry points to frontend_server (as Flutter tools will need to pass custom locations of entry points files outside of flutter_patched_sdk). --- .../src/flutter/frontend_server/lib/server.dart | 17 +++++------------ engine/src/flutter/lib/snapshot/BUILD.gn | 4 ++-- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/engine/src/flutter/frontend_server/lib/server.dart b/engine/src/flutter/frontend_server/lib/server.dart index b0f86e021f..610ae68741 100644 --- a/engine/src/flutter/frontend_server/lib/server.dart +++ b/engine/src/flutter/frontend_server/lib/server.dart @@ -48,6 +48,9 @@ ArgParser _argParser = new ArgParser(allowTrailingOptions: true) help: 'Enable global type flow analysis and related transformations in AOT mode.', defaultsTo: false) + ..addOption('entry-points', + help: 'Path to JSON file with the list of entry points', + allowMultiple: true) ..addFlag('link-platform', help: 'When in batch mode, link platform kernel file into result kernel file.' @@ -206,21 +209,11 @@ class _FrontendCompiler implements CompilerInterface { sdkRoot.resolve(platformKernelDill) ]; } - final bool aot = options['aot']; - final List entryPoints = []; - if (aot) { - for (String entryPointsFile in [ - 'entry_points.json', - 'entry_points_extra.json', - ]) { - entryPoints.add(sdkRoot.resolve(entryPointsFile).toFilePath()); - } - } program = await _runWithPrintRedirection(() => compileToKernel( _mainSource, compilerOptions, - aot: aot, + aot: options['aot'], useGlobalTypeFlowAnalysis: options['tfa'], - entryPoints: entryPoints)); + entryPoints: options['entry-points'])); } runFlutterSpecificKernelTransforms(program); if (program != null) { diff --git a/engine/src/flutter/lib/snapshot/BUILD.gn b/engine/src/flutter/lib/snapshot/BUILD.gn index 8735ef7f98..03b23a58ae 100644 --- a/engine/src/flutter/lib/snapshot/BUILD.gn +++ b/engine/src/flutter/lib/snapshot/BUILD.gn @@ -297,7 +297,7 @@ group("kernel_platform_files") { generate_entry_points_json_with_gen_snapshot("entry_points_json") { input = "$flutter_root/lib/snapshot/snapshot.dart" - output = "$root_out_dir/flutter_patched_sdk/entry_points.json" + output = "$root_out_dir/dart_entry_points/entry_points.json" dart_ui = "$flutter_root/lib/ui/ui.dart" vmservice_io = "//third_party/dart/runtime/bin/vmservice/vmservice_io.dart" dart_vm_entry_points_txt = "$flutter_root/runtime/dart_vm_entry_points.txt" @@ -321,7 +321,7 @@ generate_entry_points_json_with_gen_snapshot("entry_points_json") { } copy_entry_points_extra_json("entry_points_extra_json") { - output = "$root_out_dir/flutter_patched_sdk/entry_points_extra.json" + output = "$root_out_dir/dart_entry_points/entry_points_extra.json" } group("entry_points_json_files") {