• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2013 The Flutter Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//third_party/dart/runtime/bin/vmservice/vmservice_sources.gni")
6import("$flutter_root/common/config.gni")
7import("$flutter_root/testing/testing.gni")
8
9source_set("test_font") {
10  sources = [
11    "test_font_data.cc",
12    "test_font_data.h",
13  ]
14  deps = [ "//third_party/skia" ]
15  public_configs = [ "$flutter_root:config" ]
16  defines = []
17  if (flutter_runtime_mode == "debug" || current_toolchain == host_toolchain) {
18    # Though the test font data is small, we dont want to add to the binary size
19    # on the device (in profile and release modes). We only add the same on the
20    # host test shells and the debug device shell.
21    defines += [ "EMBED_TEST_FONT_DATA=1" ]
22  }
23}
24
25# Picks the libdart implementation based on the Flutter runtime mode.
26group("libdart") {
27  public_deps = []
28
29  if (!(is_fuchsia && using_fuchsia_sdk)) {
30    if (flutter_runtime_mode == "profile" ||
31        flutter_runtime_mode == "release") {
32      public_deps +=
33          [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
34    } else {
35      public_deps += [
36        "$flutter_root/lib/snapshot",
37        "//third_party/dart/runtime:libdart_jit",
38      ]
39    }
40  }
41}
42
43source_set("runtime") {
44  sources = [
45    "dart_isolate.cc",
46    "dart_isolate.h",
47    "dart_service_isolate.cc",
48    "dart_service_isolate.h",
49    "dart_snapshot.cc",
50    "dart_snapshot.h",
51    "dart_vm.cc",
52    "dart_vm.h",
53    "dart_vm_data.cc",
54    "dart_vm_data.h",
55    "dart_vm_lifecycle.cc",
56    "dart_vm_lifecycle.h",
57    "embedder_resources.cc",
58    "embedder_resources.h",
59    "ptrace_ios.cc",
60    "ptrace_ios.h",
61    "runtime_controller.cc",
62    "runtime_controller.h",
63    "runtime_delegate.cc",
64    "runtime_delegate.h",
65    "service_protocol.cc",
66    "service_protocol.h",
67    "skia_concurrent_executor.cc",
68    "skia_concurrent_executor.h",
69    "start_up.cc",
70    "start_up.h",
71  ]
72
73  deps = [
74    ":test_font",
75    "$flutter_root/assets",
76    "$flutter_root/common",
77    "$flutter_root/flow",
78    "$flutter_root/fml",
79    "$flutter_root/lib/io",
80    "$flutter_root/lib/ui",
81    "$flutter_root/third_party/txt",
82    "//third_party/dart/runtime:dart_api",
83    "//third_party/dart/runtime/bin:dart_io_api",
84    "//third_party/skia",
85    "//third_party/tonic",
86  ]
87
88  public_deps = [ "//third_party/rapidjson" ]
89
90  public_configs = [ "$flutter_root:config" ]
91
92  if (flutter_runtime_mode != "release" && !is_fuchsia) {
93    # Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
94    # instead puts Observatory into the runner's package.
95    deps += [
96      "//third_party/dart/runtime/observatory:embedded_observatory_archive",
97    ]
98  }
99}
100
101test_fixtures("runtime_fixtures") {
102  dart_main = "fixtures/runtime_test.dart"
103}
104
105source_set("runtime_unittests_common") {
106  visibility = [ ":*" ]
107
108  testonly = true
109
110  sources = [
111    "runtime_test.cc",
112    "runtime_test.h",
113  ]
114
115  public_deps = [
116    ":libdart",
117    ":runtime",
118    ":runtime_fixtures",
119    "$flutter_root/common",
120    "$flutter_root/fml",
121    "$flutter_root/lib/snapshot",
122    "$flutter_root/shell/common",
123    "$flutter_root/testing:dart",
124    "//third_party/skia",
125    "//third_party/tonic",
126  ]
127}
128
129executable("runtime_unittests") {
130  testonly = true
131
132  configs += [ "$flutter_root:export_dynamic_symbols" ]
133
134  sources = [
135    "dart_isolate_unittests.cc",
136    "dart_lifecycle_unittests.cc",
137    "dart_service_isolate_unittests.cc",
138    "dart_vm_unittests.cc",
139  ]
140
141  deps = [ ":runtime_unittests_common" ]
142}
143