From 9a54dbc65a3a7797a696d71c24988cde08b96adc Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Fri, 29 Mar 2019 14:29:09 -0700 Subject: [PATCH] Move libdart selection into its own target in //flutter/runtime. (flutter/engine#8373) Cleanup repeated rules. --- engine/src/flutter/lib/snapshot/BUILD.gn | 4 +++- engine/src/flutter/runtime/BUILD.gn | 14 ++++++++++++++ engine/src/flutter/shell/platform/android/BUILD.gn | 11 +---------- .../src/flutter/shell/platform/darwin/ios/BUILD.gn | 11 +---------- .../src/flutter/shell/platform/embedder/BUILD.gn | 10 +--------- 5 files changed, 20 insertions(+), 30 deletions(-) diff --git a/engine/src/flutter/lib/snapshot/BUILD.gn b/engine/src/flutter/lib/snapshot/BUILD.gn index 9f05eb5c99..f82c5e81f0 100644 --- a/engine/src/flutter/lib/snapshot/BUILD.gn +++ b/engine/src/flutter/lib/snapshot/BUILD.gn @@ -4,6 +4,7 @@ import("//build/compiled_action.gni") import("//third_party/dart/utils/compile_platform.gni") +import("$flutter_root/common/config.gni") import("$flutter_root/lib/ui/dart_ui.gni") bindings_output_dir = "$root_gen_dir/sky/bindings" @@ -55,7 +56,8 @@ compiled_action("generate_snapshot_bin") { rebase_path(isolate_snapshot_instructions), ] - if (is_debug) { + if (is_debug && flutter_runtime_mode != "profile" && + flutter_runtime_mode != "release") { args += [ "--enable_asserts" ] } diff --git a/engine/src/flutter/runtime/BUILD.gn b/engine/src/flutter/runtime/BUILD.gn index 97db3cb3cd..e01cf5d8f2 100644 --- a/engine/src/flutter/runtime/BUILD.gn +++ b/engine/src/flutter/runtime/BUILD.gn @@ -24,6 +24,20 @@ source_set("test_font") { } } +# Picks the libdart implementation based on the Flutter runtime mode. +group("libdart") { + deps = [] + + if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") { + deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ] + } else { + deps += [ + "$flutter_root/lib/snapshot", + "//third_party/dart/runtime:libdart_jit", + ] + } +} + source_set("runtime") { sources = [ "dart_isolate.cc", diff --git a/engine/src/flutter/shell/platform/android/BUILD.gn b/engine/src/flutter/shell/platform/android/BUILD.gn index fb86273840..2eddf97c1a 100644 --- a/engine/src/flutter/shell/platform/android/BUILD.gn +++ b/engine/src/flutter/shell/platform/android/BUILD.gn @@ -61,19 +61,10 @@ shared_library("flutter_shell_native") { "$flutter_root/fml", "$flutter_root/lib/ui", "$flutter_root/runtime", + "$flutter_root/runtime:libdart", "$flutter_root/shell/common", "//third_party/skia", ] - if (flutter_runtime_mode == "debug" || - flutter_runtime_mode == "dynamic_profile" || - flutter_runtime_mode == "dynamic_release") { - deps += [ "//third_party/dart/runtime:libdart_jit" ] - } else { - deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ] - } - if (flutter_runtime_mode == "debug") { - deps += [ "$flutter_root/lib/snapshot" ] - } public_configs = [ "$flutter_root:config" ] diff --git a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn index e881cd429c..ae426f5b92 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn +++ b/engine/src/flutter/shell/platform/darwin/ios/BUILD.gn @@ -109,20 +109,11 @@ shared_library("create_flutter_framework_dylib") { "$flutter_root/fml", "$flutter_root/lib/ui", "$flutter_root/runtime", + "$flutter_root/runtime:libdart", "$flutter_root/shell/common", "$flutter_root/shell/platform/darwin/common", "//third_party/skia", ] - if (flutter_runtime_mode == "debug" || - flutter_runtime_mode == "dynamic_profile" || - flutter_runtime_mode == "dynamic_release") { - deps += [ - "$flutter_root/lib/snapshot", - "//third_party/dart/runtime:libdart_jit", - ] - } else { - deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ] - } public_configs = [ "$flutter_root:config" ] diff --git a/engine/src/flutter/shell/platform/embedder/BUILD.gn b/engine/src/flutter/shell/platform/embedder/BUILD.gn index 9fa9c29956..6b54826cfa 100644 --- a/engine/src/flutter/shell/platform/embedder/BUILD.gn +++ b/engine/src/flutter/shell/platform/embedder/BUILD.gn @@ -45,21 +45,13 @@ source_set("embedder") { "$flutter_root/common", "$flutter_root/flow", "$flutter_root/fml", + "$flutter_root/runtime:libdart", "$flutter_root/shell/common", "//third_party/dart/runtime/bin:dart_io_api", "//third_party/skia", "//third_party/tonic", ] - if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") { - deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ] - } else { - deps += [ - "$flutter_root/lib/snapshot", - "//third_party/dart/runtime:libdart_jit", - ] - } - public_configs = [ "$flutter_root:config" ] }