blob: f8e5b38e3cae06cf1ab1e24ca1e836ca6d4fb6fc [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
28 "-DALLOW_ADBD_ROOT=0", // overridden by adbd_defaults
Josh Gao27241a72019-04-25 14:04:57 -070029 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao27768452018-01-02 12:01:43 -080030 ],
Josh Gao6eb78822018-11-16 15:40:16 -080031 cpp_std: "experimental",
Josh Gao27768452018-01-02 12:01:43 -080032
Josh Gaoc7567fa2018-02-27 15:49:23 -080033 use_version_lib: true,
Josh Gao27768452018-01-02 12:01:43 -080034 compile_multilib: "first",
Josh Gao27768452018-01-02 12:01:43 -080035
36 target: {
Josh Gao27768452018-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 Hughes3c59cb82018-12-03 09:02:18 -080057 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao27768452018-01-02 12:01:43 -080058 "-D_GNU_SOURCE",
Josh Gao2e1e7892018-03-23 13:03:28 -070059
60 // MinGW hides some things behind _POSIX_SOURCE.
61 "-D_POSIX_SOURCE",
Josh Gao776c2ec2019-01-22 19:36:15 -080062
Josh Gao4710e532019-04-17 16:57:43 -070063 // libusb uses __stdcall on a variadic function, which gets ignored.
64 "-Wno-ignored-attributes",
65
Josh Gao776c2ec2019-01-22 19:36:15 -080066 // Not supported yet.
67 "-Wno-thread-safety",
Josh Gao27768452018-01-02 12:01:43 -080068 ],
Josh Gaof8a97c12018-03-23 15:37:20 -070069
70 host_ldlibs: [
71 "-lws2_32",
72 "-lgdi32",
73 "-luserenv",
74 ],
Josh Gao27768452018-01-02 12:01:43 -080075 },
Josh Gao776c2ec2019-01-22 19:36:15 -080076 },
77}
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070078
Josh Gao776c2ec2019-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 Nainar79821782018-06-01 11:31:38 -070086 cflags: [
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080087 "-UALLOW_ADBD_ROOT",
88 "-DALLOW_ADBD_ROOT=1",
Josh Gao776c2ec2019-01-22 19:36:15 -080089 "-DALLOW_ADBD_DISABLE_VERITY",
90 "-DALLOW_ADBD_NO_AUTH",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070091 ],
92 },
Josh Gao27768452018-01-02 12:01:43 -080093 },
94}
95
Josh Gao776c2ec2019-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 Gao36fb6752020-03-27 19:41:59 -0700117cc_defaults {
118 name: "libadbd_binary_dependencies",
119 static_libs: [
120 "libadb_crypto",
121 "libadb_pairing_connection",
122 "libadb_tls_connection",
123 "libadbd",
124 "libadbd_core",
125 "libadbconnection_server",
126 "libasyncio",
127 "libbrotli",
128 "libcutils_sockets",
129 "libdiagnose_usb",
130 "libmdnssd",
131 "libbase",
132
133 "libadb_protos",
134 ],
135
136 shared_libs: [
137 "libadbd_auth",
138 "libadbd_fs",
139 "libcrypto",
140 "libcrypto_utils",
141 "liblog",
142 "libselinux",
143 ],
144
145 target: {
146 recovery: {
147 exclude_static_libs: [
148 "libadb_pairing_auth",
149 "libadb_pairing_connection",
150 ],
151 },
152 },
153}
154
Josh Gao27768452018-01-02 12:01:43 -0800155// libadb
156// =========================================================
157// These files are compiled for both the host and the device.
158libadb_srcs = [
159 "adb.cpp",
160 "adb_io.cpp",
161 "adb_listeners.cpp",
162 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700163 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800164 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700165 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700166 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800167 "services.cpp",
168 "sockets.cpp",
169 "socket_spec.cpp",
170 "sysdeps/errno.cpp",
171 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700172 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800173 "transport_local.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700174 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800175]
176
177libadb_posix_srcs = [
178 "sysdeps_unix.cpp",
179 "sysdeps/posix/network.cpp",
180]
181
Josh Gaob43ad442019-07-11 13:47:44 -0700182libadb_linux_srcs = [
183 "fdevent/fdevent_epoll.cpp",
184]
185
Josh Gao27768452018-01-02 12:01:43 -0800186libadb_test_srcs = [
187 "adb_io_test.cpp",
188 "adb_listeners_test.cpp",
189 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700190 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800191 "socket_spec_test.cpp",
192 "socket_test.cpp",
193 "sysdeps_test.cpp",
194 "sysdeps/stat_test.cpp",
195 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700196 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800197]
198
199cc_library_host_static {
200 name: "libadb_host",
201 defaults: ["adb_defaults"],
202
203 srcs: libadb_srcs + [
204 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800205 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800206 "client/usb_libusb.cpp",
207 "client/usb_dispatch.cpp",
208 "client/transport_mdns.cpp",
Josh Gao27831222020-03-27 18:09:56 -0700209 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800210 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800211 ],
212
Dan Willemsenab971b52018-08-29 14:58:02 -0700213 generated_headers: ["platform_tools_version"],
214
Josh Gao27768452018-01-02 12:01:43 -0800215 target: {
216 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700217 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800218 },
219 darwin: {
220 srcs: ["client/usb_osx.cpp"],
221 },
Josh Gao27768452018-01-02 12:01:43 -0800222 not_windows: {
223 srcs: libadb_posix_srcs,
224 },
225 windows: {
226 enabled: true,
227 srcs: [
228 "client/usb_windows.cpp",
229 "sysdeps_win32.cpp",
230 "sysdeps/win32/errno.cpp",
231 "sysdeps/win32/stat.cpp",
232 ],
233 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"],
258 srcs: libadb_test_srcs,
259 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800260 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800261 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800262 "libadb_pairing_auth_static",
263 "libadb_pairing_connection_static",
264 "libadb_protos_static",
265 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800266 "libbase",
267 "libcutils",
268 "libcrypto_utils",
269 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800270 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800271 "libmdnssd",
272 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800273 "libprotobuf-cpp-lite",
274 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800275 "libusb",
276 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700277
278 target: {
279 windows: {
280 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700281 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700282 shared_libs: ["AdbWinApi"],
283 },
284 },
Josh Gao27768452018-01-02 12:01:43 -0800285}
286
287cc_binary_host {
288 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800289
Josh Gao99522582020-02-03 23:08:05 -0800290 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800291 defaults: ["adb_defaults"],
292
293 srcs: [
294 "client/adb_client.cpp",
295 "client/bugreport.cpp",
296 "client/commandline.cpp",
297 "client/file_sync_client.cpp",
298 "client/main.cpp",
299 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000300 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800301 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700302 "client/fastdeploy.cpp",
303 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800304 "client/incremental.cpp",
305 "client/incremental_server.cpp",
Songchun Fan8cdefd42020-03-13 13:11:43 -0700306 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800307 "shell_service_protocol.cpp",
308 ],
309
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700310 generated_headers: [
311 "bin2c_fastdeployagent",
312 "bin2c_fastdeployagentscript"
313 ],
314
Josh Gao27768452018-01-02 12:01:43 -0800315 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800316 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800317 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800318 "libadb_pairing_auth",
319 "libadb_pairing_connection",
320 "libadb_protos",
321 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700322 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800323 "libbase",
Josh Gao50ab0a62020-03-04 19:34:08 -0800324 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800325 "libcutils",
326 "libcrypto_utils",
327 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700328 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800329 "libdiagnose_usb",
330 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800331 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800332 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700333 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800334 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800335 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100336 "libutils",
337 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700338 "libziparchive",
339 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800340 ],
341
Josh Gao27768452018-01-02 12:01:43 -0800342 // Don't add anything here, we don't want additional shared dependencies
343 // on the host adb tool, and shared libraries that link against libc++
344 // will violate ODR
345 shared_libs: [],
346
Dan Willemsen3f439a72018-11-19 19:11:35 -0800347 // Archive adb, adb.exe.
348 dist: {
349 targets: [
350 "dist_files",
351 "sdk",
352 "win_sdk",
353 ],
354 },
355
Josh Gao27768452018-01-02 12:01:43 -0800356 target: {
357 darwin: {
358 cflags: [
359 "-Wno-sizeof-pointer-memaccess",
360 ],
361 },
362 windows: {
363 enabled: true,
364 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800365 shared_libs: ["AdbWinApi"],
366 required: [
367 "AdbWinUsbApi",
368 ],
369 },
370 },
371}
372
Tao Baoeca59ae2018-07-30 20:45:27 -0700373// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800374cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700375 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800376 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700377 recovery_available: true,
378
379 // libminadbd wants both, as it's used to build native tests.
380 compile_multilib: "both",
381
Josh Gaob43ad442019-07-11 13:47:44 -0700382 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700383 "daemon/auth.cpp",
384 "daemon/jdwp_service.cpp",
Josh Gaobbe33852020-02-26 16:39:20 -0800385 "daemon/logging.cpp",
Josh Gao3467ef42020-02-21 16:38:29 -0800386 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700387 ],
388
Dan Willemsenab971b52018-08-29 14:58:02 -0700389 generated_headers: ["platform_tools_version"],
390
Tao Baoeca59ae2018-07-30 20:45:27 -0700391 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800392 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700393 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700394 ],
395
396 shared_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800397 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800398 "libadb_pairing_connection",
399 "libadb_protos",
400 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700401 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700402 "libasyncio",
403 "libbase",
404 "libcrypto",
405 "libcrypto_utils",
Josh Gao36fb6752020-03-27 19:41:59 -0700406 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700407 "liblog",
408 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800409
410 target: {
411 android: {
412 whole_static_libs: [
413 "libqemu_pipe",
414 ],
415 srcs: [
416 "daemon/transport_qemu.cpp",
417 "daemon/usb.cpp",
418 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800419 ]
Joshua Duongcaca3a92020-02-26 15:43:44 -0800420 },
421 recovery: {
422 exclude_shared_libs: [
423 "libadb_pairing_auth",
424 "libadb_pairing_connection",
425 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800426 }
427 },
Josh Gaod11e67d2020-03-16 12:48:18 -0700428
429 apex_available: [
430 "//apex_available:platform",
431 "com.android.adbd",
432 ],
433 visibility: [
434 "//bootable/recovery/minadbd",
435 "//system/core/adb",
436 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700437}
438
Josh Gaod1ee5082020-03-09 15:20:55 -0700439cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700440 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800441 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700442 recovery_available: true,
443 compile_multilib: "both",
444
445 srcs: [
446 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700447 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700448 "daemon/shell_service.cpp",
449 "shell_service_protocol.cpp",
450 ],
451
452 cflags: [
453 "-D_GNU_SOURCE",
454 "-Wno-deprecated-declarations",
455 ],
456
457 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800458 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700459 "libadbd_core",
Josh Gao50ab0a62020-03-04 19:34:08 -0800460 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700461 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700462 ],
463
464 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800465 "libadb_crypto",
466 "libadb_pairing_connection",
467 "libadb_protos",
468 "libadb_tls_connection",
Tao Baoeca59ae2018-07-30 20:45:27 -0700469 "libasyncio",
470 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700471 "libcrypto_utils",
Josh Gaod1ee5082020-03-09 15:20:55 -0700472 "libcutils_sockets",
Josh Gao36fb6752020-03-27 19:41:59 -0700473
474 // APEX dependencies.
475 "libadbd_auth",
476 "libadbd_fs",
477 "libcrypto",
Tao Baoeca59ae2018-07-30 20:45:27 -0700478 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700479 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800480
481 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800482 android: {
483 srcs: [
484 "daemon/abb_service.cpp",
485 "daemon/framebuffer_service.cpp",
486 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800487 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800488 ],
489 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800490 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800491 "libselinux",
492 ],
493 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800494 recovery: {
495 exclude_srcs: [
496 "daemon/abb_service.cpp",
497 ],
Joshua Duongcaca3a92020-02-26 15:43:44 -0800498 exclude_shared_libs: [
499 "libadb_pairing_auth",
500 "libadb_pairing_connection",
501 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800502 },
503 },
Josh Gaod11e67d2020-03-16 12:48:18 -0700504
505 apex_available: [
506 "//apex_available:platform",
507 "com.android.adbd",
508 ],
509 visibility: [
510 "//system/core/adb",
511 ],
512
Tao Baoeca59ae2018-07-30 20:45:27 -0700513}
514
515cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800516 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800517 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900518 recovery_available: true,
Jiyong Park137fb1f2020-03-10 18:31:02 +0900519 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800520
Josh Gaobb7fc922020-01-22 17:58:03 -0800521 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700522 use_version_lib: false,
523
524 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800525 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700526
Tao Baoeca59ae2018-07-30 20:45:27 -0700527 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800528 "libadb_crypto",
529 "libadb_pairing_connection",
530 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800531 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800532 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700533 "libcrypto",
534 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700535 "liblog",
Josh Gaob5778c12020-02-19 13:50:57 -0800536 "libselinux",
Josh Gao36fb6752020-03-27 19:41:59 -0700537
538 // APEX dependencies on the system image.
539 "libadbd_auth",
540 "libadbd_fs",
541 "libadbd_services",
Josh Gaob5778c12020-02-19 13:50:57 -0800542 ],
543
Joshua Duongcaca3a92020-02-26 15:43:44 -0800544 target: {
545 recovery: {
546 exclude_shared_libs: [
547 "libadb_pairing_auth",
548 "libadb_pairing_connection",
549 ],
550 }
551 },
552
Josh Gaob5778c12020-02-19 13:50:57 -0800553 static_libs: [
Josh Gao36fb6752020-03-27 19:41:59 -0700554 "libadbd_core",
Josh Gao50ab0a62020-03-04 19:34:08 -0800555 "libbrotli",
Josh Gaob5778c12020-02-19 13:50:57 -0800556 "libcutils_sockets",
557 "libdiagnose_usb",
Josh Gao3467ef42020-02-21 16:38:29 -0800558 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800559 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700560
Josh Gao27831222020-03-27 18:09:56 -0700561 visibility: [
562 "//bootable/recovery/minadbd",
563 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700564 ],
Josh Gao27768452018-01-02 12:01:43 -0800565}
566
567cc_binary {
568 name: "adbd",
Josh Gao36fb6752020-03-27 19:41:59 -0700569 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900570 recovery_available: true,
Jiyong Park137fb1f2020-03-10 18:31:02 +0900571 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800572
Josh Gao27768452018-01-02 12:01:43 -0800573 srcs: [
574 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800575 ],
576
577 cflags: [
578 "-D_GNU_SOURCE",
579 "-Wno-deprecated-declarations",
580 ],
581
582 strip: {
583 keep_symbols: true,
584 },
585
Josh Gao594f70f2019-08-15 14:05:12 -0700586 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800587 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700588 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700589 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700590 "libcap",
Josh Gao27768452018-01-02 12:01:43 -0800591 "libminijail",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800592 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800593 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700594
595 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800596 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800597 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700598 ],
Josh Gao99522582020-02-03 23:08:05 -0800599
Joshua Duongcaca3a92020-02-26 15:43:44 -0800600 target: {
601 recovery: {
602 exclude_shared_libs: [
603 "libadb_pairing_auth",
604 "libadb_pairing_connection",
605 ],
606 }
607 },
608
Josh Gaob5778c12020-02-19 13:50:57 -0800609 required: [
610 "libadbd_auth",
611 "libadbd_fs",
612 ],
Josh Gao27768452018-01-02 12:01:43 -0800613}
614
Josh Gao7b7ee192019-10-23 13:27:17 -0700615phony {
616 name: "adbd_system_binaries",
617 required: [
618 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700619 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700620 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700621 ]
622}
623
624phony {
625 name: "adbd_system_binaries_recovery",
626 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700627 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700628 ],
629}
630
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800631cc_binary {
632 name: "abb",
633
Josh Gao776c2ec2019-01-22 19:36:15 -0800634 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800635 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800636 recovery_available: false,
637
638 srcs: [
639 "daemon/abb.cpp",
640 ],
641
642 cflags: [
643 "-D_GNU_SOURCE",
644 "-Wno-deprecated-declarations",
645 ],
646
647 strip: {
648 keep_symbols: true,
649 },
650
651 static_libs: [
652 "libadbd_core",
653 "libadbd_services",
654 "libcmd",
655 ],
656
657 shared_libs: [
658 "libbase",
659 "libbinder",
660 "liblog",
661 "libutils",
662 "libselinux",
663 ],
664}
665
Josh Gao27768452018-01-02 12:01:43 -0800666cc_test {
667 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800668
Josh Gao36fb6752020-03-27 19:41:59 -0700669 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800670
671 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800672 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700673 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800674 "daemon/shell_service.cpp",
675 "daemon/shell_service_test.cpp",
676 "shell_service_protocol.cpp",
677 "shell_service_protocol_test.cpp",
Joshua Duongaa0b7292020-04-16 15:58:19 -0700678 "mdns_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800679 ],
680
Chen Zhu5daea5a2020-05-08 16:45:11 -0700681 test_config: "adb_test.xml",
682
Josh Gao36fb6752020-03-27 19:41:59 -0700683 shared_libs: [
684 "liblog",
685 ],
686
Josh Gao27768452018-01-02 12:01:43 -0800687 static_libs: [
688 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700689 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800690 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800691 "libcrypto_utils",
Josh Gao27768452018-01-02 12:01:43 -0800692 "libusb",
Josh Gao27768452018-01-02 12:01:43 -0800693 ],
Josh Gao7e015872020-01-30 14:49:01 -0800694 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700695 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800696}
697
Julien Desprez75fea7e2018-08-08 12:08:50 -0700698python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800699 name: "adb_integration_test_adb",
700 main: "test_adb.py",
701 srcs: [
702 "test_adb.py",
703 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700704 test_config: "adb_integration_test_adb.xml",
705 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800706 version: {
707 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700708 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800709 },
710 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700711 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800712 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700713 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700714}
715
Julien Desprez618f0e12018-10-12 13:48:14 -0700716python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800717 name: "adb_integration_test_device",
718 main: "test_device.py",
719 srcs: [
720 "test_device.py",
721 ],
722 libs: [
723 "adb_py",
724 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700725 test_config: "adb_integration_test_device.xml",
726 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800727 version: {
728 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800729 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800730 },
731 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800732 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800733 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700734 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700735}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700736
737// Note: using pipe for xxd to control the variable name generated
738// the default name used by xxd is the path to the input file.
739java_genrule {
740 name: "bin2c_fastdeployagent",
741 out: ["deployagent.inc"],
742 srcs: [":deployagent"],
743 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
744}
745
746genrule {
747 name: "bin2c_fastdeployagentscript",
748 out: ["deployagentscript.inc"],
749 srcs: ["fastdeploy/deployagent/deployagent.sh"],
750 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
751}
752
753cc_library_host_static {
754 name: "libfastdeploy_host",
755 defaults: ["adb_defaults"],
756 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700757 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700758 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
759 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
760 "fastdeploy/proto/ApkEntry.proto",
761 ],
762 static_libs: [
763 "libadb_host",
764 "libandroidfw",
765 "libbase",
766 "libcutils",
767 "libcrypto_utils",
768 "libcrypto",
769 "libdiagnose_usb",
770 "liblog",
771 "libmdnssd",
772 "libusb",
773 "libutils",
774 "libziparchive",
775 "libz",
776 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700777 proto: {
778 type: "lite",
779 export_proto_headers: true,
780 },
781 target: {
782 windows: {
783 enabled: true,
784 shared_libs: ["AdbWinApi"],
785 },
786 },
787}
788
789cc_test_host {
790 name: "fastdeploy_test",
791 defaults: ["adb_defaults"],
792 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700793 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700794 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
795 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
796 ],
797 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800798 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700799 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800800 "libadb_pairing_auth_static",
801 "libadb_pairing_connection_static",
802 "libadb_protos_static",
803 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700804 "libandroidfw",
805 "libbase",
806 "libcutils",
807 "libcrypto_utils",
808 "libcrypto",
809 "libdiagnose_usb",
810 "libfastdeploy_host",
811 "liblog",
812 "libmdnssd",
813 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800814 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700815 "libusb",
816 "libutils",
817 "libziparchive",
818 "libz",
819 ],
820 target: {
821 windows: {
822 enabled: true,
823 shared_libs: ["AdbWinApi"],
824 },
825 },
826 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700827 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700828 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700829 "fastdeploy/testdata/sample.apk",
830 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700831 ],
832}