blob: dee48bf80f7e0c8b734d5c897d43ec1ce43963df [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 Gao36fb6752020-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",
116 "libbrotli",
117 "libcutils_sockets",
118 "libdiagnose_usb",
119 "libmdnssd",
120 "libbase",
121
122 "libadb_protos",
123 ],
124
125 shared_libs: [
126 "libadbd_auth",
127 "libadbd_fs",
128 "libcrypto",
129 "libcrypto_utils",
130 "liblog",
131 "libselinux",
132 ],
133
134 target: {
135 recovery: {
136 exclude_static_libs: [
137 "libadb_pairing_auth",
138 "libadb_pairing_connection",
139 ],
140 },
141 },
142}
143
Josh Gao27768452018-01-02 12:01:43 -0800144// libadb
145// =========================================================
146// These files are compiled for both the host and the device.
147libadb_srcs = [
148 "adb.cpp",
149 "adb_io.cpp",
150 "adb_listeners.cpp",
151 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700152 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800153 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700154 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700155 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800156 "services.cpp",
157 "sockets.cpp",
158 "socket_spec.cpp",
159 "sysdeps/errno.cpp",
160 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700161 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800162 "transport_local.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700163 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800164]
165
166libadb_posix_srcs = [
167 "sysdeps_unix.cpp",
168 "sysdeps/posix/network.cpp",
169]
170
Josh Gaob43ad442019-07-11 13:47:44 -0700171libadb_linux_srcs = [
172 "fdevent/fdevent_epoll.cpp",
173]
174
Josh Gao27768452018-01-02 12:01:43 -0800175libadb_test_srcs = [
176 "adb_io_test.cpp",
177 "adb_listeners_test.cpp",
178 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700179 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800180 "socket_spec_test.cpp",
181 "socket_test.cpp",
182 "sysdeps_test.cpp",
183 "sysdeps/stat_test.cpp",
184 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700185 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800186]
187
188cc_library_host_static {
189 name: "libadb_host",
190 defaults: ["adb_defaults"],
191
192 srcs: libadb_srcs + [
193 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800194 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800195 "client/usb_libusb.cpp",
196 "client/usb_dispatch.cpp",
197 "client/transport_mdns.cpp",
Josh Gao27831222020-03-27 18:09:56 -0700198 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800199 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800200 ],
201
Dan Willemsenab971b52018-08-29 14:58:02 -0700202 generated_headers: ["platform_tools_version"],
203
Josh Gao27768452018-01-02 12:01:43 -0800204 target: {
205 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700206 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800207 },
208 darwin: {
209 srcs: ["client/usb_osx.cpp"],
210 },
Josh Gao27768452018-01-02 12:01:43 -0800211 not_windows: {
212 srcs: libadb_posix_srcs,
213 },
214 windows: {
215 enabled: true,
216 srcs: [
217 "client/usb_windows.cpp",
218 "sysdeps_win32.cpp",
219 "sysdeps/win32/errno.cpp",
220 "sysdeps/win32/stat.cpp",
221 ],
222 shared_libs: ["AdbWinApi"],
223 },
224 },
225
226 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800227 "libadb_crypto",
228 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800229 "libadb_pairing_connection",
230 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800231 "libbase",
232 "libcrypto_utils",
233 "libcrypto",
234 "libdiagnose_usb",
235 "libmdnssd",
236 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100237 "libutils",
238 "liblog",
239 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800240 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800241 ],
242}
243
244cc_test_host {
245 name: "adb_test",
246 defaults: ["adb_defaults"],
247 srcs: libadb_test_srcs,
248 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800249 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800250 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800251 "libadb_pairing_auth_static",
252 "libadb_pairing_connection_static",
253 "libadb_protos_static",
254 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800255 "libbase",
256 "libcutils",
257 "libcrypto_utils",
258 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800259 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800260 "libmdnssd",
261 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800262 "libprotobuf-cpp-lite",
263 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800264 "libusb",
265 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700266
267 target: {
268 windows: {
269 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700270 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700271 shared_libs: ["AdbWinApi"],
272 },
273 },
Josh Gao27768452018-01-02 12:01:43 -0800274}
275
276cc_binary_host {
277 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800278
Josh Gao99522582020-02-03 23:08:05 -0800279 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800280 defaults: ["adb_defaults"],
281
282 srcs: [
283 "client/adb_client.cpp",
284 "client/bugreport.cpp",
285 "client/commandline.cpp",
286 "client/file_sync_client.cpp",
287 "client/main.cpp",
288 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000289 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800290 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700291 "client/fastdeploy.cpp",
292 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800293 "client/incremental.cpp",
294 "client/incremental_server.cpp",
Songchun Fan8cdefd42020-03-13 13:11:43 -0700295 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800296 "shell_service_protocol.cpp",
297 ],
298
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700299 generated_headers: [
300 "bin2c_fastdeployagent",
301 "bin2c_fastdeployagentscript"
302 ],
303
Josh Gao27768452018-01-02 12:01:43 -0800304 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800305 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800306 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800307 "libadb_pairing_auth",
308 "libadb_pairing_connection",
309 "libadb_protos",
310 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700311 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800312 "libbase",
Josh Gao50ab0a62020-03-04 19:34:08 -0800313 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800314 "libcutils",
315 "libcrypto_utils",
316 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700317 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800318 "libdiagnose_usb",
319 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800320 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800321 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700322 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800323 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800324 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100325 "libutils",
326 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700327 "libziparchive",
328 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800329 ],
330
Josh Gao27768452018-01-02 12:01:43 -0800331 // Don't add anything here, we don't want additional shared dependencies
332 // on the host adb tool, and shared libraries that link against libc++
333 // will violate ODR
334 shared_libs: [],
335
Dan Willemsen3f439a72018-11-19 19:11:35 -0800336 // Archive adb, adb.exe.
337 dist: {
338 targets: [
339 "dist_files",
340 "sdk",
341 "win_sdk",
342 ],
343 },
344
Josh Gao27768452018-01-02 12:01:43 -0800345 target: {
346 darwin: {
347 cflags: [
348 "-Wno-sizeof-pointer-memaccess",
349 ],
350 },
351 windows: {
352 enabled: true,
353 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800354 shared_libs: ["AdbWinApi"],
355 required: [
356 "AdbWinUsbApi",
357 ],
358 },
359 },
360}
361
Tao Baoeca59ae2018-07-30 20:45:27 -0700362// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800363cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700364 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800365 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700366 recovery_available: true,
367
368 // libminadbd wants both, as it's used to build native tests.
369 compile_multilib: "both",
370
Josh Gaob43ad442019-07-11 13:47:44 -0700371 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700372 "daemon/auth.cpp",
373 "daemon/jdwp_service.cpp",
Josh Gaobbe33852020-02-26 16:39:20 -0800374 "daemon/logging.cpp",
Josh Gao3467ef42020-02-21 16:38:29 -0800375 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700376 ],
377
Dan Willemsenab971b52018-08-29 14:58:02 -0700378 generated_headers: ["platform_tools_version"],
379
Tao Baoeca59ae2018-07-30 20:45:27 -0700380 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800381 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700382 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700383 ],
384
385 shared_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800386 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800387 "libadb_pairing_connection",
388 "libadb_protos",
389 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700390 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700391 "libasyncio",
392 "libbase",
393 "libcrypto",
394 "libcrypto_utils",
Josh Gao36fb6752020-03-27 19:41:59 -0700395 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700396 "liblog",
397 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800398
399 target: {
400 android: {
401 whole_static_libs: [
402 "libqemu_pipe",
403 ],
404 srcs: [
405 "daemon/transport_qemu.cpp",
406 "daemon/usb.cpp",
407 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800408 ]
Joshua Duongcaca3a92020-02-26 15:43:44 -0800409 },
410 recovery: {
411 exclude_shared_libs: [
412 "libadb_pairing_auth",
413 "libadb_pairing_connection",
414 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800415 }
416 },
Josh Gaod11e67d2020-03-16 12:48:18 -0700417
418 apex_available: [
419 "//apex_available:platform",
420 "com.android.adbd",
421 ],
422 visibility: [
423 "//bootable/recovery/minadbd",
424 "//system/core/adb",
425 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700426}
427
Josh Gaod1ee5082020-03-09 15:20:55 -0700428cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700429 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800430 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700431 recovery_available: true,
432 compile_multilib: "both",
433
434 srcs: [
435 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700436 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700437 "daemon/shell_service.cpp",
438 "shell_service_protocol.cpp",
439 ],
440
441 cflags: [
442 "-D_GNU_SOURCE",
443 "-Wno-deprecated-declarations",
444 ],
445
446 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800447 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700448 "libadbd_core",
Josh Gao50ab0a62020-03-04 19:34:08 -0800449 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700450 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700451 ],
452
453 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800454 "libadb_crypto",
455 "libadb_pairing_connection",
456 "libadb_protos",
457 "libadb_tls_connection",
Tao Baoeca59ae2018-07-30 20:45:27 -0700458 "libasyncio",
459 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700460 "libcrypto_utils",
Josh Gaod1ee5082020-03-09 15:20:55 -0700461 "libcutils_sockets",
Josh Gao36fb6752020-03-27 19:41:59 -0700462
463 // APEX dependencies.
464 "libadbd_auth",
465 "libadbd_fs",
466 "libcrypto",
Tao Baoeca59ae2018-07-30 20:45:27 -0700467 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700468 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800469
470 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800471 android: {
472 srcs: [
473 "daemon/abb_service.cpp",
474 "daemon/framebuffer_service.cpp",
475 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800476 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800477 ],
478 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800479 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800480 "libselinux",
481 ],
482 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800483 recovery: {
484 exclude_srcs: [
485 "daemon/abb_service.cpp",
486 ],
Joshua Duongcaca3a92020-02-26 15:43:44 -0800487 exclude_shared_libs: [
488 "libadb_pairing_auth",
489 "libadb_pairing_connection",
490 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800491 },
492 },
Josh Gaod11e67d2020-03-16 12:48:18 -0700493
494 apex_available: [
495 "//apex_available:platform",
496 "com.android.adbd",
497 ],
498 visibility: [
499 "//system/core/adb",
500 ],
501
Tao Baoeca59ae2018-07-30 20:45:27 -0700502}
503
504cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800505 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800506 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900507 recovery_available: true,
Jiyong Park137fb1f2020-03-10 18:31:02 +0900508 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800509
Josh Gaobb7fc922020-01-22 17:58:03 -0800510 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700511 use_version_lib: false,
512
513 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800514 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700515
Tao Baoeca59ae2018-07-30 20:45:27 -0700516 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800517 "libadb_crypto",
518 "libadb_pairing_connection",
519 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800520 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800521 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700522 "libcrypto",
523 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700524 "liblog",
Josh Gaob5778c12020-02-19 13:50:57 -0800525 "libselinux",
Josh Gao36fb6752020-03-27 19:41:59 -0700526
527 // APEX dependencies on the system image.
528 "libadbd_auth",
529 "libadbd_fs",
530 "libadbd_services",
Josh Gaob5778c12020-02-19 13:50:57 -0800531 ],
532
Joshua Duongcaca3a92020-02-26 15:43:44 -0800533 target: {
534 recovery: {
535 exclude_shared_libs: [
536 "libadb_pairing_auth",
537 "libadb_pairing_connection",
538 ],
539 }
540 },
541
Josh Gaob5778c12020-02-19 13:50:57 -0800542 static_libs: [
Josh Gao36fb6752020-03-27 19:41:59 -0700543 "libadbd_core",
Josh Gao50ab0a62020-03-04 19:34:08 -0800544 "libbrotli",
Josh Gaob5778c12020-02-19 13:50:57 -0800545 "libcutils_sockets",
546 "libdiagnose_usb",
Josh Gao3467ef42020-02-21 16:38:29 -0800547 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800548 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700549
Josh Gao27831222020-03-27 18:09:56 -0700550 visibility: [
551 "//bootable/recovery/minadbd",
552 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700553 ],
Josh Gao27768452018-01-02 12:01:43 -0800554}
555
556cc_binary {
557 name: "adbd",
Josh Gao36fb6752020-03-27 19:41:59 -0700558 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900559 recovery_available: true,
Jiyong Park137fb1f2020-03-10 18:31:02 +0900560 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800561
Josh Gao27768452018-01-02 12:01:43 -0800562 srcs: [
563 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800564 ],
565
566 cflags: [
567 "-D_GNU_SOURCE",
568 "-Wno-deprecated-declarations",
569 ],
570
571 strip: {
572 keep_symbols: true,
573 },
574
Josh Gao594f70f2019-08-15 14:05:12 -0700575 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800576 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700577 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700578 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700579 "libcap",
Josh Gao27768452018-01-02 12:01:43 -0800580 "libminijail",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800581 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800582 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700583
584 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800585 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800586 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700587 ],
Josh Gao99522582020-02-03 23:08:05 -0800588
Joshua Duongcaca3a92020-02-26 15:43:44 -0800589 target: {
590 recovery: {
591 exclude_shared_libs: [
592 "libadb_pairing_auth",
593 "libadb_pairing_connection",
594 ],
595 }
596 },
Josh Gao27768452018-01-02 12:01:43 -0800597}
598
Josh Gao7b7ee192019-10-23 13:27:17 -0700599phony {
Josh Gao0217d522020-06-01 18:59:21 -0700600 // Interface between adbd in a module and the system.
601 name: "adbd_system_api",
Josh Gao7b7ee192019-10-23 13:27:17 -0700602 required: [
Josh Gao0217d522020-06-01 18:59:21 -0700603 "libadbd_auth",
604 "libadbd_fs",
Josh Gao7b7ee192019-10-23 13:27:17 -0700605 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700606 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700607 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700608 ]
609}
610
611phony {
Josh Gao0217d522020-06-01 18:59:21 -0700612 name: "adbd_system_api_recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700613 required: [
Josh Gao0217d522020-06-01 18:59:21 -0700614 "libadbd_auth",
615 "libadbd_fs",
Josh Gao2c356bb2019-10-22 12:30:36 -0700616 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700617 ],
618}
619
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800620cc_binary {
621 name: "abb",
622
Josh Gao776c2ec2019-01-22 19:36:15 -0800623 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800624 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800625 recovery_available: false,
626
627 srcs: [
628 "daemon/abb.cpp",
629 ],
630
631 cflags: [
632 "-D_GNU_SOURCE",
633 "-Wno-deprecated-declarations",
634 ],
635
636 strip: {
637 keep_symbols: true,
638 },
639
640 static_libs: [
641 "libadbd_core",
642 "libadbd_services",
643 "libcmd",
644 ],
645
646 shared_libs: [
647 "libbase",
648 "libbinder",
649 "liblog",
650 "libutils",
651 "libselinux",
652 ],
653}
654
Josh Gao27768452018-01-02 12:01:43 -0800655cc_test {
656 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800657
Josh Gao36fb6752020-03-27 19:41:59 -0700658 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800659
660 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800661 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700662 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800663 "daemon/shell_service.cpp",
664 "daemon/shell_service_test.cpp",
665 "shell_service_protocol.cpp",
666 "shell_service_protocol_test.cpp",
Joshua Duongaa0b7292020-04-16 15:58:19 -0700667 "mdns_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800668 ],
669
Chen Zhu5daea5a2020-05-08 16:45:11 -0700670 test_config: "adb_test.xml",
671
Josh Gao36fb6752020-03-27 19:41:59 -0700672 shared_libs: [
673 "liblog",
674 ],
675
Josh Gao27768452018-01-02 12:01:43 -0800676 static_libs: [
677 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700678 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800679 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800680 "libcrypto_utils",
Josh Gao27768452018-01-02 12:01:43 -0800681 "libusb",
Josh Gao27768452018-01-02 12:01:43 -0800682 ],
Josh Gao7e015872020-01-30 14:49:01 -0800683 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700684 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800685}
686
Julien Desprez75fea7e2018-08-08 12:08:50 -0700687python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800688 name: "adb_integration_test_adb",
689 main: "test_adb.py",
690 srcs: [
691 "test_adb.py",
692 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700693 test_config: "adb_integration_test_adb.xml",
694 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800695 version: {
696 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700697 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800698 },
699 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700700 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800701 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700702 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700703}
704
Julien Desprez618f0e12018-10-12 13:48:14 -0700705python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800706 name: "adb_integration_test_device",
707 main: "test_device.py",
708 srcs: [
709 "test_device.py",
710 ],
711 libs: [
712 "adb_py",
713 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700714 test_config: "adb_integration_test_device.xml",
715 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800716 version: {
717 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800718 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800719 },
720 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800721 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800722 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700723 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700724}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700725
726// Note: using pipe for xxd to control the variable name generated
727// the default name used by xxd is the path to the input file.
728java_genrule {
729 name: "bin2c_fastdeployagent",
730 out: ["deployagent.inc"],
731 srcs: [":deployagent"],
732 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
733}
734
735genrule {
736 name: "bin2c_fastdeployagentscript",
737 out: ["deployagentscript.inc"],
738 srcs: ["fastdeploy/deployagent/deployagent.sh"],
739 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
740}
741
742cc_library_host_static {
743 name: "libfastdeploy_host",
744 defaults: ["adb_defaults"],
745 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700746 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700747 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
748 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
749 "fastdeploy/proto/ApkEntry.proto",
750 ],
751 static_libs: [
752 "libadb_host",
753 "libandroidfw",
754 "libbase",
755 "libcutils",
756 "libcrypto_utils",
757 "libcrypto",
758 "libdiagnose_usb",
759 "liblog",
760 "libmdnssd",
761 "libusb",
762 "libutils",
763 "libziparchive",
764 "libz",
765 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700766 proto: {
767 type: "lite",
768 export_proto_headers: true,
769 },
770 target: {
771 windows: {
772 enabled: true,
773 shared_libs: ["AdbWinApi"],
774 },
775 },
776}
777
778cc_test_host {
779 name: "fastdeploy_test",
780 defaults: ["adb_defaults"],
781 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700782 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700783 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
784 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
785 ],
786 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800787 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700788 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800789 "libadb_pairing_auth_static",
790 "libadb_pairing_connection_static",
791 "libadb_protos_static",
792 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700793 "libandroidfw",
794 "libbase",
795 "libcutils",
796 "libcrypto_utils",
797 "libcrypto",
798 "libdiagnose_usb",
799 "libfastdeploy_host",
800 "liblog",
801 "libmdnssd",
802 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800803 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700804 "libusb",
805 "libutils",
806 "libziparchive",
807 "libz",
808 ],
809 target: {
810 windows: {
811 enabled: true,
812 shared_libs: ["AdbWinApi"],
813 },
814 },
815 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700816 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700817 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700818 "fastdeploy/testdata/sample.apk",
819 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700820 ],
821}