blob: 2fc205faed502ad402f85bebd0e0742943876133 [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
Josh Gao27768452018-01-02 12:01:43 -080015cc_defaults {
16 name: "adb_defaults",
17
18 cflags: [
19 "-Wall",
20 "-Wextra",
21 "-Werror",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070022 "-Wexit-time-destructors",
Josh Gao27768452018-01-02 12:01:43 -080023 "-Wno-unused-parameter",
24 "-Wno-missing-field-initializers",
Josh Gao776c2ec2019-01-22 19:36:15 -080025 "-Wthread-safety",
Josh Gao27768452018-01-02 12:01:43 -080026 "-Wvla",
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080027 "-DADB_HOST=1", // overridden by adbd_defaults
Josh Gao27241a72019-04-25 14:04:57 -070028 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao27768452018-01-02 12:01:43 -080029 ],
Josh Gao6eb78822018-11-16 15:40:16 -080030 cpp_std: "experimental",
Josh Gao27768452018-01-02 12:01:43 -080031
Josh Gaoc7567fa2018-02-27 15:49:23 -080032 use_version_lib: true,
Josh Gao27768452018-01-02 12:01:43 -080033 compile_multilib: "first",
Josh Gao27768452018-01-02 12:01:43 -080034
35 target: {
Josh Gao27768452018-01-02 12:01:43 -080036 darwin: {
37 host_ldlibs: [
38 "-lpthread",
39 "-framework CoreFoundation",
40 "-framework IOKit",
41 "-lobjc",
42 ],
43 },
44
45 windows: {
46 cflags: [
47 // Define windows.h and tchar.h Unicode preprocessor symbols so that
48 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
49 // build if you accidentally pass char*. Fix by calling like:
50 // std::wstring path_wide;
51 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
52 // CreateFileW(path_wide.c_str());
53 "-DUNICODE=1",
54 "-D_UNICODE=1",
55
Elliott Hughes3c59cb82018-12-03 09:02:18 -080056 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao27768452018-01-02 12:01:43 -080057 "-D_GNU_SOURCE",
Josh Gao2e1e7892018-03-23 13:03:28 -070058
59 // MinGW hides some things behind _POSIX_SOURCE.
60 "-D_POSIX_SOURCE",
Josh Gao776c2ec2019-01-22 19:36:15 -080061
Josh Gao4710e532019-04-17 16:57:43 -070062 // libusb uses __stdcall on a variadic function, which gets ignored.
63 "-Wno-ignored-attributes",
64
Josh Gao776c2ec2019-01-22 19:36:15 -080065 // Not supported yet.
66 "-Wno-thread-safety",
Josh Gao27768452018-01-02 12:01:43 -080067 ],
Josh Gaof8a97c12018-03-23 15:37:20 -070068
69 host_ldlibs: [
70 "-lws2_32",
71 "-lgdi32",
72 "-luserenv",
73 ],
Josh Gao27768452018-01-02 12:01:43 -080074 },
Josh Gao776c2ec2019-01-22 19:36:15 -080075 },
76}
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070077
Josh Gao776c2ec2019-01-22 19:36:15 -080078cc_defaults {
79 name: "adbd_defaults",
80 defaults: ["adb_defaults"],
81
82 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
Josh Gao27768452018-01-02 12:01:43 -080083}
84
Josh Gao776c2ec2019-01-22 19:36:15 -080085cc_defaults {
86 name: "host_adbd_supported",
87
88 host_supported: true,
89 target: {
90 linux: {
91 enabled: true,
92 host_ldlibs: [
93 "-lresolv", // b64_pton
94 "-lutil", // forkpty
95 ],
96 },
97 darwin: {
98 enabled: false,
99 },
100 windows: {
101 enabled: false,
102 },
103 },
104}
105
Josh Gao37356142020-03-27 19:41:59 -0700106cc_defaults {
107 name: "libadbd_binary_dependencies",
108 static_libs: [
109 "libadb_crypto",
110 "libadb_pairing_connection",
111 "libadb_tls_connection",
112 "libadbd",
113 "libadbd_core",
114 "libadbconnection_server",
115 "libasyncio",
Josh Gao317d3e12020-05-27 17:52:52 -0700116 "libbase",
Josh Gao37356142020-03-27 19:41:59 -0700117 "libbrotli",
118 "libcutils_sockets",
119 "libdiagnose_usb",
120 "libmdnssd",
Josh Gao317d3e12020-05-27 17:52:52 -0700121 "libzstd",
Josh Gao37356142020-03-27 19:41:59 -0700122
123 "libadb_protos",
124 "libapp_processes_protos_lite",
125 "libprotobuf-cpp-lite",
126 ],
127
128 shared_libs: [
129 "libadbd_auth",
130 "libadbd_fs",
131 "libcrypto",
132 "libcrypto_utils",
133 "liblog",
134 "libselinux",
135 ],
136
137 target: {
138 recovery: {
139 exclude_static_libs: [
140 "libadb_pairing_auth",
141 "libadb_pairing_connection",
142 ],
143 },
144 },
145}
146
Josh Gao27768452018-01-02 12:01:43 -0800147// libadb
148// =========================================================
149// These files are compiled for both the host and the device.
150libadb_srcs = [
151 "adb.cpp",
152 "adb_io.cpp",
153 "adb_listeners.cpp",
154 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700155 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800156 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700157 "fdevent/fdevent.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800158 "services.cpp",
159 "sockets.cpp",
160 "socket_spec.cpp",
161 "sysdeps/errno.cpp",
162 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700163 "transport_fd.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700164 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800165]
166
Josh Gao073c8d22020-04-20 19:22:05 -0700167libadb_darwin_srcs = [
168 "fdevent/fdevent_poll.cpp",
169]
170
171libadb_windows_srcs = [
172 "fdevent/fdevent_poll.cpp",
173 "sysdeps_win32.cpp",
174 "sysdeps/win32/errno.cpp",
175 "sysdeps/win32/stat.cpp",
176]
177
Josh Gao27768452018-01-02 12:01:43 -0800178libadb_posix_srcs = [
179 "sysdeps_unix.cpp",
180 "sysdeps/posix/network.cpp",
181]
182
Josh Gaob43ad442019-07-11 13:47:44 -0700183libadb_linux_srcs = [
184 "fdevent/fdevent_epoll.cpp",
185]
186
Josh Gao27768452018-01-02 12:01:43 -0800187libadb_test_srcs = [
188 "adb_io_test.cpp",
189 "adb_listeners_test.cpp",
190 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700191 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800192 "socket_spec_test.cpp",
193 "socket_test.cpp",
194 "sysdeps_test.cpp",
195 "sysdeps/stat_test.cpp",
196 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700197 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800198]
199
200cc_library_host_static {
201 name: "libadb_host",
202 defaults: ["adb_defaults"],
203
204 srcs: libadb_srcs + [
205 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800206 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800207 "client/usb_libusb.cpp",
208 "client/usb_dispatch.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700209 "client/transport_local.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800210 "client/transport_mdns.cpp",
Joshua Duong7be85192020-04-30 15:45:38 -0700211 "client/mdns_utils.cpp",
Josh Gao08718242020-03-27 18:09:56 -0700212 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800213 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800214 ],
215
Dan Willemsenab971b52018-08-29 14:58:02 -0700216 generated_headers: ["platform_tools_version"],
217
Josh Gao27768452018-01-02 12:01:43 -0800218 target: {
219 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700220 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800221 },
222 darwin: {
Josh Gao073c8d22020-04-20 19:22:05 -0700223 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800224 },
Josh Gao27768452018-01-02 12:01:43 -0800225 not_windows: {
226 srcs: libadb_posix_srcs,
227 },
228 windows: {
229 enabled: true,
230 srcs: [
231 "client/usb_windows.cpp",
Josh Gao073c8d22020-04-20 19:22:05 -0700232 ] + libadb_windows_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800233 shared_libs: ["AdbWinApi"],
234 },
235 },
236
237 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800238 "libadb_crypto",
239 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800240 "libadb_pairing_connection",
241 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800242 "libbase",
243 "libcrypto_utils",
244 "libcrypto",
245 "libdiagnose_usb",
246 "libmdnssd",
247 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100248 "libutils",
249 "liblog",
250 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800251 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800252 ],
253}
254
255cc_test_host {
256 name: "adb_test",
257 defaults: ["adb_defaults"],
Joshua Duong7be85192020-04-30 15:45:38 -0700258 srcs: libadb_test_srcs + [
259 "client/mdns_utils_test.cpp",
260 ],
261
Josh Gao27768452018-01-02 12:01:43 -0800262 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800263 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800264 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800265 "libadb_pairing_auth_static",
266 "libadb_pairing_connection_static",
267 "libadb_protos_static",
268 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800269 "libbase",
270 "libcutils",
271 "libcrypto_utils",
272 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800273 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800274 "libmdnssd",
275 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800276 "libprotobuf-cpp-lite",
277 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800278 "libusb",
279 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700280
281 target: {
282 windows: {
283 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700284 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700285 shared_libs: ["AdbWinApi"],
286 },
287 },
Josh Gao27768452018-01-02 12:01:43 -0800288}
289
290cc_binary_host {
291 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800292
Josh Gao99522582020-02-03 23:08:05 -0800293 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800294 defaults: ["adb_defaults"],
295
296 srcs: [
297 "client/adb_client.cpp",
298 "client/bugreport.cpp",
299 "client/commandline.cpp",
300 "client/file_sync_client.cpp",
301 "client/main.cpp",
302 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000303 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800304 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700305 "client/fastdeploy.cpp",
306 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800307 "client/incremental.cpp",
308 "client/incremental_server.cpp",
Songchun Fanc3eb3012020-03-13 13:11:43 -0700309 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800310 "shell_service_protocol.cpp",
311 ],
312
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700313 generated_headers: [
314 "bin2c_fastdeployagent",
315 "bin2c_fastdeployagentscript"
316 ],
317
Josh Gao27768452018-01-02 12:01:43 -0800318 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800319 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800320 "libadb_host",
Josh Gao31d42aa2020-03-26 13:46:08 -0700321 "libadb_pairing_auth",
322 "libadb_pairing_connection",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800323 "libadb_protos",
324 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700325 "libandroidfw",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800326 "libapp_processes_protos_full",
Josh Gao27768452018-01-02 12:01:43 -0800327 "libbase",
Josh Gao939fc192020-03-04 19:34:08 -0800328 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800329 "libcutils",
330 "libcrypto_utils",
331 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700332 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800333 "libdiagnose_usb",
334 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800335 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800336 "libmdnssd",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800337 "libprotobuf-cpp-full",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800338 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800339 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100340 "libutils",
341 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700342 "libziparchive",
343 "libz",
Josh Gao317d3e12020-05-27 17:52:52 -0700344 "libzstd",
Josh Gao27768452018-01-02 12:01:43 -0800345 ],
346
Josh Gao27768452018-01-02 12:01:43 -0800347 // Don't add anything here, we don't want additional shared dependencies
348 // on the host adb tool, and shared libraries that link against libc++
349 // will violate ODR
350 shared_libs: [],
351
Dan Willemsen3f439a72018-11-19 19:11:35 -0800352 // Archive adb, adb.exe.
353 dist: {
354 targets: [
355 "dist_files",
356 "sdk",
357 "win_sdk",
358 ],
359 },
360
Josh Gao27768452018-01-02 12:01:43 -0800361 target: {
362 darwin: {
363 cflags: [
364 "-Wno-sizeof-pointer-memaccess",
365 ],
366 },
367 windows: {
368 enabled: true,
369 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800370 shared_libs: ["AdbWinApi"],
371 required: [
372 "AdbWinUsbApi",
373 ],
374 },
375 },
376}
377
Tao Baoeca59ae2018-07-30 20:45:27 -0700378// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800379cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700380 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800381 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700382 recovery_available: true,
383
384 // libminadbd wants both, as it's used to build native tests.
385 compile_multilib: "both",
386
Josh Gaob43ad442019-07-11 13:47:44 -0700387 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gao8a9277a2020-04-22 17:30:06 -0700388 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700389 "daemon/auth.cpp",
390 "daemon/jdwp_service.cpp",
Josh Gao52d0b672020-02-26 16:39:20 -0800391 "daemon/logging.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700392 "daemon/transport_local.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700393 ],
394
Dan Willemsenab971b52018-08-29 14:58:02 -0700395 generated_headers: ["platform_tools_version"],
396
Tao Baoeca59ae2018-07-30 20:45:27 -0700397 static_libs: [
398 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700399 ],
400
401 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700402 "libadbconnection_server",
Joshua Duongef28ca42019-12-19 16:36:30 -0800403 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800404 "libadb_pairing_connection",
405 "libadb_protos",
406 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700407 "libadbd_auth",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700408 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700409 "libasyncio",
410 "libbase",
411 "libcrypto",
412 "libcrypto_utils",
Josh Gao37356142020-03-27 19:41:59 -0700413 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700414 "liblog",
415 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800416
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800417 proto: {
418 type: "lite",
419 static: true,
420 export_proto_headers: true,
421 },
422
Josh Gao776c2ec2019-01-22 19:36:15 -0800423 target: {
424 android: {
425 whole_static_libs: [
426 "libqemu_pipe",
427 ],
428 srcs: [
429 "daemon/transport_qemu.cpp",
430 "daemon/usb.cpp",
431 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800432 ]
Joshua Duong0f53d172020-02-26 15:43:44 -0800433 },
434 recovery: {
435 exclude_shared_libs: [
436 "libadb_pairing_auth",
437 "libadb_pairing_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700438 "libapp_processes_protos_lite",
Joshua Duong0f53d172020-02-26 15:43:44 -0800439 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800440 }
441 },
Josh Gaob5673032020-03-16 12:48:18 -0700442
443 apex_available: [
444 "//apex_available:platform",
445 "com.android.adbd",
446 ],
447 visibility: [
448 "//bootable/recovery/minadbd",
449 "//system/core/adb",
450 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700451}
452
Josh Gao7f8a37c2020-03-09 15:20:55 -0700453cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700454 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800455 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700456 recovery_available: true,
457 compile_multilib: "both",
458
459 srcs: [
460 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700461 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700462 "daemon/shell_service.cpp",
463 "shell_service_protocol.cpp",
464 ],
465
466 cflags: [
467 "-D_GNU_SOURCE",
468 "-Wno-deprecated-declarations",
469 ],
470
471 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800472 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700473 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800474 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700475 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700476 "liblz4",
Josh Gao317d3e12020-05-27 17:52:52 -0700477 "libzstd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700478 ],
479
480 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800481 "libadb_crypto",
482 "libadb_pairing_connection",
483 "libadb_protos",
484 "libadb_tls_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700485 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700486 "libasyncio",
487 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700488 "libcrypto_utils",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700489 "libcutils_sockets",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700490 "libprotobuf-cpp-lite",
Josh Gao37356142020-03-27 19:41:59 -0700491
492 // APEX dependencies.
493 "libadbd_auth",
494 "libadbd_fs",
495 "libcrypto",
496 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700497 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800498
499 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800500 android: {
501 srcs: [
502 "daemon/abb_service.cpp",
503 "daemon/framebuffer_service.cpp",
504 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800505 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800506 ],
507 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800508 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800509 "libselinux",
510 ],
511 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800512 recovery: {
513 exclude_srcs: [
514 "daemon/abb_service.cpp",
515 ],
Joshua Duong0f53d172020-02-26 15:43:44 -0800516 exclude_shared_libs: [
517 "libadb_pairing_auth",
518 "libadb_pairing_connection",
519 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800520 },
521 },
Josh Gaob5673032020-03-16 12:48:18 -0700522
523 apex_available: [
524 "//apex_available:platform",
525 "com.android.adbd",
526 ],
527 visibility: [
528 "//system/core/adb",
529 ],
530
Tao Baoeca59ae2018-07-30 20:45:27 -0700531}
532
533cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800534 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800535 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900536 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000537 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800538
Josh Gaobb7fc922020-01-22 17:58:03 -0800539 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700540 use_version_lib: false,
541
542 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800543 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700544
Tao Baoeca59ae2018-07-30 20:45:27 -0700545 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700546 "libadbconnection_server",
547 "libapp_processes_protos_lite",
548 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800549 "libadb_crypto",
550 "libadb_pairing_connection",
551 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800552 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800553 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700554 "libcrypto",
555 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700556 "liblog",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800557 "libselinux",
Josh Gao37356142020-03-27 19:41:59 -0700558
559 // APEX dependencies on the system image.
560 "libadbd_auth",
561 "libadbd_fs",
562 "libadbd_services",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800563 ],
564
Joshua Duong0f53d172020-02-26 15:43:44 -0800565 target: {
566 recovery: {
567 exclude_shared_libs: [
568 "libadb_pairing_auth",
569 "libadb_pairing_connection",
570 ],
571 }
572 },
573
Josh Gaoa9b62d52020-02-19 13:50:57 -0800574 static_libs: [
Josh Gao37356142020-03-27 19:41:59 -0700575 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800576 "libbrotli",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800577 "libcutils_sockets",
578 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700579 "liblz4",
Josh Gao6d949e82020-02-21 16:38:29 -0800580 "libmdnssd",
Josh Gao317d3e12020-05-27 17:52:52 -0700581 "libzstd",
Josh Gao27768452018-01-02 12:01:43 -0800582 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700583
Josh Gao08718242020-03-27 18:09:56 -0700584 visibility: [
585 "//bootable/recovery/minadbd",
586 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700587 ],
Josh Gao27768452018-01-02 12:01:43 -0800588}
589
590cc_binary {
591 name: "adbd",
Josh Gao37356142020-03-27 19:41:59 -0700592 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900593 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000594 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800595
Josh Gao27768452018-01-02 12:01:43 -0800596 srcs: [
597 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800598 ],
599
600 cflags: [
601 "-D_GNU_SOURCE",
602 "-Wno-deprecated-declarations",
603 ],
604
605 strip: {
606 keep_symbols: true,
607 },
608
Josh Gao594f70f2019-08-15 14:05:12 -0700609 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800610 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700611 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700612 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700613 "libcap",
Josh Gaoec44d352020-03-26 22:02:03 -0700614 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800615 "libminijail",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800616 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800617 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700618
619 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800620 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800621 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700622 ],
Josh Gao99522582020-02-03 23:08:05 -0800623
Joshua Duong0f53d172020-02-26 15:43:44 -0800624 target: {
625 recovery: {
626 exclude_shared_libs: [
627 "libadb_pairing_auth",
628 "libadb_pairing_connection",
629 ],
630 }
631 },
Josh Gao27768452018-01-02 12:01:43 -0800632}
633
Josh Gao7b7ee192019-10-23 13:27:17 -0700634phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700635 // Interface between adbd in a module and the system.
636 name: "adbd_system_api",
Josh Gao7b7ee192019-10-23 13:27:17 -0700637 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700638 "libadbd_auth",
639 "libadbd_fs",
Josh Gao7b7ee192019-10-23 13:27:17 -0700640 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700641 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700642 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700643 ]
644}
645
646phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700647 name: "adbd_system_api_recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700648 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700649 "libadbd_auth",
650 "libadbd_fs",
Josh Gao2c356bb2019-10-22 12:30:36 -0700651 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700652 ],
653}
654
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800655cc_binary {
656 name: "abb",
657
Josh Gao776c2ec2019-01-22 19:36:15 -0800658 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800659 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800660 recovery_available: false,
661
662 srcs: [
663 "daemon/abb.cpp",
664 ],
665
666 cflags: [
667 "-D_GNU_SOURCE",
668 "-Wno-deprecated-declarations",
669 ],
670
671 strip: {
672 keep_symbols: true,
673 },
674
675 static_libs: [
676 "libadbd_core",
677 "libadbd_services",
678 "libcmd",
679 ],
680
681 shared_libs: [
682 "libbase",
683 "libbinder",
684 "liblog",
685 "libutils",
686 "libselinux",
687 ],
688}
689
Josh Gao27768452018-01-02 12:01:43 -0800690cc_test {
691 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800692
Josh Gao37356142020-03-27 19:41:59 -0700693 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800694
695 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800696 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700697 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800698 "daemon/shell_service.cpp",
699 "daemon/shell_service_test.cpp",
700 "shell_service_protocol.cpp",
701 "shell_service_protocol_test.cpp",
Joshua Duong81f2db42020-04-16 15:58:19 -0700702 "mdns_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800703 ],
704
Josh Gao37356142020-03-27 19:41:59 -0700705 shared_libs: [
706 "liblog",
707 ],
708
Josh Gao27768452018-01-02 12:01:43 -0800709 static_libs: [
710 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700711 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800712 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800713 "libcrypto_utils",
Josh Gao27768452018-01-02 12:01:43 -0800714 "libusb",
Josh Gao27768452018-01-02 12:01:43 -0800715 ],
Josh Gao7e015872020-01-30 14:49:01 -0800716 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700717 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800718}
719
Julien Desprez75fea7e2018-08-08 12:08:50 -0700720python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800721 name: "adb_integration_test_adb",
722 main: "test_adb.py",
723 srcs: [
724 "test_adb.py",
725 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700726 test_config: "adb_integration_test_adb.xml",
727 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800728 version: {
729 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700730 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800731 },
732 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700733 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800734 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700735 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700736}
737
Julien Desprez618f0e12018-10-12 13:48:14 -0700738python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800739 name: "adb_integration_test_device",
740 main: "test_device.py",
741 srcs: [
742 "test_device.py",
743 ],
744 libs: [
745 "adb_py",
746 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700747 test_config: "adb_integration_test_device.xml",
748 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800749 version: {
750 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800751 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800752 },
753 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800754 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800755 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700756 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700757}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700758
759// Note: using pipe for xxd to control the variable name generated
760// the default name used by xxd is the path to the input file.
761java_genrule {
762 name: "bin2c_fastdeployagent",
763 out: ["deployagent.inc"],
764 srcs: [":deployagent"],
765 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
766}
767
768genrule {
769 name: "bin2c_fastdeployagentscript",
770 out: ["deployagentscript.inc"],
771 srcs: ["fastdeploy/deployagent/deployagent.sh"],
772 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
773}
774
775cc_library_host_static {
776 name: "libfastdeploy_host",
777 defaults: ["adb_defaults"],
778 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700779 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700780 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
781 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
782 "fastdeploy/proto/ApkEntry.proto",
783 ],
784 static_libs: [
785 "libadb_host",
786 "libandroidfw",
787 "libbase",
788 "libcutils",
789 "libcrypto_utils",
790 "libcrypto",
791 "libdiagnose_usb",
792 "liblog",
793 "libmdnssd",
794 "libusb",
795 "libutils",
796 "libziparchive",
797 "libz",
798 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700799 proto: {
800 type: "lite",
801 export_proto_headers: true,
802 },
803 target: {
804 windows: {
805 enabled: true,
806 shared_libs: ["AdbWinApi"],
807 },
808 },
809}
810
811cc_test_host {
812 name: "fastdeploy_test",
813 defaults: ["adb_defaults"],
814 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700815 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700816 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
817 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
818 ],
819 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800820 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700821 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800822 "libadb_pairing_auth_static",
823 "libadb_pairing_connection_static",
824 "libadb_protos_static",
825 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700826 "libandroidfw",
827 "libbase",
828 "libcutils",
829 "libcrypto_utils",
830 "libcrypto",
831 "libdiagnose_usb",
832 "libfastdeploy_host",
833 "liblog",
834 "libmdnssd",
835 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800836 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700837 "libusb",
838 "libutils",
839 "libziparchive",
840 "libz",
841 ],
842 target: {
843 windows: {
844 enabled: true,
845 shared_libs: ["AdbWinApi"],
846 },
847 },
848 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700849 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700850 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700851 "fastdeploy/testdata/sample.apk",
852 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700853 ],
854}