blob: 6d9d2413ddff8093b7a9c336b369cfebb2cdb5e3 [file] [log] [blame]
Misha Efimov1770a1b2018-01-11 15:27:271# Copyright 2017 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import("//build/util/process_version.gni")
6import("//build/util/version.gni")
7import("//testing/test.gni")
8
9process_version("cronet_version_header") {
10 template_file = "//components/cronet/version.h.in"
11 sources = [
12 "//chrome/VERSION",
13 ]
14 output = "$target_gen_dir/version.h"
15 extra_args = [
16 "-e",
17 "VERSION_FULL=\"%s.%s.%s.%s\" % (MAJOR,MINOR,BUILD,PATCH)",
18 ]
19}
20
21# Cronet common implementation.
22source_set("cronet_common") {
23 sources = [
24 "cronet_global_state.h",
25 "cronet_prefs_manager.cc",
26 "cronet_prefs_manager.h",
Misha Efimovc1731b02018-01-16 21:46:5127 "cronet_url_request.cc",
28 "cronet_url_request.h",
Misha Efimov1770a1b2018-01-11 15:27:2729 "cronet_url_request_context.cc",
30 "cronet_url_request_context.h",
31 "histogram_manager.cc",
32 "histogram_manager.h",
33 "host_cache_persistence_manager.cc",
34 "host_cache_persistence_manager.h",
35 "stale_host_resolver.cc",
36 "stale_host_resolver.h",
37 "url_request_context_config.cc",
38 "url_request_context_config.h",
39 ]
40 deps = [
41 ":cronet_version_header",
42 "//base",
43 "//components/metrics:metrics",
44 "//components/prefs:prefs",
45 "//net",
46 "//third_party/metrics_proto",
47 ]
48}
49
50# Unit tests for Cronet common implementation.
51source_set("cronet_common_unittests") {
52 testonly = true
53
54 deps = [
55 ":cronet_common",
56 "//components/prefs:test_support",
57 "//net:test_support",
58 ]
59
60 sources = [
61 "histogram_manager_unittest.cc",
62 "host_cache_persistence_manager_unittest.cc",
63 "run_all_unittests.cc",
64 "stale_host_resolver_unittest.cc",
65 "url_request_context_config_unittest.cc",
66 ]
67}
Wez115d4312018-02-17 04:05:1968
69# For platforms on which the native Cronet library is used, build the library,
70# a cronet_tests binary that exercises it, and a unit-tests binary.
71# Android and iOS have their own platform-specific rules to build Cronet.
72# TODO(https://crbug.com/812268): Fix Windows build, and enable it.
73if (!is_ios && !is_android && !is_win) {
74 shared_library("cronet") {
75 deps = [
76 "//base",
77
78 # Explicitly add the exe_and_shlib_deps, otherwise the library will fail
79 # to link in component builds, due to missing libc++ symbols.
80 "//build/config:exe_and_shlib_deps",
81 "//components/cronet:cronet_common",
82 "//components/cronet/native:cronet_native_impl",
83 "//net",
84 ]
85
86 sources = [
87 "cronet_global_state_stubs.cc",
88 ]
89 }
90
91 test("cronet_tests") {
92 testonly = true
93
94 deps = [
95 ":cronet",
96 "//components/cronet/native/test:cronet_native_tests",
97 "//testing/gtest:gtest_main",
98 ]
99 }
100
101 test("cronet_unittests") {
102 testonly = true
103
104 deps = [
105 ":cronet_common",
106 ":cronet_common_unittests",
107 "//base",
108 "//components/cronet/native:cronet_native_unittests",
109 "//net",
110 ]
111
112 sources = [
113 "cronet_global_state_stubs.cc",
114 ]
115 }
116}