summaryrefslogtreecommitdiff
path: root/chromium/chromeos/BUILD.gn
blob: 6a416a8b5bb97058e7497a1e7a22e9ac6e9c5523 (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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# 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 += [ "//third_party/nss:system_nss_no_ssl_config" ]
  public_deps = [
    "//dbus",
  ]
  deps = [
    ":attestation_proto",
    ":cryptohome_proto",
    ":power_manager_proto",
    "//base",
    "//base:i18n",
    "//base/third_party/dynamic_annotations",
    "//components/device_event_log",
    "//components/onc",
    "//components/policy/proto",
    "//components/pref_registry",
    "//components/prefs",
    "//components/proxy_config",
    "//components/signin/core/account_id",
    "//components/user_manager",
    "//crypto",
    "//crypto:platform",
    "//google_apis",
    "//net",
    "//skia",  # For components/user_manager
    "//third_party/icu",
    "//third_party/libxml",
    "//third_party/protobuf:protobuf_lite",
    "//url",
  ]
  sources = gypi_values.chromeos_sources
  defines = [ "CHROMEOS_IMPLEMENTATION" ]
  if (current_cpu == "arm" || current_cpu == "x86") {
    defines += [ "BINDER_IPC_32BIT" ]
  }
}

# This 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 = [
    ":attestation_proto",
    ":chromeos",
    ":cryptohome_proto",
    ":power_manager_proto",
  ]
  deps = [
    ":test_support_without_gmock",
    "//components/signin/core/account_id",
    "//dbus:test_support",
    "//google_apis",
    "//net:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
  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",
    "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/mock_network_device_handler.cc",
    "network/mock_network_device_handler.h",
    "network/onc/onc_test_utils.cc",
    "network/onc/onc_test_utils.h",
  ]
}

static_library("test_support_without_gmock") {
  testonly = true
  configs += [ "//build/config/linux/dbus" ]
  deps = [
    ":attestation_proto",
    ":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",
    "//third_party/nss:system_nss_no_ssl_config",
  ]
  deps = [
    ":attestation_proto",
    ":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 (current_cpu == "arm" || current_cpu == "x86") {
      defines += [ "BINDER_IPC_32BIT" ]
    }
    sources += gypi_values.chromeos_binder_test_sources
  }

  data = [
    "test/data/",
  ]
}

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("attestation_proto") {
  sources = [
    "dbus/proto/attestation.proto",
  ]

  proto_out_dir = "chromeos/attestation"
}

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

  proto_out_dir = "chromeos/cryptohome"
}