summaryrefslogtreecommitdiffstats
path: root/chromeos/BUILD.gn
blob: fe418eeaa0b77890dc976b54377c9de9100244a4 (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
116
117
118
119
120
121
122
123
124
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
# 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/config/ui.gni")
import("//testing/test.gni")
import("//third_party/protobuf/proto_library.gni")

assert(is_chromeos, "Non-ChromeOS builds must not depend on //chromeos")

declare_args() {
  # Use binder. Binder related code is compiled only when true.
  use_binder = false
}

gypi_values = exec_script("//build/gypi_to_gn.py",
                          [ rebase_path("chromeos.gyp") ],
                          "scope",
                          [ "chromeos.gyp" ])

component("chromeos") {
  configs += [ "//net/third_party/nss/ssl:ssl_config" ]
  public_deps = [
    "//dbus",
  ]
  deps = [
    ":cryptohome_proto",
    ":power_manager_proto",
    "//base",
    "//base:i18n",
    "//base/third_party/dynamic_annotations",
    "//components/device_event_log",
    "//components/onc",
    "//components/policy/proto",
    "//components/prefs",
    "//components/proxy_config",
    "//components/signin/core/account_id",
    "//components/user_manager",
    "//crypto",
    "//crypto:platform",
    "//google_apis",
    "//third_party/icu",
    "//third_party/libxml",
    "//third_party/protobuf:protobuf_lite",
    "//url",
  ]
  sources = gypi_values.chromeos_sources
  defines = [ "CHROMEOS_IMPLEMENTATION" ]
  if (target_cpu == "arm" || target_cpu == "x86") {
    defines += [ "BINDER_IPC_32BIT" ]
  }
}

# TYhis must be a static library instead of a source set because some of the
# files pull in things with dependencies that aren't linked in all cases.
#
# TODO this should probably be changed such that it links in all cases and
# can be converted to a source set.
static_library("test_support") {
  testonly = true
  configs += [ "//build/config/linux:dbus" ]
  public_deps = [
    ":chromeos",
    ":cryptohome_proto",
    ":power_manager_proto",
    ":test_support_without_gmock",
    "//testing/gmock",
  ]
  sources = [
    "attestation/mock_attestation_flow.cc",
    "attestation/mock_attestation_flow.h",
    "chromeos_test_utils.cc",
    "chromeos_test_utils.h",
    "cryptohome/mock_async_method_caller.cc",
    "cryptohome/mock_async_method_caller.h",
    "cryptohome/mock_homedir_methods.cc",
    "cryptohome/mock_homedir_methods.h",
    "dbus/mock_cryptohome_client.cc",
    "dbus/mock_cryptohome_client.h",
    "dbus/mock_lorgnette_manager_client.cc",
    "dbus/mock_lorgnette_manager_client.h",
    "dbus/mock_permission_broker_client.cc",
    "dbus/mock_permission_broker_client.h",
    "dbus/mock_session_manager_client.cc",
    "dbus/mock_session_manager_client.h",
    "dbus/mock_shill_manager_client.cc",
    "dbus/mock_shill_manager_client.h",
    "dbus/mock_shill_profile_client.cc",
    "dbus/mock_shill_profile_client.h",
    "dbus/mock_shill_service_client.cc",
    "dbus/mock_shill_service_client.h",
    "dbus/services/service_provider_test_helper.cc",
    "dbus/services/service_provider_test_helper.h",
    "disks/mock_disk_mount_manager.cc",
    "disks/mock_disk_mount_manager.h",
    "geolocation/simple_geolocation_request_test_monitor.cc",
    "geolocation/simple_geolocation_request_test_monitor.h",
    "login/auth/fake_extended_authenticator.cc",
    "login/auth/fake_extended_authenticator.h",
    "login/auth/mock_auth_attempt_state_resolver.cc",
    "login/auth/mock_auth_attempt_state_resolver.h",
    "login/auth/mock_auth_status_consumer.cc",
    "login/auth/mock_auth_status_consumer.h",
    "login/auth/mock_url_fetchers.cc",
    "login/auth/mock_url_fetchers.h",
    "network/fake_network_device_handler.cc",
    "network/fake_network_device_handler.h",
    "network/mock_managed_network_configuration_handler.cc",
    "network/mock_managed_network_configuration_handler.h",
    "network/onc/onc_test_utils.cc",
    "network/onc/onc_test_utils.h",
    "system/fake_statistics_provider.cc",
    "system/fake_statistics_provider.h",
  ]
}

static_library("test_support_without_gmock") {
  testonly = true
  configs += [ "//build/config/linux:dbus" ]
  deps = [
    ":chromeos",
    ":cryptohome_proto",
    ":power_manager_proto",
    "//crypto",
  ]
  sources = [
    "dbus/fake_cros_disks_client.cc",
    "dbus/fake_cros_disks_client.h",
    "dbus/fake_session_manager_client.cc",
    "dbus/fake_session_manager_client.h",
    "dbus/fake_shill_manager_client.cc",
    "dbus/fake_shill_manager_client.h",
    "dbus/fake_update_engine_client.cc",
    "dbus/fake_update_engine_client.h",
  ]
}

test("chromeos_unittests") {
  configs += [
    "//build/config/linux:dbus",
    "//net/third_party/nss/ssl:ssl_config",
  ]
  deps = [
    ":cryptohome_proto",
    ":power_manager_proto",
    ":test_support",
    "//base/test:run_all_unittests",
    "//base/test:test_support",
    "//components/onc",
    "//components/prefs:test_support",
    "//components/proxy_config",
    "//components/signin/core/account_id",
    "//crypto",
    "//crypto:test_support",
    "//dbus:test_support",
    "//google_apis",
    "//net",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/icu",
    "//url",
  ]
  sources = gypi_values.chromeos_test_sources
  if (use_binder) {
    if (target_cpu == "arm" || target_cpu == "x86") {
      defines += [ "BINDER_IPC_32BIT" ]
    }
    sources += gypi_values.chromeos_binder_test_sources
  }
}

proto_library("power_manager_proto") {
  sources = [
    "//third_party/cros_system_api/dbus/power_manager/input_event.proto",
    "//third_party/cros_system_api/dbus/power_manager/peripheral_battery_status.proto",
    "//third_party/cros_system_api/dbus/power_manager/policy.proto",
    "//third_party/cros_system_api/dbus/power_manager/power_supply_properties.proto",
    "//third_party/cros_system_api/dbus/power_manager/suspend.proto",
  ]

  proto_out_dir = "chromeos/dbus/power_manager"
}

proto_library("cryptohome_proto") {
  sources = [
    "//third_party/cros_system_api/dbus/cryptohome/key.proto",
    "//third_party/cros_system_api/dbus/cryptohome/rpc.proto",
  ]

  proto_out_dir = "chromeos/dbus/cryptohome"
}

proto_library("cryptohome_signkey_proto") {
  sources = [
    "//third_party/cros_system_api/dbus/cryptohome/signed_secret.proto",
  ]

  proto_out_dir = "chromeos/cryptohome"
}