blob: df2c0f9652418b469e4289e118658f7eb71bc96e [file] [log] [blame]
GuangHui Liu41bda342017-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
Joshua Duong89169a32020-07-17 14:14:00 -070015tidy_errors = [
16 "-*",
17 "bugprone-inaccurate-erase",
18]
19
Josh Gao27768452018-01-02 12:01:43 -080020cc_defaults {
21 name: "adb_defaults",
22
23 cflags: [
24 "-Wall",
25 "-Wextra",
26 "-Werror",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070027 "-Wexit-time-destructors",
Josh Gao27768452018-01-02 12:01:43 -080028 "-Wno-unused-parameter",
29 "-Wno-missing-field-initializers",
Josh Gao776c2ec2019-01-22 19:36:15 -080030 "-Wthread-safety",
Josh Gao27768452018-01-02 12:01:43 -080031 "-Wvla",
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080032 "-DADB_HOST=1", // overridden by adbd_defaults
Josh Gao27241a72019-04-25 14:04:57 -070033 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao27768452018-01-02 12:01:43 -080034 ],
Josh Gao6eb78822018-11-16 15:40:16 -080035 cpp_std: "experimental",
Josh Gao27768452018-01-02 12:01:43 -080036
Josh Gaoc7567fa2018-02-27 15:49:23 -080037 use_version_lib: true,
Josh Gao27768452018-01-02 12:01:43 -080038 compile_multilib: "first",
Josh Gao27768452018-01-02 12:01:43 -080039
40 target: {
Josh Gao27768452018-01-02 12:01:43 -080041 darwin: {
42 host_ldlibs: [
43 "-lpthread",
44 "-framework CoreFoundation",
45 "-framework IOKit",
46 "-lobjc",
47 ],
48 },
49
50 windows: {
51 cflags: [
52 // Define windows.h and tchar.h Unicode preprocessor symbols so that
53 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
54 // build if you accidentally pass char*. Fix by calling like:
55 // std::wstring path_wide;
56 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
57 // CreateFileW(path_wide.c_str());
58 "-DUNICODE=1",
59 "-D_UNICODE=1",
60
Elliott Hughes3c59cb82018-12-03 09:02:18 -080061 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao27768452018-01-02 12:01:43 -080062 "-D_GNU_SOURCE",
Josh Gao2e1e7892018-03-23 13:03:28 -070063
64 // MinGW hides some things behind _POSIX_SOURCE.
65 "-D_POSIX_SOURCE",
Josh Gao776c2ec2019-01-22 19:36:15 -080066
Josh Gao4710e532019-04-17 16:57:43 -070067 // libusb uses __stdcall on a variadic function, which gets ignored.
68 "-Wno-ignored-attributes",
69
Josh Gao776c2ec2019-01-22 19:36:15 -080070 // Not supported yet.
71 "-Wno-thread-safety",
Josh Gao27768452018-01-02 12:01:43 -080072 ],
Josh Gaof8a97c12018-03-23 15:37:20 -070073
74 host_ldlibs: [
75 "-lws2_32",
76 "-lgdi32",
77 "-luserenv",
78 ],
Josh Gao27768452018-01-02 12:01:43 -080079 },
Josh Gao776c2ec2019-01-22 19:36:15 -080080 },
Joshua Duong89169a32020-07-17 14:14:00 -070081
82 tidy: true,
83 tidy_checks: tidy_errors,
84 tidy_checks_as_errors: tidy_errors,
Josh Gao776c2ec2019-01-22 19:36:15 -080085}
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070086
Josh Gao776c2ec2019-01-22 19:36:15 -080087cc_defaults {
88 name: "adbd_defaults",
89 defaults: ["adb_defaults"],
90
91 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
Josh Gao27768452018-01-02 12:01:43 -080092}
93
Josh Gao776c2ec2019-01-22 19:36:15 -080094cc_defaults {
95 name: "host_adbd_supported",
96
97 host_supported: true,
98 target: {
99 linux: {
100 enabled: true,
101 host_ldlibs: [
102 "-lresolv", // b64_pton
103 "-lutil", // forkpty
104 ],
105 },
106 darwin: {
107 enabled: false,
108 },
109 windows: {
110 enabled: false,
111 },
112 },
113}
114
Josh Gao37356142020-03-27 19:41:59 -0700115cc_defaults {
116 name: "libadbd_binary_dependencies",
117 static_libs: [
118 "libadb_crypto",
119 "libadb_pairing_connection",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700120 "libadb_sysdeps",
Josh Gao37356142020-03-27 19:41:59 -0700121 "libadb_tls_connection",
122 "libadbd",
123 "libadbd_core",
124 "libadbconnection_server",
125 "libasyncio",
Josh Gao317d3e12020-05-27 17:52:52 -0700126 "libbase",
Josh Gao37356142020-03-27 19:41:59 -0700127 "libbrotli",
128 "libcutils_sockets",
129 "libdiagnose_usb",
130 "libmdnssd",
Josh Gao317d3e12020-05-27 17:52:52 -0700131 "libzstd",
Josh Gao37356142020-03-27 19:41:59 -0700132
133 "libadb_protos",
134 "libapp_processes_protos_lite",
135 "libprotobuf-cpp-lite",
136 ],
137
138 shared_libs: [
139 "libadbd_auth",
140 "libadbd_fs",
141 "libcrypto",
142 "libcrypto_utils",
143 "liblog",
144 "libselinux",
145 ],
146
147 target: {
148 recovery: {
149 exclude_static_libs: [
150 "libadb_pairing_auth",
151 "libadb_pairing_connection",
152 ],
153 },
154 },
155}
156
Josh Gao27768452018-01-02 12:01:43 -0800157// libadb
158// =========================================================
159// These files are compiled for both the host and the device.
160libadb_srcs = [
161 "adb.cpp",
162 "adb_io.cpp",
163 "adb_listeners.cpp",
164 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700165 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800166 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700167 "fdevent/fdevent.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800168 "services.cpp",
169 "sockets.cpp",
170 "socket_spec.cpp",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700171 "sysdeps/env.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800172 "sysdeps/errno.cpp",
173 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700174 "transport_fd.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700175 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800176]
177
Josh Gao073c8d22020-04-20 19:22:05 -0700178libadb_darwin_srcs = [
179 "fdevent/fdevent_poll.cpp",
180]
181
182libadb_windows_srcs = [
183 "fdevent/fdevent_poll.cpp",
184 "sysdeps_win32.cpp",
185 "sysdeps/win32/errno.cpp",
186 "sysdeps/win32/stat.cpp",
187]
188
Josh Gao27768452018-01-02 12:01:43 -0800189libadb_posix_srcs = [
190 "sysdeps_unix.cpp",
191 "sysdeps/posix/network.cpp",
192]
193
Josh Gaob43ad442019-07-11 13:47:44 -0700194libadb_linux_srcs = [
195 "fdevent/fdevent_epoll.cpp",
196]
197
Josh Gao27768452018-01-02 12:01:43 -0800198libadb_test_srcs = [
199 "adb_io_test.cpp",
200 "adb_listeners_test.cpp",
201 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700202 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800203 "socket_spec_test.cpp",
204 "socket_test.cpp",
205 "sysdeps_test.cpp",
206 "sysdeps/stat_test.cpp",
207 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700208 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800209]
210
211cc_library_host_static {
212 name: "libadb_host",
213 defaults: ["adb_defaults"],
214
215 srcs: libadb_srcs + [
216 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800217 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800218 "client/usb_libusb.cpp",
219 "client/usb_dispatch.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700220 "client/transport_local.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800221 "client/transport_mdns.cpp",
Joshua Duong7be85192020-04-30 15:45:38 -0700222 "client/mdns_utils.cpp",
Josh Gao08718242020-03-27 18:09:56 -0700223 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800224 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800225 ],
226
Dan Willemsenab971b52018-08-29 14:58:02 -0700227 generated_headers: ["platform_tools_version"],
228
Josh Gao27768452018-01-02 12:01:43 -0800229 target: {
230 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700231 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800232 },
233 darwin: {
Josh Gao073c8d22020-04-20 19:22:05 -0700234 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800235 },
Josh Gao27768452018-01-02 12:01:43 -0800236 not_windows: {
237 srcs: libadb_posix_srcs,
238 },
239 windows: {
240 enabled: true,
241 srcs: [
242 "client/usb_windows.cpp",
Josh Gao073c8d22020-04-20 19:22:05 -0700243 ] + libadb_windows_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800244 shared_libs: ["AdbWinApi"],
245 },
246 },
247
248 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800249 "libadb_crypto",
250 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800251 "libadb_pairing_connection",
252 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800253 "libbase",
254 "libcrypto_utils",
255 "libcrypto",
256 "libdiagnose_usb",
257 "libmdnssd",
258 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100259 "libutils",
260 "liblog",
261 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800262 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800263 ],
264}
265
Joshua Duong62a42ec2020-07-30 16:34:29 -0700266cc_library {
267 name: "libadb_sysdeps",
268 defaults: ["adb_defaults"],
269 recovery_available: true,
270 host_supported: true,
271 compile_multilib: "both",
272 min_sdk_version: "apex_inherit",
Jiyong Park4c575962020-08-25 17:05:41 +0900273 // This library doesn't use build::GetBuildNumber()
274 use_version_lib: false,
Joshua Duong62a42ec2020-07-30 16:34:29 -0700275
276 srcs: [
277 "sysdeps/env.cpp",
278 ],
279
280 shared_libs: [
281 "libbase",
282 "liblog",
283 ],
284
285 target: {
286 windows: {
287 enabled: true,
288 ldflags: ["-municode"],
289 },
290 },
291
292 export_include_dirs: ["."],
293
294 visibility: [
295 "//system/core/adb:__subpackages__",
296 "//bootable/recovery/minadbd:__subpackages__",
297 ],
298
299 apex_available: [
300 "com.android.adbd",
301 "test_com.android.adbd",
302 ],
303}
304
Josh Gao27768452018-01-02 12:01:43 -0800305cc_test_host {
306 name: "adb_test",
307 defaults: ["adb_defaults"],
Joshua Duong7be85192020-04-30 15:45:38 -0700308 srcs: libadb_test_srcs + [
309 "client/mdns_utils_test.cpp",
310 ],
311
Josh Gao27768452018-01-02 12:01:43 -0800312 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800313 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800314 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800315 "libadb_pairing_auth_static",
316 "libadb_pairing_connection_static",
317 "libadb_protos_static",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700318 "libadb_sysdeps",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800319 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800320 "libbase",
321 "libcutils",
322 "libcrypto_utils",
323 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800324 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800325 "libmdnssd",
326 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800327 "libprotobuf-cpp-lite",
328 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800329 "libusb",
330 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700331
332 target: {
333 windows: {
334 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700335 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700336 shared_libs: ["AdbWinApi"],
337 },
338 },
Josh Gao27768452018-01-02 12:01:43 -0800339}
340
341cc_binary_host {
342 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800343
Josh Gao99522582020-02-03 23:08:05 -0800344 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800345 defaults: ["adb_defaults"],
346
347 srcs: [
348 "client/adb_client.cpp",
349 "client/bugreport.cpp",
350 "client/commandline.cpp",
351 "client/file_sync_client.cpp",
352 "client/main.cpp",
353 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000354 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800355 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700356 "client/fastdeploy.cpp",
357 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800358 "client/incremental.cpp",
359 "client/incremental_server.cpp",
Songchun Fanc3eb3012020-03-13 13:11:43 -0700360 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800361 "shell_service_protocol.cpp",
362 ],
363
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700364 generated_headers: [
365 "bin2c_fastdeployagent",
366 "bin2c_fastdeployagentscript"
367 ],
368
Josh Gao27768452018-01-02 12:01:43 -0800369 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800370 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800371 "libadb_host",
Josh Gao31d42aa2020-03-26 13:46:08 -0700372 "libadb_pairing_auth",
373 "libadb_pairing_connection",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800374 "libadb_protos",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700375 "libadb_sysdeps",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800376 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700377 "libandroidfw",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800378 "libapp_processes_protos_full",
Josh Gao27768452018-01-02 12:01:43 -0800379 "libbase",
Josh Gao939fc192020-03-04 19:34:08 -0800380 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800381 "libcutils",
382 "libcrypto_utils",
383 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700384 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800385 "libdiagnose_usb",
386 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800387 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800388 "libmdnssd",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800389 "libprotobuf-cpp-full",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800390 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800391 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100392 "libutils",
393 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700394 "libziparchive",
395 "libz",
Josh Gao317d3e12020-05-27 17:52:52 -0700396 "libzstd",
Josh Gao27768452018-01-02 12:01:43 -0800397 ],
398
Josh Gao27768452018-01-02 12:01:43 -0800399 // Don't add anything here, we don't want additional shared dependencies
400 // on the host adb tool, and shared libraries that link against libc++
401 // will violate ODR
402 shared_libs: [],
403
Dan Willemsen3f439a72018-11-19 19:11:35 -0800404 // Archive adb, adb.exe.
405 dist: {
406 targets: [
407 "dist_files",
408 "sdk",
409 "win_sdk",
410 ],
411 },
412
Josh Gao27768452018-01-02 12:01:43 -0800413 target: {
414 darwin: {
415 cflags: [
416 "-Wno-sizeof-pointer-memaccess",
417 ],
418 },
419 windows: {
420 enabled: true,
421 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800422 shared_libs: ["AdbWinApi"],
423 required: [
424 "AdbWinUsbApi",
425 ],
426 },
427 },
428}
429
Tao Baoeca59ae2018-07-30 20:45:27 -0700430// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800431cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700432 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800433 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700434 recovery_available: true,
435
436 // libminadbd wants both, as it's used to build native tests.
437 compile_multilib: "both",
438
Josh Gaob43ad442019-07-11 13:47:44 -0700439 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gao8a9277a2020-04-22 17:30:06 -0700440 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700441 "daemon/auth.cpp",
442 "daemon/jdwp_service.cpp",
Josh Gao52d0b672020-02-26 16:39:20 -0800443 "daemon/logging.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700444 "daemon/transport_local.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700445 ],
446
Dan Willemsenab971b52018-08-29 14:58:02 -0700447 generated_headers: ["platform_tools_version"],
448
Tao Baoeca59ae2018-07-30 20:45:27 -0700449 static_libs: [
450 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700451 ],
452
453 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700454 "libadbconnection_server",
Joshua Duongef28ca42019-12-19 16:36:30 -0800455 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800456 "libadb_pairing_connection",
457 "libadb_protos",
458 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700459 "libadbd_auth",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700460 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700461 "libasyncio",
462 "libbase",
463 "libcrypto",
464 "libcrypto_utils",
Josh Gao37356142020-03-27 19:41:59 -0700465 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700466 "liblog",
467 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800468
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800469 proto: {
470 type: "lite",
471 static: true,
472 export_proto_headers: true,
473 },
474
Josh Gao776c2ec2019-01-22 19:36:15 -0800475 target: {
476 android: {
477 whole_static_libs: [
478 "libqemu_pipe",
479 ],
480 srcs: [
481 "daemon/transport_qemu.cpp",
482 "daemon/usb.cpp",
483 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800484 ]
Joshua Duong0f53d172020-02-26 15:43:44 -0800485 },
486 recovery: {
487 exclude_shared_libs: [
488 "libadb_pairing_auth",
489 "libadb_pairing_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700490 "libapp_processes_protos_lite",
Joshua Duong0f53d172020-02-26 15:43:44 -0800491 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800492 }
493 },
Josh Gaob5673032020-03-16 12:48:18 -0700494
495 apex_available: [
496 "//apex_available:platform",
497 "com.android.adbd",
498 ],
499 visibility: [
500 "//bootable/recovery/minadbd",
501 "//system/core/adb",
502 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700503}
504
Josh Gao7f8a37c2020-03-09 15:20:55 -0700505cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700506 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800507 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700508 recovery_available: true,
509 compile_multilib: "both",
510
511 srcs: [
512 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700513 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700514 "daemon/shell_service.cpp",
515 "shell_service_protocol.cpp",
516 ],
517
518 cflags: [
519 "-D_GNU_SOURCE",
520 "-Wno-deprecated-declarations",
521 ],
522
523 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800524 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700525 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800526 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700527 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700528 "liblz4",
Josh Gao317d3e12020-05-27 17:52:52 -0700529 "libzstd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700530 ],
531
532 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800533 "libadb_crypto",
534 "libadb_pairing_connection",
535 "libadb_protos",
536 "libadb_tls_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700537 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700538 "libasyncio",
539 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700540 "libcrypto_utils",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700541 "libcutils_sockets",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700542 "libprotobuf-cpp-lite",
Josh Gao37356142020-03-27 19:41:59 -0700543
544 // APEX dependencies.
545 "libadbd_auth",
546 "libadbd_fs",
547 "libcrypto",
548 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700549 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800550
551 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800552 android: {
553 srcs: [
554 "daemon/abb_service.cpp",
555 "daemon/framebuffer_service.cpp",
556 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800557 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800558 ],
559 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800560 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800561 "libselinux",
562 ],
563 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800564 recovery: {
565 exclude_srcs: [
566 "daemon/abb_service.cpp",
567 ],
Joshua Duong0f53d172020-02-26 15:43:44 -0800568 exclude_shared_libs: [
569 "libadb_pairing_auth",
570 "libadb_pairing_connection",
571 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800572 },
573 },
Josh Gaob5673032020-03-16 12:48:18 -0700574
575 apex_available: [
576 "//apex_available:platform",
577 "com.android.adbd",
578 ],
579 visibility: [
580 "//system/core/adb",
581 ],
582
Tao Baoeca59ae2018-07-30 20:45:27 -0700583}
584
585cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800586 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800587 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900588 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000589 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800590
Josh Gaobb7fc922020-01-22 17:58:03 -0800591 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700592 use_version_lib: false,
593
594 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800595 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700596
Tao Baoeca59ae2018-07-30 20:45:27 -0700597 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700598 "libadbconnection_server",
599 "libapp_processes_protos_lite",
600 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800601 "libadb_crypto",
602 "libadb_pairing_connection",
603 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800604 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800605 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700606 "libcrypto",
607 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700608 "liblog",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800609 "libselinux",
Josh Gao37356142020-03-27 19:41:59 -0700610
611 // APEX dependencies on the system image.
612 "libadbd_auth",
613 "libadbd_fs",
614 "libadbd_services",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800615 ],
616
Joshua Duong0f53d172020-02-26 15:43:44 -0800617 target: {
618 recovery: {
619 exclude_shared_libs: [
620 "libadb_pairing_auth",
621 "libadb_pairing_connection",
622 ],
623 }
624 },
625
Josh Gaoa9b62d52020-02-19 13:50:57 -0800626 static_libs: [
Josh Gao37356142020-03-27 19:41:59 -0700627 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800628 "libbrotli",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800629 "libcutils_sockets",
630 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700631 "liblz4",
Josh Gao6d949e82020-02-21 16:38:29 -0800632 "libmdnssd",
Josh Gao317d3e12020-05-27 17:52:52 -0700633 "libzstd",
Josh Gao27768452018-01-02 12:01:43 -0800634 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700635
Josh Gao08718242020-03-27 18:09:56 -0700636 visibility: [
637 "//bootable/recovery/minadbd",
638 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700639 ],
Josh Gao27768452018-01-02 12:01:43 -0800640}
641
642cc_binary {
643 name: "adbd",
Josh Gao37356142020-03-27 19:41:59 -0700644 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900645 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000646 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800647
Josh Gao27768452018-01-02 12:01:43 -0800648 srcs: [
649 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800650 ],
651
652 cflags: [
653 "-D_GNU_SOURCE",
654 "-Wno-deprecated-declarations",
655 ],
656
657 strip: {
658 keep_symbols: true,
659 },
660
Josh Gao594f70f2019-08-15 14:05:12 -0700661 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800662 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700663 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700664 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700665 "libcap",
Josh Gaoec44d352020-03-26 22:02:03 -0700666 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800667 "libminijail",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800668 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800669 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700670
671 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800672 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800673 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700674 ],
Josh Gao99522582020-02-03 23:08:05 -0800675
Joshua Duong0f53d172020-02-26 15:43:44 -0800676 target: {
677 recovery: {
678 exclude_shared_libs: [
679 "libadb_pairing_auth",
680 "libadb_pairing_connection",
681 ],
682 }
683 },
Josh Gao27768452018-01-02 12:01:43 -0800684}
685
Josh Gao7b7ee192019-10-23 13:27:17 -0700686phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700687 // Interface between adbd in a module and the system.
688 name: "adbd_system_api",
Josh Gao7b7ee192019-10-23 13:27:17 -0700689 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700690 "libadbd_auth",
691 "libadbd_fs",
Josh Gao7b7ee192019-10-23 13:27:17 -0700692 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700693 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700694 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700695 ]
696}
697
698phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700699 name: "adbd_system_api_recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700700 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700701 "libadbd_auth",
702 "libadbd_fs",
Josh Gao2c356bb2019-10-22 12:30:36 -0700703 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700704 ],
705}
706
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800707cc_binary {
708 name: "abb",
709
Josh Gao776c2ec2019-01-22 19:36:15 -0800710 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800711 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800712 recovery_available: false,
713
714 srcs: [
715 "daemon/abb.cpp",
716 ],
717
718 cflags: [
719 "-D_GNU_SOURCE",
720 "-Wno-deprecated-declarations",
721 ],
722
723 strip: {
724 keep_symbols: true,
725 },
726
727 static_libs: [
728 "libadbd_core",
729 "libadbd_services",
730 "libcmd",
731 ],
732
733 shared_libs: [
734 "libbase",
735 "libbinder",
736 "liblog",
737 "libutils",
738 "libselinux",
739 ],
740}
741
Josh Gao27768452018-01-02 12:01:43 -0800742cc_test {
743 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800744
Josh Gao37356142020-03-27 19:41:59 -0700745 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800746
747 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800748 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700749 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800750 "daemon/shell_service.cpp",
751 "daemon/shell_service_test.cpp",
752 "shell_service_protocol.cpp",
753 "shell_service_protocol_test.cpp",
Joshua Duong81f2db42020-04-16 15:58:19 -0700754 "mdns_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800755 ],
756
Chen Zhu5daea5a2020-05-08 16:45:11 -0700757 test_config: "adb_test.xml",
758
Josh Gao37356142020-03-27 19:41:59 -0700759 shared_libs: [
760 "liblog",
761 ],
762
Josh Gao27768452018-01-02 12:01:43 -0800763 static_libs: [
764 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700765 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800766 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800767 "libcrypto_utils",
Josh Gao27768452018-01-02 12:01:43 -0800768 "libusb",
Josh Gao27768452018-01-02 12:01:43 -0800769 ],
Josh Gao7e015872020-01-30 14:49:01 -0800770 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700771 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800772}
773
Julien Desprez75fea7e2018-08-08 12:08:50 -0700774python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800775 name: "adb_integration_test_adb",
776 main: "test_adb.py",
777 srcs: [
778 "test_adb.py",
779 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700780 test_config: "adb_integration_test_adb.xml",
781 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800782 version: {
783 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700784 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800785 },
786 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700787 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800788 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700789 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700790}
791
Julien Desprez618f0e12018-10-12 13:48:14 -0700792python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800793 name: "adb_integration_test_device",
794 main: "test_device.py",
795 srcs: [
796 "test_device.py",
797 ],
798 libs: [
799 "adb_py",
800 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700801 test_config: "adb_integration_test_device.xml",
802 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800803 version: {
804 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800805 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800806 },
807 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800808 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800809 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700810 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700811}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700812
813// Note: using pipe for xxd to control the variable name generated
814// the default name used by xxd is the path to the input file.
815java_genrule {
816 name: "bin2c_fastdeployagent",
817 out: ["deployagent.inc"],
818 srcs: [":deployagent"],
819 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
820}
821
822genrule {
823 name: "bin2c_fastdeployagentscript",
824 out: ["deployagentscript.inc"],
825 srcs: ["fastdeploy/deployagent/deployagent.sh"],
826 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
827}
828
829cc_library_host_static {
830 name: "libfastdeploy_host",
831 defaults: ["adb_defaults"],
832 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700833 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700834 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
835 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
836 "fastdeploy/proto/ApkEntry.proto",
837 ],
838 static_libs: [
839 "libadb_host",
840 "libandroidfw",
841 "libbase",
842 "libcutils",
843 "libcrypto_utils",
844 "libcrypto",
845 "libdiagnose_usb",
846 "liblog",
847 "libmdnssd",
848 "libusb",
849 "libutils",
850 "libziparchive",
851 "libz",
852 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700853 proto: {
854 type: "lite",
855 export_proto_headers: true,
856 },
857 target: {
858 windows: {
859 enabled: true,
860 shared_libs: ["AdbWinApi"],
861 },
862 },
863}
864
865cc_test_host {
866 name: "fastdeploy_test",
867 defaults: ["adb_defaults"],
868 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700869 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700870 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
871 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
872 ],
873 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800874 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700875 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800876 "libadb_pairing_auth_static",
877 "libadb_pairing_connection_static",
878 "libadb_protos_static",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700879 "libadb_sysdeps",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800880 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700881 "libandroidfw",
882 "libbase",
883 "libcutils",
884 "libcrypto_utils",
885 "libcrypto",
886 "libdiagnose_usb",
887 "libfastdeploy_host",
888 "liblog",
889 "libmdnssd",
890 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800891 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700892 "libusb",
893 "libutils",
894 "libziparchive",
895 "libz",
896 ],
897 target: {
898 windows: {
899 enabled: true,
900 shared_libs: ["AdbWinApi"],
901 },
902 },
903 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700904 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700905 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700906 "fastdeploy/testdata/sample.apk",
907 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700908 ],
909}