blob: 81d20c1e7ac045ff0cb360b050b0835885a772a4 [file] [log] [blame]
GuangHui Liu35994392017-05-10 14:37:17 -07001// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Josh Gao361148b2018-01-02 12:01:43 -080015cc_defaults {
16 name: "adb_defaults",
17
18 cflags: [
19 "-Wall",
20 "-Wextra",
21 "-Werror",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070022 "-Wexit-time-destructors",
Josh Gao361148b2018-01-02 12:01:43 -080023 "-Wno-unused-parameter",
24 "-Wno-missing-field-initializers",
Josh Gao0560feb2019-01-22 19:36:15 -080025 "-Wthread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080026 "-Wvla",
Bowgo Tsai35b817b2019-03-12 04:25:33 +080027 "-DADB_HOST=1", // overridden by adbd_defaults
28 "-DALLOW_ADBD_ROOT=0", // overridden by adbd_defaults
Josh Gao90228a62019-04-25 14:04:57 -070029 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao361148b2018-01-02 12:01:43 -080030 ],
Josh Gao3edf8072018-11-16 15:40:16 -080031 cpp_std: "experimental",
Josh Gao361148b2018-01-02 12:01:43 -080032
Josh Gao66766f82018-02-27 15:49:23 -080033 use_version_lib: true,
Josh Gao361148b2018-01-02 12:01:43 -080034 compile_multilib: "first",
Josh Gao361148b2018-01-02 12:01:43 -080035
36 target: {
Josh Gao361148b2018-01-02 12:01:43 -080037 darwin: {
38 host_ldlibs: [
39 "-lpthread",
40 "-framework CoreFoundation",
41 "-framework IOKit",
42 "-lobjc",
43 ],
44 },
45
46 windows: {
47 cflags: [
48 // Define windows.h and tchar.h Unicode preprocessor symbols so that
49 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
50 // build if you accidentally pass char*. Fix by calling like:
51 // std::wstring path_wide;
52 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
53 // CreateFileW(path_wide.c_str());
54 "-DUNICODE=1",
55 "-D_UNICODE=1",
56
Elliott Hughesc229a722018-12-03 09:02:18 -080057 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao361148b2018-01-02 12:01:43 -080058 "-D_GNU_SOURCE",
Josh Gao96049b92018-03-23 13:03:28 -070059
60 // MinGW hides some things behind _POSIX_SOURCE.
61 "-D_POSIX_SOURCE",
Josh Gao0560feb2019-01-22 19:36:15 -080062
Josh Gaoc3b64032019-04-17 16:57:43 -070063 // libusb uses __stdcall on a variadic function, which gets ignored.
64 "-Wno-ignored-attributes",
65
Josh Gao0560feb2019-01-22 19:36:15 -080066 // Not supported yet.
67 "-Wno-thread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080068 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -070069
70 host_ldlibs: [
71 "-lws2_32",
72 "-lgdi32",
73 "-luserenv",
74 ],
Josh Gao361148b2018-01-02 12:01:43 -080075 },
Josh Gao0560feb2019-01-22 19:36:15 -080076 },
77}
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070078
Josh Gao0560feb2019-01-22 19:36:15 -080079cc_defaults {
80 name: "adbd_defaults",
81 defaults: ["adb_defaults"],
82
83 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
84 product_variables: {
85 debuggable: {
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070086 cflags: [
Bowgo Tsai35b817b2019-03-12 04:25:33 +080087 "-UALLOW_ADBD_ROOT",
88 "-DALLOW_ADBD_ROOT=1",
Josh Gao0560feb2019-01-22 19:36:15 -080089 "-DALLOW_ADBD_DISABLE_VERITY",
90 "-DALLOW_ADBD_NO_AUTH",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070091 ],
92 },
Josh Gao361148b2018-01-02 12:01:43 -080093 },
94}
95
Josh Gao0560feb2019-01-22 19:36:15 -080096cc_defaults {
97 name: "host_adbd_supported",
98
99 host_supported: true,
100 target: {
101 linux: {
102 enabled: true,
103 host_ldlibs: [
104 "-lresolv", // b64_pton
105 "-lutil", // forkpty
106 ],
107 },
108 darwin: {
109 enabled: false,
110 },
111 windows: {
112 enabled: false,
113 },
114 },
115}
116
Josh Gao361148b2018-01-02 12:01:43 -0800117// libadb
118// =========================================================
119// These files are compiled for both the host and the device.
120libadb_srcs = [
121 "adb.cpp",
122 "adb_io.cpp",
123 "adb_listeners.cpp",
124 "adb_trace.cpp",
Josh Gao7d5762c2018-05-24 22:54:50 -0700125 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800126 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700127 "fdevent/fdevent.cpp",
Josh Gao9e4aa3a2019-07-08 15:23:17 -0700128 "fdevent/fdevent_poll.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800129 "services.cpp",
130 "sockets.cpp",
131 "socket_spec.cpp",
132 "sysdeps/errno.cpp",
133 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700134 "transport_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800135 "transport_local.cpp",
136 "transport_usb.cpp",
Yurii Zubrytskyie5e6b0d2019-07-12 14:11:54 -0700137 "types.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800138]
139
140libadb_posix_srcs = [
141 "sysdeps_unix.cpp",
142 "sysdeps/posix/network.cpp",
143]
144
Josh Gaodd716422019-07-11 13:47:44 -0700145libadb_linux_srcs = [
146 "fdevent/fdevent_epoll.cpp",
147]
148
Josh Gao361148b2018-01-02 12:01:43 -0800149libadb_test_srcs = [
150 "adb_io_test.cpp",
151 "adb_listeners_test.cpp",
152 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700153 "fdevent/fdevent_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800154 "socket_spec_test.cpp",
155 "socket_test.cpp",
156 "sysdeps_test.cpp",
157 "sysdeps/stat_test.cpp",
158 "transport_test.cpp",
Josh Gao9f155db2018-04-03 14:37:11 -0700159 "types_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800160]
161
162cc_library_host_static {
163 name: "libadb_host",
164 defaults: ["adb_defaults"],
165
166 srcs: libadb_srcs + [
167 "client/auth.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800168 "client/adb_wifi.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800169 "client/usb_libusb.cpp",
170 "client/usb_dispatch.cpp",
171 "client/transport_mdns.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800172 "client/pairing/pairing_client.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800173 ],
174
Dan Willemsen18861892018-08-29 14:58:02 -0700175 generated_headers: ["platform_tools_version"],
176
Josh Gao361148b2018-01-02 12:01:43 -0800177 target: {
178 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700179 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800180 },
181 darwin: {
182 srcs: ["client/usb_osx.cpp"],
183 },
Josh Gao361148b2018-01-02 12:01:43 -0800184 not_windows: {
185 srcs: libadb_posix_srcs,
186 },
187 windows: {
188 enabled: true,
189 srcs: [
190 "client/usb_windows.cpp",
191 "sysdeps_win32.cpp",
192 "sysdeps/win32/errno.cpp",
193 "sysdeps/win32/stat.cpp",
194 ],
195 shared_libs: ["AdbWinApi"],
196 },
197 },
198
199 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800200 "libadb_crypto",
201 "libadb_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800202 "libadb_pairing_connection",
203 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800204 "libbase",
205 "libcrypto_utils",
206 "libcrypto",
207 "libdiagnose_usb",
208 "libmdnssd",
209 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100210 "libutils",
211 "liblog",
212 "libcutils",
Joshua Duong290ccb52019-11-20 14:18:43 -0800213 "libprotobuf-cpp-lite",
Josh Gao361148b2018-01-02 12:01:43 -0800214 ],
215}
216
217cc_test_host {
218 name: "adb_test",
219 defaults: ["adb_defaults"],
220 srcs: libadb_test_srcs,
221 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800222 "libadb_crypto_static",
Josh Gao361148b2018-01-02 12:01:43 -0800223 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800224 "libadb_pairing_auth_static",
225 "libadb_pairing_connection_static",
226 "libadb_protos_static",
227 "libadb_tls_connection_static",
Josh Gao361148b2018-01-02 12:01:43 -0800228 "libbase",
229 "libcutils",
230 "libcrypto_utils",
231 "libcrypto",
Tom Cherry49b96ec2020-01-08 13:41:56 -0800232 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800233 "libmdnssd",
234 "libdiagnose_usb",
Joshua Duong290ccb52019-11-20 14:18:43 -0800235 "libprotobuf-cpp-lite",
236 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800237 "libusb",
238 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700239
240 target: {
241 windows: {
242 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700243 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700244 shared_libs: ["AdbWinApi"],
245 },
246 },
Josh Gao361148b2018-01-02 12:01:43 -0800247}
248
Josh Gao11e41d62018-04-04 11:27:24 -0700249cc_benchmark {
250 name: "adb_benchmark",
251 defaults: ["adb_defaults"],
252
253 srcs: ["transport_benchmark.cpp"],
254 target: {
255 android: {
256 static_libs: [
257 "libadbd",
258 ],
259 },
260 host: {
261 static_libs: [
262 "libadb_host",
263 ],
264 },
265 },
266
267 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800268 "libadb_crypto_static",
269 "libadb_tls_connection_static",
270 "libadbd_auth",
Josh Gao11e41d62018-04-04 11:27:24 -0700271 "libbase",
272 "libcutils",
273 "libcrypto_utils",
Colin Crosse1cc1ec2019-09-18 11:04:35 -0700274 "libcrypto_static",
Josh Gao11e41d62018-04-04 11:27:24 -0700275 "libdiagnose_usb",
276 "liblog",
Joshua Duong290ccb52019-11-20 14:18:43 -0800277 "libssl",
Josh Gao11e41d62018-04-04 11:27:24 -0700278 "libusb",
279 ],
280}
281
Josh Gao361148b2018-01-02 12:01:43 -0800282cc_binary_host {
283 name: "adb",
Josh Gao361148b2018-01-02 12:01:43 -0800284
Josh Gao06af61e2020-02-03 23:08:05 -0800285 stl: "libc++_static",
Josh Gao361148b2018-01-02 12:01:43 -0800286 defaults: ["adb_defaults"],
287
288 srcs: [
289 "client/adb_client.cpp",
290 "client/bugreport.cpp",
291 "client/commandline.cpp",
292 "client/file_sync_client.cpp",
293 "client/main.cpp",
294 "client/console.cpp",
Idries Hamadi1ecee442018-01-29 16:30:36 +0000295 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800296 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700297 "client/fastdeploy.cpp",
298 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800299 "client/incremental.cpp",
300 "client/incremental_server.cpp",
Songchun Fan965301e2020-03-13 13:11:43 -0700301 "client/incremental_utils.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800302 "shell_service_protocol.cpp",
303 ],
304
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700305 generated_headers: [
306 "bin2c_fastdeployagent",
307 "bin2c_fastdeployagentscript"
308 ],
309
Josh Gao361148b2018-01-02 12:01:43 -0800310 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800311 "libadb_crypto",
Josh Gao361148b2018-01-02 12:01:43 -0800312 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800313 "libadb_pairing_auth",
314 "libadb_pairing_connection",
315 "libadb_protos",
316 "libadb_tls_connection",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700317 "libandroidfw",
Shukang Zhou420ad552020-02-13 17:01:39 -0800318 "libapp_processes_protos_full",
Josh Gao361148b2018-01-02 12:01:43 -0800319 "libbase",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800320 "libbrotli",
Josh Gao361148b2018-01-02 12:01:43 -0800321 "libcutils",
322 "libcrypto_utils",
323 "libcrypto",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700324 "libfastdeploy_host",
Josh Gao361148b2018-01-02 12:01:43 -0800325 "libdiagnose_usb",
326 "liblog",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800327 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800328 "libmdnssd",
Shukang Zhou420ad552020-02-13 17:01:39 -0800329 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -0800330 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800331 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100332 "libutils",
333 "liblog",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700334 "libziparchive",
335 "libz",
Josh Gao361148b2018-01-02 12:01:43 -0800336 ],
337
Josh Gao361148b2018-01-02 12:01:43 -0800338 // Don't add anything here, we don't want additional shared dependencies
339 // on the host adb tool, and shared libraries that link against libc++
340 // will violate ODR
341 shared_libs: [],
342
Dan Willemsen7024da42018-11-19 19:11:35 -0800343 // Archive adb, adb.exe.
344 dist: {
345 targets: [
346 "dist_files",
347 "sdk",
348 "win_sdk",
349 ],
350 },
351
Josh Gao361148b2018-01-02 12:01:43 -0800352 target: {
353 darwin: {
354 cflags: [
355 "-Wno-sizeof-pointer-memaccess",
356 ],
357 },
358 windows: {
359 enabled: true,
360 ldflags: ["-municode"],
Josh Gao361148b2018-01-02 12:01:43 -0800361 shared_libs: ["AdbWinApi"],
362 required: [
363 "AdbWinUsbApi",
364 ],
365 },
366 },
367}
368
Tao Bao49042e32018-07-30 20:45:27 -0700369// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800370cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700371 name: "libadbd_core",
Josh Gao0560feb2019-01-22 19:36:15 -0800372 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700373 recovery_available: true,
374
375 // libminadbd wants both, as it's used to build native tests.
376 compile_multilib: "both",
377
Josh Gaodd716422019-07-11 13:47:44 -0700378 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Bao49042e32018-07-30 20:45:27 -0700379 "daemon/auth.cpp",
380 "daemon/jdwp_service.cpp",
Josh Gaobd775212020-02-26 16:39:20 -0800381 "daemon/logging.cpp",
Josh Gao2e24c962020-02-21 16:38:29 -0800382 "daemon/adb_wifi.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700383 ],
384
385 local_include_dirs: [
386 "daemon/include",
387 ],
388
Dan Willemsen18861892018-08-29 14:58:02 -0700389 generated_headers: ["platform_tools_version"],
390
Tao Bao49042e32018-07-30 20:45:27 -0700391 static_libs: [
392 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700393 ],
394
395 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700396 "libadbconnection_server",
Joshua Duong090c8072019-12-19 16:36:30 -0800397 "libadb_crypto",
Joshua Duong290ccb52019-11-20 14:18:43 -0800398 "libadb_pairing_connection",
399 "libadb_protos",
400 "libadb_tls_connection",
Josh Gao7cac88a2019-10-22 12:30:39 -0700401 "libadbd_auth",
Josh Gaofa3605a2020-03-16 11:30:09 -0700402 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700403 "libasyncio",
404 "libbase",
405 "libcrypto",
406 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700407 "liblog",
408 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800409
Shukang Zhou420ad552020-02-13 17:01:39 -0800410 proto: {
411 type: "lite",
412 static: true,
413 export_proto_headers: true,
414 },
415
Josh Gao0560feb2019-01-22 19:36:15 -0800416 target: {
417 android: {
418 whole_static_libs: [
419 "libqemu_pipe",
420 ],
421 srcs: [
422 "daemon/transport_qemu.cpp",
423 "daemon/usb.cpp",
424 "daemon/usb_ffs.cpp",
425 "daemon/usb_legacy.cpp",
426 ]
427 },
428 linux_glibc: {
429 srcs: [
430 "daemon/usb_dummy.cpp",
431 ]
Joshua Duong929364a2020-02-26 15:43:44 -0800432 },
433 recovery: {
434 exclude_shared_libs: [
435 "libadb_pairing_auth",
436 "libadb_pairing_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700437 "libapp_processes_protos_lite",
Joshua Duong929364a2020-02-26 15:43:44 -0800438 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800439 }
440 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700441
442 apex_available: [
443 "//apex_available:platform",
444 "com.android.adbd",
445 ],
446 visibility: [
447 "//bootable/recovery/minadbd",
448 "//system/core/adb",
449 ],
Tao Bao49042e32018-07-30 20:45:27 -0700450}
451
Josh Gao2029a372020-03-09 15:20:55 -0700452cc_library {
Tao Bao49042e32018-07-30 20:45:27 -0700453 name: "libadbd_services",
Josh Gao0560feb2019-01-22 19:36:15 -0800454 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700455 recovery_available: true,
456 compile_multilib: "both",
457
458 srcs: [
459 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700460 "daemon/services.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700461 "daemon/shell_service.cpp",
462 "shell_service_protocol.cpp",
463 ],
464
465 cflags: [
466 "-D_GNU_SOURCE",
467 "-Wno-deprecated-declarations",
468 ],
469
470 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800471 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700472 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800473 "libbrotli",
Tao Bao49042e32018-07-30 20:45:27 -0700474 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700475 ],
476
477 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800478 "libadb_crypto",
479 "libadb_pairing_connection",
480 "libadb_protos",
481 "libadb_tls_connection",
Josh Gao7cac88a2019-10-22 12:30:39 -0700482 "libadbd_auth",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800483 "libadbd_fs",
Josh Gaofa3605a2020-03-16 11:30:09 -0700484 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700485 "libasyncio",
486 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700487 "libcrypto",
488 "libcrypto_utils",
Josh Gao2029a372020-03-09 15:20:55 -0700489 "libcutils_sockets",
Tao Bao49042e32018-07-30 20:45:27 -0700490 "liblog",
Josh Gaofa3605a2020-03-16 11:30:09 -0700491 "libprotobuf-cpp-lite",
Tao Bao49042e32018-07-30 20:45:27 -0700492 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800493
494 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800495 android: {
496 srcs: [
497 "daemon/abb_service.cpp",
498 "daemon/framebuffer_service.cpp",
499 "daemon/mdns.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800500 "daemon/restart_service.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800501 ],
502 shared_libs: [
Josh Gao0560feb2019-01-22 19:36:15 -0800503 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800504 "libselinux",
505 ],
506 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800507 recovery: {
508 exclude_srcs: [
509 "daemon/abb_service.cpp",
510 ],
Joshua Duong929364a2020-02-26 15:43:44 -0800511 exclude_shared_libs: [
512 "libadb_pairing_auth",
513 "libadb_pairing_connection",
514 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800515 },
516 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700517
518 apex_available: [
519 "//apex_available:platform",
520 "com.android.adbd",
521 ],
522 visibility: [
523 "//system/core/adb",
524 ],
525
Tao Bao49042e32018-07-30 20:45:27 -0700526}
527
528cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800529 name: "libadbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800530 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900531 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000532 apex_available: ["com.android.adbd"],
Josh Gao361148b2018-01-02 12:01:43 -0800533
Josh Gaobf5a9362020-01-22 17:58:03 -0800534 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Bao49042e32018-07-30 20:45:27 -0700535 use_version_lib: false,
536
537 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800538 compile_multilib: "both",
Tao Bao49042e32018-07-30 20:45:27 -0700539
Tao Bao49042e32018-07-30 20:45:27 -0700540 whole_static_libs: [
541 "libadbd_core",
Josh Gao361148b2018-01-02 12:01:43 -0800542 ],
543
Tao Bao49042e32018-07-30 20:45:27 -0700544 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700545 "libadbconnection_server",
546 "libapp_processes_protos_lite",
547 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800548 "libadb_crypto",
549 "libadb_pairing_connection",
550 "libadb_tls_connection",
Josh Gao7cac88a2019-10-22 12:30:39 -0700551 "libadbd_auth",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800552 "libadbd_fs",
Josh Gao2029a372020-03-09 15:20:55 -0700553 "libadbd_services",
Josh Gao361148b2018-01-02 12:01:43 -0800554 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800555 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700556 "libcrypto",
557 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700558 "liblog",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800559 "libselinux",
560 ],
561
Joshua Duong929364a2020-02-26 15:43:44 -0800562 target: {
563 recovery: {
564 exclude_shared_libs: [
565 "libadb_pairing_auth",
566 "libadb_pairing_connection",
567 ],
568 }
569 },
570
Josh Gaoa4dfc142020-02-19 13:50:57 -0800571 static_libs: [
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800572 "libbrotli",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800573 "libcutils_sockets",
574 "libdiagnose_usb",
Josh Gao2e24c962020-02-21 16:38:29 -0800575 "libmdnssd",
Josh Gao361148b2018-01-02 12:01:43 -0800576 ],
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700577
578 export_include_dirs: [
579 "daemon/include",
580 ],
Josh Gao361148b2018-01-02 12:01:43 -0800581}
582
583cc_binary {
584 name: "adbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800585 defaults: ["adbd_defaults", "host_adbd_supported"],
Josh Gao06af61e2020-02-03 23:08:05 -0800586 stl: "libc++_static",
Jiyong Parkeb590392018-05-24 14:11:00 +0900587 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000588 apex_available: ["com.android.adbd"],
Josh Gao3e0540a2018-03-06 12:57:27 -0800589
Josh Gao361148b2018-01-02 12:01:43 -0800590 srcs: [
591 "daemon/main.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800592 ],
593
594 cflags: [
595 "-D_GNU_SOURCE",
596 "-Wno-deprecated-declarations",
597 ],
598
599 strip: {
600 keep_symbols: true,
601 },
602
Josh Gao2bfc85e2019-08-15 14:05:12 -0700603 static_libs: [
Joshua Duong929364a2020-02-26 15:43:44 -0800604 "libadb_crypto",
605 "libadb_tls_connection",
Josh Gaobf5a9362020-01-22 17:58:03 -0800606 "libadbconnection_server",
Josh Gao361148b2018-01-02 12:01:43 -0800607 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700608 "libadbd_services",
Shukang Zhou420ad552020-02-13 17:01:39 -0800609 "libapp_processes_protos_lite",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700610 "libasyncio",
Tao Bao49042e32018-07-30 20:45:27 -0700611 "libbase",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800612 "libbrotli",
Tao Bao49042e32018-07-30 20:45:27 -0700613 "libcap",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700614 "libcrypto_utils",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800615 "libcutils_sockets",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700616 "libdiagnose_usb",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700617 "libmdnssd",
Josh Gao361148b2018-01-02 12:01:43 -0800618 "libminijail",
Shukang Zhou420ad552020-02-13 17:01:39 -0800619 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800620 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800621 ],
Josh Gao2bfc85e2019-08-15 14:05:12 -0700622
623 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800624 "libadb_pairing_connection",
625 "libadb_protos",
Josh Gao090712a2020-01-16 12:40:43 -0800626 "libadbd_auth",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800627 "libadbd_fs",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700628 "libcrypto",
Jiyong Parkeaa79502020-03-09 14:35:57 +0900629 "liblog",
Jiyong Park6504d8a2020-03-11 14:00:33 +0900630 "libselinux",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700631 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800632
Joshua Duong929364a2020-02-26 15:43:44 -0800633 target: {
634 recovery: {
635 exclude_shared_libs: [
636 "libadb_pairing_auth",
637 "libadb_pairing_connection",
638 ],
639 }
640 },
641
Josh Gaoa4dfc142020-02-19 13:50:57 -0800642 required: [
643 "libadbd_auth",
644 "libadbd_fs",
645 ],
Josh Gao361148b2018-01-02 12:01:43 -0800646}
647
Josh Gao06e45932019-10-23 13:27:17 -0700648phony {
649 name: "adbd_system_binaries",
650 required: [
651 "abb",
Josh Gao83ce3e22019-10-22 12:30:36 -0700652 "reboot",
Josh Gaob554f4b2019-10-22 12:30:30 -0700653 "set-verity-state",
Josh Gao06e45932019-10-23 13:27:17 -0700654 ]
655}
656
657phony {
658 name: "adbd_system_binaries_recovery",
659 required: [
Josh Gao83ce3e22019-10-22 12:30:36 -0700660 "reboot.recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700661 ],
662}
663
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800664cc_binary {
665 name: "abb",
666
Josh Gao0560feb2019-01-22 19:36:15 -0800667 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800668 stl: "libc++",
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800669 recovery_available: false,
670
671 srcs: [
672 "daemon/abb.cpp",
673 ],
674
675 cflags: [
676 "-D_GNU_SOURCE",
677 "-Wno-deprecated-declarations",
678 ],
679
680 strip: {
681 keep_symbols: true,
682 },
683
684 static_libs: [
685 "libadbd_core",
686 "libadbd_services",
687 "libcmd",
688 ],
689
690 shared_libs: [
691 "libbase",
692 "libbinder",
693 "liblog",
694 "libutils",
695 "libselinux",
696 ],
697}
698
Josh Gao361148b2018-01-02 12:01:43 -0800699cc_test {
700 name: "adbd_test",
Josh Gao06af61e2020-02-03 23:08:05 -0800701
Josh Gao0560feb2019-01-22 19:36:15 -0800702 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800703 stl: "libc++_static",
704
705 recovery_available: false,
Josh Gao361148b2018-01-02 12:01:43 -0800706 srcs: libadb_test_srcs + [
Josh Gao5607e922018-07-25 18:15:52 -0700707 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800708 "daemon/shell_service.cpp",
709 "daemon/shell_service_test.cpp",
710 "shell_service_protocol.cpp",
711 "shell_service_protocol_test.cpp",
712 ],
713
714 static_libs: [
715 "libadbd",
Josh Gao7cac88a2019-10-22 12:30:39 -0700716 "libadbd_auth",
Joshua Duong290ccb52019-11-20 14:18:43 -0800717 "libadb_crypto_static",
718 "libadb_pairing_connection_static",
719 "libadb_tls_connection_static",
Josh Gao361148b2018-01-02 12:01:43 -0800720 "libbase",
Josh Gao361148b2018-01-02 12:01:43 -0800721 "libcrypto_utils",
Colin Crosse1cc1ec2019-09-18 11:04:35 -0700722 "libcrypto_static",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800723 "libcutils_sockets",
Josh Gao361148b2018-01-02 12:01:43 -0800724 "libdiagnose_usb",
725 "liblog",
726 "libusb",
727 "libmdnssd",
Jiyong Park19c39fa2018-05-29 16:41:30 +0900728 "libselinux",
Josh Gao361148b2018-01-02 12:01:43 -0800729 ],
Josh Gao9b06dca2020-01-30 14:49:01 -0800730 test_suites: ["device-tests", "mts"],
Dan Shi22e091b2019-09-24 09:04:05 -0700731 require_root: true,
Josh Gao361148b2018-01-02 12:01:43 -0800732}
733
Julien Desprezae94f512018-08-08 12:08:50 -0700734python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800735 name: "adb_integration_test_adb",
736 main: "test_adb.py",
737 srcs: [
738 "test_adb.py",
739 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700740 test_config: "adb_integration_test_adb.xml",
741 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800742 version: {
743 py2: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700744 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800745 },
746 py3: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700747 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800748 },
GuangHui Liu35994392017-05-10 14:37:17 -0700749 },
GuangHui Liu35994392017-05-10 14:37:17 -0700750}
751
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700752python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800753 name: "adb_integration_test_device",
754 main: "test_device.py",
755 srcs: [
756 "test_device.py",
757 ],
758 libs: [
759 "adb_py",
760 ],
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700761 test_config: "adb_integration_test_device.xml",
762 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800763 version: {
764 py2: {
Josh Gao4218d852020-02-06 17:52:38 -0800765 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800766 },
767 py3: {
Josh Gao4218d852020-02-06 17:52:38 -0800768 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800769 },
GuangHui Liu35994392017-05-10 14:37:17 -0700770 },
GuangHui Liu35994392017-05-10 14:37:17 -0700771}
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700772
773// Note: using pipe for xxd to control the variable name generated
774// the default name used by xxd is the path to the input file.
775java_genrule {
776 name: "bin2c_fastdeployagent",
777 out: ["deployagent.inc"],
778 srcs: [":deployagent"],
779 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
780}
781
782genrule {
783 name: "bin2c_fastdeployagentscript",
784 out: ["deployagentscript.inc"],
785 srcs: ["fastdeploy/deployagent/deployagent.sh"],
786 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
787}
788
789cc_library_host_static {
790 name: "libfastdeploy_host",
791 defaults: ["adb_defaults"],
792 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700793 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700794 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
795 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
796 "fastdeploy/proto/ApkEntry.proto",
797 ],
798 static_libs: [
799 "libadb_host",
800 "libandroidfw",
801 "libbase",
802 "libcutils",
803 "libcrypto_utils",
804 "libcrypto",
805 "libdiagnose_usb",
806 "liblog",
807 "libmdnssd",
808 "libusb",
809 "libutils",
810 "libziparchive",
811 "libz",
812 ],
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700813 proto: {
814 type: "lite",
815 export_proto_headers: true,
816 },
817 target: {
818 windows: {
819 enabled: true,
820 shared_libs: ["AdbWinApi"],
821 },
822 },
823}
824
825cc_test_host {
826 name: "fastdeploy_test",
827 defaults: ["adb_defaults"],
828 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700829 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700830 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
831 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
832 ],
833 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800834 "libadb_crypto_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700835 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800836 "libadb_pairing_auth_static",
837 "libadb_pairing_connection_static",
838 "libadb_protos_static",
839 "libadb_tls_connection_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700840 "libandroidfw",
841 "libbase",
842 "libcutils",
843 "libcrypto_utils",
844 "libcrypto",
845 "libdiagnose_usb",
846 "libfastdeploy_host",
847 "liblog",
848 "libmdnssd",
849 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800850 "libssl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700851 "libusb",
852 "libutils",
853 "libziparchive",
854 "libz",
855 ],
856 target: {
857 windows: {
858 enabled: true,
859 shared_libs: ["AdbWinApi"],
860 },
861 },
862 data: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700863 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700864 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700865 "fastdeploy/testdata/sample.apk",
866 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700867 ],
868}