summaryrefslogtreecommitdiff
path: root/chromium/chromeos/BUILD.gn
blob: 103212164f251b2a99e629d2510694062993a091 (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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# 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/buildflag_header.gni")
import("//build/config/chromeos/rules.gni")
import("//build/config/ui.gni")
import("//testing/test.gni")
import("//third_party/protobuf/proto_library.gni")

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

# Used by targets that compile into the implementation.
config("chromeos_implementation") {
  defines = [ "CHROMEOS_IMPLEMENTATION" ]
}

buildflag_header("chromeos_buildflags") {
  header = "chromeos_buildflags.h"
  flags = [ "IS_CROS_CHROME_SDK=$is_cros_chrome_sdk" ]
}

component("chromeos") {
  configs += [
    ":chromeos_implementation",
    "//build/config/linux/nss:system_nss_no_ssl_config",
  ]
  public_deps = [
    ":chromeos_constants",
  ]
  deps = [
    ":account_manager_proto",
    ":chromeos_export",
    "//base",
    "//base:i18n",
    "//components/policy/proto",
    "//google_apis",
    "//services/network/public/cpp:cpp",
    "//third_party/protobuf:protobuf_lite",
  ]
  sources = [
    "account_manager/account_manager.cc",
    "account_manager/account_manager.h",
    "account_manager/account_manager_factory.cc",
    "account_manager/account_manager_factory.h",
    "app_mode/kiosk_oem_manifest_parser.cc",
    "app_mode/kiosk_oem_manifest_parser.h",
    "hugepage_text/hugepage_text.cc",
    "hugepage_text/hugepage_text.h",
    "policy/weekly_time/time_utils.cc",
    "policy/weekly_time/time_utils.h",
    "policy/weekly_time/weekly_time.cc",
    "policy/weekly_time/weekly_time.h",
    "policy/weekly_time/weekly_time_interval.cc",
    "policy/weekly_time/weekly_time_interval.h",
    "printing/ppd_cache.cc",
    "printing/ppd_cache.h",
    "printing/ppd_line_reader.cc",
    "printing/ppd_line_reader.h",
    "printing/ppd_provider.cc",
    "printing/ppd_provider.h",
    "printing/printer_configuration.cc",
    "printing/printer_configuration.h",
    "printing/printer_translator.cc",
    "printing/printer_translator.h",
    "printing/uri_components.cc",
    "printing/uri_components.h",
    "process_proxy/process_output_watcher.cc",
    "process_proxy/process_output_watcher.h",
    "process_proxy/process_proxy.cc",
    "process_proxy/process_proxy.h",
    "process_proxy/process_proxy_registry.cc",
    "process_proxy/process_proxy_registry.h",
    "system/cpu_temperature_reader.cc",
    "system/cpu_temperature_reader.h",
    "system/devicemode.cc",
    "system/devicemode.h",
    "system/factory_ping_embargo_check.cc",
    "system/factory_ping_embargo_check.h",

    # Used when running mash, both on Linux and on real devices.
    "system/fake_statistics_provider.cc",
    "system/fake_statistics_provider.h",
    "system/name_value_pairs_parser.cc",
    "system/name_value_pairs_parser.h",
    "system/statistics_provider.cc",
    "system/statistics_provider.h",
  ]
  if (current_cpu == "arm" || current_cpu == "x86") {
    defines = [ "BINDER_IPC_32BIT" ]
  }
}

source_set("chromeos_export") {
  deps = [
    "//base",
  ]
  sources = [
    "chromeos_export.h",
  ]
}

source_set("chromeos_constants") {
  configs += [ ":chromeos_implementation" ]
  deps = [
    ":chromeos_export",
    "//base",
    "//base:i18n",
    "//chromeos/dbus:constants",
    "//third_party/icu",
  ]
  sources = [
    "constants/chromeos_constants.cc",
    "constants/chromeos_constants.h",
    "constants/chromeos_features.cc",
    "constants/chromeos_features.h",
    "constants/chromeos_paths.cc",
    "constants/chromeos_paths.h",
    "constants/chromeos_pref_names.cc",
    "constants/chromeos_pref_names.h",
    "constants/chromeos_switches.cc",
    "constants/chromeos_switches.h",
    "constants/devicetype.cc",
    "constants/devicetype.h",
  ]
}

# 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
  public_deps = [
    ":test_support_source_set",
  ]
}

source_set("test_support_source_set") {
  testonly = true
  public_deps = [
    ":chromeos",
    ":test_utils",
  ]
  deps = [
    "//chromeos/attestation:test_support",
    "//chromeos/cryptohome:test_support",
    "//chromeos/dbus:test_support",
    "//chromeos/disks:test_support",
    "//chromeos/login/auth:test_support",
    "//chromeos/login/login_state:test_support",
    "//chromeos/network:test_support",
    "//google_apis",
    "//net:test_support",
    "//services/network:test_support",
    "//testing/gmock",
    "//testing/gtest",
  ]
}

source_set("test_utils") {
  deps = [
    "//base",
  ]
  sources = [
    "test/chromeos_test_utils.cc",
    "test/chromeos_test_utils.h",
  ]
}

test("chromeos_unittests") {
  configs += [
    "//build/config/linux/dbus",
    "//build/config/linux/nss:system_nss_no_ssl_config",
  ]
  deps = [
    ":chromeos_buildflags",
    ":test_support",
    "//base/test:test_support",
    "//chromeos/attestation:unit_tests",
    "//chromeos/audio:unit_tests",
    "//chromeos/cryptohome:unit_tests",
    "//chromeos/dbus:test_support",
    "//chromeos/dbus:unit_tests",
    "//chromeos/dbus/services:unit_tests",
    "//chromeos/disks:unit_tests",
    "//chromeos/geolocation:unit_tests",
    "//chromeos/login/auth:unit_tests",
    "//chromeos/login/login_state:unit_tests",
    "//chromeos/network:test_support",
    "//chromeos/network:unit_tests",
    "//chromeos/services:unit_tests",
    "//chromeos/settings:unit_tests",
    "//chromeos/timezone:unit_tests",
    "//chromeos/tpm:unit_tests",
    "//components/onc",
    "//components/policy:generated",
    "//components/policy/proto",
    "//components/prefs:test_support",
    "//components/proxy_config",
    "//dbus:test_support",
    "//google_apis",
    "//mojo/core/embedder",
    "//net",
    "//net:test_support",
    "//services/network:test_support",
    "//services/network/public/cpp",
    "//testing/gmock",
    "//testing/gtest",
    "//third_party/icu",
    "//url",
  ]
  sources = [
    "account_manager/account_manager_unittest.cc",
    "app_mode/kiosk_oem_manifest_parser_unittest.cc",
    "policy/weekly_time/time_utils_unittest.cc",
    "policy/weekly_time/weekly_time_interval_unittest.cc",
    "policy/weekly_time/weekly_time_unittest.cc",
    "printing/ppd_cache_unittest.cc",
    "printing/ppd_line_reader_unittest.cc",
    "printing/ppd_provider_unittest.cc",
    "printing/printer_configuration_unittest.cc",
    "printing/printer_translator_unittest.cc",
    "process_proxy/process_output_watcher_unittest.cc",
    "process_proxy/process_proxy_unittest.cc",
    "system/cpu_temperature_reader_unittest.cc",
    "system/factory_ping_embargo_check_unittest.cc",
    "system/name_value_pairs_parser_unittest.cc",
    "test/run_all_unittests.cc",
  ]

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

# The following definitions only apply when building for a CrOS board (ie: not
# linux-chromeos). See the following for reference:
# https://chromium.googlesource.com/chromium/src/+/master/docs/chromeos_build_instructions.md
# https://chromium.googlesource.com/chromiumos/docs/+/master/simple_chrome_workflow.md
if (is_cros_chrome_sdk) {
  generate_runner_script("cros_vm_launcher") {
    generated_script = "$root_build_dir/bin/launch_cros_vm"

    # Assume every time we build cros_vm_launcher, we also build chrome and
    # want to deploy it to the VM.
    deploy_chrome = true
  }

  # The sanity test's actual binary is baked into the OS image. All we need to
  # do is build the test wrapper and build our own browser to push to the VM
  # before testing it.
  generate_runner_script("cros_vm_sanity_test") {
    testonly = true
    test_exe = "cros_vm_sanity_test"
    generated_script = "$root_build_dir/bin/run_cros_vm_sanity_test"
    runtime_deps_file = "$root_out_dir/cros_vm_sanity_test.runtime_deps"

    data_deps = [
      ":cros_chrome_deploy",
      "//:chromiumos_preflight",  # Builds the browser.
    ]
  }

  tast_test("chrome_login_tast_tests") {
    tast_tests = [
      "ui.ChromeLogin",
      "ui.ChromeCrashLoggedIn",
      "ui.ChromeCrashNotLoggedIn",
    ]
  }

  # Tast test sources live in the Chromium OS repository.
  # To diagnose tast failures or disable tests, see go/tast-failures
  tast_test("chrome_all_tast_tests") {
    tast_disabled_tests = [
      # Disabled due to flake. https://crbug.com/909736
      "ui.MashLogin",
    ]
  }
  tast_test("chrome_kevin_tast_tests") {
    # Tests that fail on Kevin devices.
    tast_disabled_tests = [
      # Disabled due to misleading USE flags on full boards. crbug.com/916367
      "arc.Boot",
      "security.NetworkListenersARC",
      "video.WebRTCPeerConnCameraVP8",  # crbug.com/923061
    ]
  }

  group("cros_chrome_deploy") {
    # The following run-time dependencies are needed to deploy chrome to a
    # ChromeOS device. See the link for the full list:
    # https://codesearch.chromium.org/chromium/src/third_party/chromite/lib/chrome_util.py?l=341
    # Most of these are copy targets, for which GN doesn't add their outputs
    # as runtime-deps. See the link below for more details:
    # https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/reference.md#actions-and-copies
    data_deps = [
      "//chrome:xdg_mime",
      "//mojo/core:shared_library_arc32",
      "//mojo/core:shared_library_arc64",
    ]

    # TODO(bpastene): Figure out what's generating resources/chromeos/ and
    # declare it as a dep instead of adding the dir directly.
    data = [
      "$root_out_dir/resources/chromeos/",
    ]
  }
}

proto_library("account_manager_proto") {
  sources = [
    "account_manager/tokens.proto",
  ]

  proto_out_dir = "chromeos/account_manager"
}