summaryrefslogtreecommitdiff
path: root/chromium/tools/android/forwarder2/BUILD.gn
blob: 2a5bba929cea9cfd5404f96cf582f49af19457a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/symlink.gni")
import("//testing/test.gni")

group("forwarder2") {
  testonly = true
  data_deps = [
    ":device_forwarder_prepare_dist($default_toolchain)",
    ":host_forwarder",
    ":host_forwarder_unittests",
  ]
}

if (current_toolchain == default_toolchain) {
  import("//build/config/android/rules.gni")

  executable("device_forwarder") {
    sources = [
      "command.cc",
      "command.h",
      "common.cc",
      "common.h",
      "daemon.cc",
      "daemon.h",
      "device_controller.cc",
      "device_controller.h",
      "device_forwarder_main.cc",
      "device_listener.cc",
      "device_listener.h",
      "forwarder.cc",
      "forwarder.h",
      "forwarders_manager.cc",
      "forwarders_manager.h",
      "pipe_notifier.cc",
      "pipe_notifier.h",
      "self_deleter_helper.h",
      "socket.cc",
      "socket.h",
      "util.h",
    ]
    deps = [
      "//base",
      "//tools/android/common",
    ]
    data_deps = [ "//build/android/pylib/device/commands" ]
  }

  create_native_executable_dist("device_forwarder_prepare_dist") {
    dist_dir = "$root_build_dir/forwarder_dist"
    binary = "$root_build_dir/device_forwarder"
    deps = [ ":device_forwarder" ]
  }
}

if (current_toolchain != default_toolchain) {
  source_set("host_forwarder_source_set") {
    sources = [
      "command.cc",
      "command.h",
      "common.cc",
      "common.h",
      "daemon.cc",
      "daemon.h",
      "forwarder.cc",
      "forwarder.h",
      "forwarders_manager.cc",
      "forwarders_manager.h",
      "host_controller.cc",
      "host_controller.h",
      "host_controllers_manager.cc",
      "host_controllers_manager.h",
      "pipe_notifier.cc",
      "pipe_notifier.h",
      "self_deleter_helper.h",
      "socket.cc",
      "socket.h",
      "util.h",
    ]
    deps = [
      "//base",
      "//tools/android/common",
    ]
  }

  executable("host_forwarder") {
    sources = [ "host_forwarder_main.cc" ]
    deps = [
      ":host_forwarder_source_set",
      "//base",
    ]
  }

  test("host_forwarder_unittests") {
    testonly = true
    sources = [ "host_controllers_manager_unittest.cc" ]
    deps = [
      ":host_forwarder_source_set",
      "//base",
      "//testing/gtest",
      "//testing/gtest:gtest_main",
    ]
  }
} else {
  # Create a symlink from root_build_dir -> clang_x64/host_forwarder.
  binary_symlink("host_forwarder") {
    binary_label = ":$target_name($host_toolchain)"
  }
  binary_symlink("host_forwarder_unittests") {
    testonly = true
    binary_label = ":$target_name($host_toolchain)"
  }
}