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
|
# Copyright 2015 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/util/process_version.gni")
import("//chromecast/chromecast.gni")
import("//testing/test.gni")
if (is_android) {
import("//build/config/android/rules.gni")
}
declare_args() {
# Denotes the type of Cast product. This is #defined as CAST_PRODUCT_TYPE in
# version.h. This is an integer in the range [0-4].
if (is_android) {
cast_product_type = 4
} else {
cast_product_type = 0
}
}
if (is_android) {
assert(cast_product_type == 4)
} else {
assert(cast_product_type >= 0 && cast_product_type <= 3)
}
source_set("base") {
sources = [
"alarm_manager.cc",
"alarm_manager.h",
"android/dumpstate_writer.cc",
"android/dumpstate_writer.h",
"android/system_time_change_notifier_android.cc",
"android/system_time_change_notifier_android.h",
"bind_to_task_runner.h",
"cast_constants.cc",
"cast_constants.h",
"cast_paths.cc",
"cast_paths.h",
"cast_resource.cc",
"cast_resource.h",
"chromecast_config_android.cc",
"chromecast_config_android.h",
"device_capabilities.h",
"device_capabilities_impl.cc",
"device_capabilities_impl.h",
"error_codes.cc",
"error_codes.h",
"file_utils.cc",
"file_utils.h",
"path_utils.cc",
"path_utils.h",
"pref_names.cc",
"pref_names.h",
"process_utils.cc",
"process_utils.h",
"serializers.cc",
"serializers.h",
"system_time_change_notifier.cc",
"system_time_change_notifier.h",
"task_runner_impl.cc",
"task_runner_impl.h",
]
public_deps = [
":chromecast_switches",
":init_shlib",
"//chromecast/base/metrics",
"//chromecast/public",
]
deps = [
"//base",
]
if (is_android) {
deps += [ ":jni_headers" ]
}
}
# chromecast related switch values
# b/30398176 components that depend on switch values should depend on
# this target directly instead of depend on //chromecast/base to avoid
# unnecessary size increase.
source_set("chromecast_switches") {
sources = [
"chromecast_switches.cc",
"chromecast_switches.h",
]
deps = [
"//base",
]
}
# command line initialization code for shared libs
# b/30398176 shared libs that depend on InitCommandLineShlib() only should
# use this target instead of //chromecast/base
source_set("init_shlib") {
sources = [
"init_command_line_shlib.cc",
"init_command_line_shlib.h",
]
deps = [
"//base",
]
}
source_set("test_support") {
sources = [
"scoped_temp_file.cc",
"scoped_temp_file.h",
]
public_deps = [
":base",
"//base",
]
}
test("cast_base_unittests") {
sources = [
"alarm_manager_unittest.cc",
"bind_to_task_runner_unittest.cc",
"device_capabilities_impl_unittest.cc",
"error_codes_unittest.cc",
"path_utils_unittest.cc",
"process_utils_unittest.cc",
"serializers_unittest.cc",
"system_time_change_notifier_unittest.cc",
]
deps = [
":test_support",
"//base/test:run_all_unittests",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
]
}
source_set("cast_sys_info") {
sources = [
"cast_sys_info_android.cc",
"cast_sys_info_android.h",
"cast_sys_info_dummy.cc",
"cast_sys_info_dummy.h",
"cast_sys_info_util.h",
]
deps = [
"//base",
"//chromecast/public",
]
if (is_android) {
deps += [
":cast_version",
"//chromecast/browser:jni_headers",
]
} else if (chromecast_branding == "public") {
sources += [ "cast_sys_info_util_simple.cc" ]
}
}
# Target for OEM partners to override sys_info shared library, i.e.
# libcast_sys_info_1.0.so.
shared_library("libcast_sys_info_1.0") {
sources = [
"cast_sys_info_dummy.cc",
"cast_sys_info_dummy.h",
"cast_sys_info_shlib.cc",
]
deps = [
"//chromecast/public",
]
}
# Note: Android links //chromecast/base:cast_sys_info statically.
source_set("cast_sys_info_shlib") {
if (!is_android) {
sources = [
"cast_sys_info_util_shlib.cc",
]
deps = [
":cast_sys_info",
":libcast_sys_info_1.0",
"//base",
"//chromecast/public",
]
}
}
process_version("cast_version") {
template_file = "version.h.in"
output = "$target_gen_dir/version.h"
sources = [
"//chrome/VERSION",
]
extra_args = [
"-e",
"VERSION_FULL=\"%s.%s.%s.%s\"%(MAJOR,MINOR,BUILD,PATCH)",
"-e",
"CAST_BUILD_RELEASE=\"$cast_build_release\"",
"-e",
"CAST_BUILD_INCREMENTAL=\"$cast_build_incremental\"",
"-e",
"CAST_PRODUCT_TYPE=$cast_product_type",
]
if (cast_is_debug) {
extra_args += [
"-e",
"CAST_IS_DEBUG_BUILD=1",
]
} else {
extra_args += [
"-e",
"CAST_IS_DEBUG_BUILD=0",
]
}
}
if (is_android) {
generate_jni("jni_headers") {
sources = [
"java/src/org/chromium/chromecast/base/ChromecastConfigAndroid.java",
"java/src/org/chromium/chromecast/base/DumpstateWriter.java",
"java/src/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java",
]
jni_package = "chromecast"
}
android_library("base_java") {
java_src_dir = "//chromecast/base/java/src"
java_files = [
"$java_src_dir/org/chromium/chromecast/base/CastSettingsManager.java",
"$java_src_dir/org/chromium/chromecast/base/ChromecastConfigAndroid.java",
"$java_src_dir/org/chromium/chromecast/base/DumpstateWriter.java",
"$java_src_dir/org/chromium/chromecast/base/SystemTimeChangeNotifierAndroid.java",
]
deps = [
"//base:base_java",
]
}
}
|