BUILD.gn 3.7 KB
Newer Older
M
Michael Goderbauer 已提交
1
# Copyright 2013 The Flutter Authors. All rights reserved.
2 3 4
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

5
import("//third_party/dart/runtime/bin/vmservice/vmservice_sources.gni")
6
import("$flutter_root/common/config.gni")
7
import("$flutter_root/testing/testing.gni")
8

9 10 11 12 13 14 15 16
source_set("test_font") {
  sources = [
    "test_font_data.cc",
    "test_font_data.h",
  ]
  deps = [
    "//third_party/skia",
  ]
17
  public_configs = [ "$flutter_root:config" ]
18 19 20 21 22 23 24 25 26
  defines = []
  if (flutter_runtime_mode == "debug" || current_toolchain == host_toolchain) {
    # Though the test font data is small, we dont want to add to the binary size
    # on the device (in profile and release modes). We only add the same on the
    # host test shells and the debug device shell.
    defines += [ "EMBED_TEST_FONT_DATA=1" ]
  }
}

27 28
# Picks the libdart implementation based on the Flutter runtime mode.
group("libdart") {
29
  public_deps = []
30 31

  if (flutter_runtime_mode == "profile" || flutter_runtime_mode == "release") {
32
    public_deps += [ "//third_party/dart/runtime:libdart_precompiled_runtime" ]
33
  } else {
34
    public_deps += [
35 36 37 38 39 40
      "$flutter_root/lib/snapshot",
      "//third_party/dart/runtime:libdart_jit",
    ]
  }
}

41 42
source_set("runtime") {
  sources = [
43 44
    "dart_isolate.cc",
    "dart_isolate.h",
45 46
    "dart_service_isolate.cc",
    "dart_service_isolate.h",
47 48 49 50 51 52
    "dart_snapshot.cc",
    "dart_snapshot.h",
    "dart_snapshot_buffer.cc",
    "dart_snapshot_buffer.h",
    "dart_vm.cc",
    "dart_vm.h",
53 54 55 56
    "dart_vm_data.cc",
    "dart_vm_data.h",
    "dart_vm_lifecycle.cc",
    "dart_vm_lifecycle.h",
57 58
    "embedder_resources.cc",
    "embedder_resources.h",
59 60 61 62
    "runtime_controller.cc",
    "runtime_controller.h",
    "runtime_delegate.cc",
    "runtime_delegate.h",
63 64
    "service_protocol.cc",
    "service_protocol.h",
65 66 67 68 69
    "start_up.cc",
    "start_up.h",
  ]

  deps = [
70
    ":test_font",
71 72 73
    "$flutter_root/assets",
    "$flutter_root/common",
    "$flutter_root/flow",
74
    "$flutter_root/fml",
75 76 77
    "$flutter_root/lib/io",
    "$flutter_root/lib/ui",
    "$flutter_root/third_party/txt",
78
    "//third_party/dart/runtime:dart_api",
B
Ben Konyi 已提交
79
    "//third_party/dart/runtime/bin:dart_io_api",
80
    "//third_party/skia",
81
    "//third_party/tonic",
82 83
  ]

84 85 86 87
  public_deps = [
    "//third_party/rapidjson",
  ]

88
  public_configs = [ "$flutter_root:config" ]
89

90
  if (flutter_runtime_mode != "release" &&
91
      flutter_runtime_mode != "dynamic_release" && !is_fuchsia) {
J
Jason Simmons 已提交
92 93
    # Only link in Observatory in non-release modes on non-Fuchsia. Fuchsia
    # instead puts Observatory into the runner's package.
94 95 96
    deps += [
      "//third_party/dart/runtime/observatory:embedded_observatory_archive",
    ]
J
Jason Simmons 已提交
97
  }
98
}
99 100 101 102 103

test_fixtures("runtime_fixtures") {
  fixtures = [ "fixtures/simple_main.dart" ]
}

104 105 106
source_set("runtime_unittests_common") {
  visibility = [ ":*" ]

107 108 109
  testonly = true

  sources = [
110 111
    "runtime_test.cc",
    "runtime_test.h",
112 113
  ]

114
  public_deps = [
115
    ":libdart",
116 117
    ":runtime",
    ":runtime_fixtures",
118
    "$flutter_root/common",
119
    "$flutter_root/fml",
120
    "$flutter_root/lib/snapshot",
121
    "$flutter_root/shell/common",
122
    "$flutter_root/testing:dart",
123
    "//third_party/skia",
124
    "//third_party/tonic",
125
  ]
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
}

executable("runtime_unittests") {
  testonly = true

  sources = [
    "dart_isolate_unittests.cc",
    "dart_service_isolate_unittests.cc",
    "dart_vm_unittests.cc",
  ]

  deps = [
    ":runtime_unittests_common",
  ]

  if (is_linux) {
    ldflags = [ "-rdynamic" ]
  }
}

executable("runtime_lifecycle_unittests") {
  testonly = true

  sources = [
    "dart_lifecycle_unittests.cc",
  ]

  deps = [
    ":runtime_unittests_common",
  ]
156 157 158 159

  if (is_linux) {
    ldflags = [ "-rdynamic" ]
  }
160
}