From 566db0ecb8f293bb9f7ff1fc39076b08336e0148 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Sat, 15 Dec 2018 14:43:26 -0800 Subject: [PATCH] Revert "Compile embedder unit test Dart to kernel (#7227)" (flutter/engine#7230) This reverts commit 4e4fb4608da95d198b0e796478462285ab974a3c. This broke dynamic release mode builds of //flutter/runtime:runtime_fixtures_kernel (likely all product-mode builds). --- .../flutter/runtime/fixtures/simple_main.dart | 2 +- .../embedder/fixtures/simple_main.dart | 2 +- .../embedder/tests/embedder_unittests.cc | 7 ++- engine/src/flutter/testing/testing.gni | 44 +++++-------------- 4 files changed, 18 insertions(+), 37 deletions(-) diff --git a/engine/src/flutter/runtime/fixtures/simple_main.dart b/engine/src/flutter/runtime/fixtures/simple_main.dart index 55187d8642..dc744d2777 100644 --- a/engine/src/flutter/runtime/fixtures/simple_main.dart +++ b/engine/src/flutter/runtime/fixtures/simple_main.dart @@ -2,6 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -void main() { +void simple_main() { print("Hello"); } diff --git a/engine/src/flutter/shell/platform/embedder/fixtures/simple_main.dart b/engine/src/flutter/shell/platform/embedder/fixtures/simple_main.dart index ab73b3a234..05a37e9834 100644 --- a/engine/src/flutter/shell/platform/embedder/fixtures/simple_main.dart +++ b/engine/src/flutter/shell/platform/embedder/fixtures/simple_main.dart @@ -1 +1 @@ -void main() {} +void main() {} \ No newline at end of file diff --git a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc index 266cf92e55..6cd3f4d330 100644 --- a/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc +++ b/engine/src/flutter/shell/platform/embedder/tests/embedder_unittests.cc @@ -22,14 +22,17 @@ TEST(EmbedderTest, CanLaunchAndShutdownWithValidProjectArgs) { return false; }; + std::string main = + std::string(testing::GetFixturesPath()) + "/simple_main.dart"; + FlutterRendererConfig config = {}; config.type = FlutterRendererType::kSoftware; config.software = renderer; FlutterProjectArgs args = {}; args.struct_size = sizeof(FlutterProjectArgs); - args.assets_path = testing::GetFixturesPath(); - args.main_path = ""; + args.assets_path = ""; + args.main_path = main.c_str(); args.packages_path = ""; FlutterEngine engine = nullptr; diff --git a/engine/src/flutter/testing/testing.gni b/engine/src/flutter/testing/testing.gni index b0b49f02d6..ad5badfe92 100644 --- a/engine/src/flutter/testing/testing.gni +++ b/engine/src/flutter/testing/testing.gni @@ -2,21 +2,18 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//third_party/dart/build/dart/dart_action.gni") - -# Builds test fixtures for a unit test. -# -# Generates a directory structure containing an assets directory and the Dart -# code to execute compiled to kernel, emitted to assets/kernel_blob.bin. template("test_fixtures") { testonly = true assert(defined(invoker.fixtures), "Test fixtures must be specified.") - fixtures_location = "$target_gen_dir/$target_name/assets" - fixtures_location_file = "$target_gen_dir/$target_name/test_fixtures_location.cc" - fixtures_name_target_name = target_name + "_gen_fixtures_name" + fixtures_source_set_target_name = target_name + "_gen_fixtures_source_set" + fixtures_copy_target_name = target_name + "_copy_fixtures" + + fixtures_location = "$target_gen_dir/fixtures" + fixtures_location_file = "$target_gen_dir/test_fixtures_location.cc" + action(fixtures_name_target_name) { script = "$flutter_root/testing/build/gen_fixtures_location_symbol.py" @@ -32,9 +29,7 @@ template("test_fixtures") { ] } - fixtures_source_set_target_name = target_name + "_gen_fixtures_source_set" source_set(fixtures_source_set_target_name) { - testonly = true sources = [ fixtures_location_file, ] @@ -44,33 +39,16 @@ template("test_fixtures") { ] } - fixtures_kernel_target_name = target_name + "_kernel" - prebuilt_dart_action(fixtures_kernel_target_name) { - testonly = true - script = "$root_out_dir/frontend_server.dart.snapshot" - - fixture_paths = [] - foreach(fixture, invoker.fixtures) { - fixture_paths += [ rebase_path(fixture) ] - } - inputs = fixture_paths - outputs = ["$fixtures_location/kernel_blob.bin"] - - args = [ - "--sdk-root", rebase_path("$root_out_dir/flutter_patched_sdk"), - "--strong", - "--target", "flutter", - "--output-dill", rebase_path("$fixtures_location/kernel_blob.bin"), - ] + fixture_paths - deps = [ - "//third_party/dart/utils/kernel-service:frontend_server" + copy(fixtures_copy_target_name) { + sources = invoker.fixtures + outputs = [ + "$fixtures_location/{{source_file_part}}", ] } group(target_name) { - testonly = true deps = [ - ":$fixtures_kernel_target_name", + ":$fixtures_copy_target_name", ":$fixtures_source_set_target_name", ] }