blob: 5c4ab4acdeb2a652f993a5e1a910703602ea4003 [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 Gao27768452018-01-02 12:01:43 -0800117// libadb
118// =========================================================
119// These files are compiled for both the host and the device.
120libadb_srcs = [
121 "adb.cpp",
122 "adb_io.cpp",
123 "adb_listeners.cpp",
124 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700125 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800126 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700127 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700128 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800129 "services.cpp",
130 "sockets.cpp",
131 "socket_spec.cpp",
132 "sysdeps/errno.cpp",
133 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700134 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800135 "transport_local.cpp",
136 "transport_usb.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700137 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800138]
139
140libadb_posix_srcs = [
141 "sysdeps_unix.cpp",
142 "sysdeps/posix/network.cpp",
143]
144
Josh Gaob43ad442019-07-11 13:47:44 -0700145libadb_linux_srcs = [
146 "fdevent/fdevent_epoll.cpp",
147]
148
Josh Gao27768452018-01-02 12:01:43 -0800149libadb_test_srcs = [
150 "adb_io_test.cpp",
151 "adb_listeners_test.cpp",
152 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700153 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800154 "socket_spec_test.cpp",
155 "socket_test.cpp",
156 "sysdeps_test.cpp",
157 "sysdeps/stat_test.cpp",
158 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700159 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800160]
161
162cc_library_host_static {
163 name: "libadb_host",
164 defaults: ["adb_defaults"],
165
166 srcs: libadb_srcs + [
167 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800168 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800169 "client/usb_libusb.cpp",
170 "client/usb_dispatch.cpp",
171 "client/transport_mdns.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800172 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800173 ],
174
Dan Willemsenab971b52018-08-29 14:58:02 -0700175 generated_headers: ["platform_tools_version"],
176
Josh Gao27768452018-01-02 12:01:43 -0800177 target: {
178 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700179 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800180 },
181 darwin: {
182 srcs: ["client/usb_osx.cpp"],
183 },
Josh Gao27768452018-01-02 12:01:43 -0800184 not_windows: {
185 srcs: libadb_posix_srcs,
186 },
187 windows: {
188 enabled: true,
189 srcs: [
190 "client/usb_windows.cpp",
191 "sysdeps_win32.cpp",
192 "sysdeps/win32/errno.cpp",
193 "sysdeps/win32/stat.cpp",
194 ],
195 shared_libs: ["AdbWinApi"],
196 },
197 },
198
199 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800200 "libadb_crypto",
201 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800202 "libadb_pairing_connection",
203 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800204 "libbase",
205 "libcrypto_utils",
206 "libcrypto",
207 "libdiagnose_usb",
208 "libmdnssd",
209 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100210 "libutils",
211 "liblog",
212 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800213 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800214 ],
215}
216
217cc_test_host {
218 name: "adb_test",
219 defaults: ["adb_defaults"],
220 srcs: libadb_test_srcs,
221 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800222 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800223 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800224 "libadb_pairing_auth_static",
225 "libadb_pairing_connection_static",
226 "libadb_protos_static",
227 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800228 "libbase",
229 "libcutils",
230 "libcrypto_utils",
231 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800232 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800233 "libmdnssd",
234 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800235 "libprotobuf-cpp-lite",
236 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800237 "libusb",
238 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700239
240 target: {
241 windows: {
242 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700243 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700244 shared_libs: ["AdbWinApi"],
245 },
246 },
Josh Gao27768452018-01-02 12:01:43 -0800247}
248
Josh Gao9c596492018-04-04 11:27:24 -0700249cc_benchmark {
250 name: "adb_benchmark",
251 defaults: ["adb_defaults"],
252
253 srcs: ["transport_benchmark.cpp"],
254 target: {
255 android: {
256 static_libs: [
257 "libadbd",
258 ],
259 },
260 host: {
261 static_libs: [
262 "libadb_host",
263 ],
264 },
265 },
266
267 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800268 "libadb_crypto_static",
269 "libadb_tls_connection_static",
270 "libadbd_auth",
Josh Gao9c596492018-04-04 11:27:24 -0700271 "libbase",
272 "libcutils",
273 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700274 "libcrypto_static",
Josh Gao9c596492018-04-04 11:27:24 -0700275 "libdiagnose_usb",
276 "liblog",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800277 "libssl",
Josh Gao9c596492018-04-04 11:27:24 -0700278 "libusb",
279 ],
280}
281
Josh Gao27768452018-01-02 12:01:43 -0800282cc_binary_host {
283 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800284
Josh Gao99522582020-02-03 23:08:05 -0800285 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800286 defaults: ["adb_defaults"],
287
288 srcs: [
289 "client/adb_client.cpp",
290 "client/bugreport.cpp",
291 "client/commandline.cpp",
292 "client/file_sync_client.cpp",
293 "client/main.cpp",
294 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000295 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800296 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700297 "client/fastdeploy.cpp",
298 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800299 "client/incremental.cpp",
300 "client/incremental_server.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800301 "shell_service_protocol.cpp",
302 ],
303
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700304 generated_headers: [
305 "bin2c_fastdeployagent",
306 "bin2c_fastdeployagentscript"
307 ],
308
Josh Gao27768452018-01-02 12:01:43 -0800309 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800310 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800311 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800312 "libadb_pairing_auth",
313 "libadb_pairing_connection",
314 "libadb_protos",
315 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700316 "libandroidfw",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800317 "libapp_processes_protos_full",
Josh Gao27768452018-01-02 12:01:43 -0800318 "libbase",
319 "libcutils",
320 "libcrypto_utils",
321 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700322 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800323 "libdiagnose_usb",
324 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800325 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800326 "libmdnssd",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800327 "libprotobuf-cpp-full",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800328 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800329 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100330 "libutils",
331 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700332 "libziparchive",
333 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800334 ],
335
Josh Gao27768452018-01-02 12:01:43 -0800336 // Don't add anything here, we don't want additional shared dependencies
337 // on the host adb tool, and shared libraries that link against libc++
338 // will violate ODR
339 shared_libs: [],
340
Dan Willemsen3f439a72018-11-19 19:11:35 -0800341 // Archive adb, adb.exe.
342 dist: {
343 targets: [
344 "dist_files",
345 "sdk",
346 "win_sdk",
347 ],
348 },
349
Josh Gao27768452018-01-02 12:01:43 -0800350 target: {
351 darwin: {
352 cflags: [
353 "-Wno-sizeof-pointer-memaccess",
354 ],
355 },
356 windows: {
357 enabled: true,
358 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800359 shared_libs: ["AdbWinApi"],
360 required: [
361 "AdbWinUsbApi",
362 ],
363 },
364 },
365}
366
Tao Baoeca59ae2018-07-30 20:45:27 -0700367// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800368cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700369 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800370 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700371 recovery_available: true,
372
373 // libminadbd wants both, as it's used to build native tests.
374 compile_multilib: "both",
375
Josh Gaob43ad442019-07-11 13:47:44 -0700376 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700377 "daemon/auth.cpp",
378 "daemon/jdwp_service.cpp",
Josh Gao52d0b672020-02-26 16:39:20 -0800379 "daemon/logging.cpp",
Josh Gao6d949e82020-02-21 16:38:29 -0800380 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700381 ],
382
383 local_include_dirs: [
384 "daemon/include",
385 ],
386
Dan Willemsenab971b52018-08-29 14:58:02 -0700387 generated_headers: ["platform_tools_version"],
388
Tao Baoeca59ae2018-07-30 20:45:27 -0700389 static_libs: [
390 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700391 ],
392
393 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700394 "libadbconnection_server",
Joshua Duongef28ca42019-12-19 16:36:30 -0800395 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800396 "libadb_pairing_connection",
397 "libadb_protos",
398 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700399 "libadbd_auth",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700400 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700401 "libasyncio",
402 "libbase",
403 "libcrypto",
404 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700405 "liblog",
406 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800407
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800408 proto: {
409 type: "lite",
410 static: true,
411 export_proto_headers: true,
412 },
413
Josh Gao776c2ec2019-01-22 19:36:15 -0800414 target: {
415 android: {
416 whole_static_libs: [
417 "libqemu_pipe",
418 ],
419 srcs: [
420 "daemon/transport_qemu.cpp",
421 "daemon/usb.cpp",
422 "daemon/usb_ffs.cpp",
423 "daemon/usb_legacy.cpp",
424 ]
425 },
426 linux_glibc: {
427 srcs: [
428 "daemon/usb_dummy.cpp",
429 ]
Joshua Duong0f53d172020-02-26 15:43:44 -0800430 },
431 recovery: {
432 exclude_shared_libs: [
433 "libadb_pairing_auth",
434 "libadb_pairing_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700435 "libapp_processes_protos_lite",
Joshua Duong0f53d172020-02-26 15:43:44 -0800436 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800437 }
438 },
Josh Gaob5673032020-03-16 12:48:18 -0700439
440 apex_available: [
441 "//apex_available:platform",
442 "com.android.adbd",
443 ],
444 visibility: [
445 "//bootable/recovery/minadbd",
446 "//system/core/adb",
447 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700448}
449
Josh Gao7f8a37c2020-03-09 15:20:55 -0700450cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700451 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800452 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700453 recovery_available: true,
454 compile_multilib: "both",
455
456 srcs: [
457 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700458 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700459 "daemon/shell_service.cpp",
460 "shell_service_protocol.cpp",
461 ],
462
463 cflags: [
464 "-D_GNU_SOURCE",
465 "-Wno-deprecated-declarations",
466 ],
467
468 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800469 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700470 "libadbd_core",
Tao Baoeca59ae2018-07-30 20:45:27 -0700471 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700472 ],
473
474 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800475 "libadb_crypto",
476 "libadb_pairing_connection",
477 "libadb_protos",
478 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700479 "libadbd_auth",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800480 "libadbd_fs",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700481 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700482 "libasyncio",
483 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700484 "libcrypto",
485 "libcrypto_utils",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700486 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700487 "liblog",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700488 "libprotobuf-cpp-lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700489 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800490
491 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800492 android: {
493 srcs: [
494 "daemon/abb_service.cpp",
495 "daemon/framebuffer_service.cpp",
496 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800497 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800498 ],
499 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800500 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800501 "libselinux",
502 ],
503 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800504 recovery: {
505 exclude_srcs: [
506 "daemon/abb_service.cpp",
507 ],
Joshua Duong0f53d172020-02-26 15:43:44 -0800508 exclude_shared_libs: [
509 "libadb_pairing_auth",
510 "libadb_pairing_connection",
511 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800512 },
513 },
Josh Gaob5673032020-03-16 12:48:18 -0700514
515 apex_available: [
516 "//apex_available:platform",
517 "com.android.adbd",
518 ],
519 visibility: [
520 "//system/core/adb",
521 ],
522
Tao Baoeca59ae2018-07-30 20:45:27 -0700523}
524
525cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800526 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800527 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900528 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000529 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800530
Josh Gaobb7fc922020-01-22 17:58:03 -0800531 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700532 use_version_lib: false,
533
534 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800535 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700536
Tao Baoeca59ae2018-07-30 20:45:27 -0700537 whole_static_libs: [
538 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800539 ],
540
Tao Baoeca59ae2018-07-30 20:45:27 -0700541 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700542 "libadbconnection_server",
543 "libapp_processes_protos_lite",
544 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800545 "libadb_crypto",
546 "libadb_pairing_connection",
547 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700548 "libadbd_auth",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800549 "libadbd_fs",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700550 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800551 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800552 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700553 "libcrypto",
554 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700555 "liblog",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800556 "libselinux",
557 ],
558
Joshua Duong0f53d172020-02-26 15:43:44 -0800559 target: {
560 recovery: {
561 exclude_shared_libs: [
562 "libadb_pairing_auth",
563 "libadb_pairing_connection",
564 ],
565 }
566 },
567
Josh Gaoa9b62d52020-02-19 13:50:57 -0800568 static_libs: [
Josh Gaoa9b62d52020-02-19 13:50:57 -0800569 "libcutils_sockets",
570 "libdiagnose_usb",
Josh Gao6d949e82020-02-21 16:38:29 -0800571 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800572 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700573
574 export_include_dirs: [
575 "daemon/include",
576 ],
Josh Gao27768452018-01-02 12:01:43 -0800577}
578
579cc_binary {
580 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800581 defaults: ["adbd_defaults", "host_adbd_supported"],
Josh Gao99522582020-02-03 23:08:05 -0800582 stl: "libc++_static",
Jiyong Parka0e75042018-05-24 14:11:00 +0900583 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000584 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800585
Josh Gao27768452018-01-02 12:01:43 -0800586 srcs: [
587 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800588 ],
589
590 cflags: [
591 "-D_GNU_SOURCE",
592 "-Wno-deprecated-declarations",
593 ],
594
595 strip: {
596 keep_symbols: true,
597 },
598
Josh Gao594f70f2019-08-15 14:05:12 -0700599 static_libs: [
Joshua Duong0f53d172020-02-26 15:43:44 -0800600 "libadb_crypto",
601 "libadb_tls_connection",
Josh Gaobb7fc922020-01-22 17:58:03 -0800602 "libadbconnection_server",
Josh Gao27768452018-01-02 12:01:43 -0800603 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700604 "libadbd_services",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800605 "libapp_processes_protos_lite",
Josh Gao594f70f2019-08-15 14:05:12 -0700606 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700607 "libbase",
608 "libcap",
Josh Gao594f70f2019-08-15 14:05:12 -0700609 "libcrypto_utils",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800610 "libcutils_sockets",
Josh Gao594f70f2019-08-15 14:05:12 -0700611 "libdiagnose_usb",
Josh Gao594f70f2019-08-15 14:05:12 -0700612 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800613 "libminijail",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800614 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800615 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800616 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700617
618 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800619 "libadb_pairing_connection",
620 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800621 "libadbd_auth",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800622 "libadbd_fs",
Josh Gao594f70f2019-08-15 14:05:12 -0700623 "libcrypto",
Jiyong Park95b6f452020-03-09 14:35:57 +0900624 "liblog",
Jiyong Park3ffdad02020-03-11 14:00:33 +0900625 "libselinux",
Josh Gao594f70f2019-08-15 14:05:12 -0700626 ],
Josh Gao99522582020-02-03 23:08:05 -0800627
Joshua Duong0f53d172020-02-26 15:43:44 -0800628 target: {
629 recovery: {
630 exclude_shared_libs: [
631 "libadb_pairing_auth",
632 "libadb_pairing_connection",
633 ],
634 }
635 },
636
Josh Gaoa9b62d52020-02-19 13:50:57 -0800637 required: [
638 "libadbd_auth",
639 "libadbd_fs",
640 ],
Josh Gao27768452018-01-02 12:01:43 -0800641}
642
Josh Gao7b7ee192019-10-23 13:27:17 -0700643phony {
644 name: "adbd_system_binaries",
645 required: [
646 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700647 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700648 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700649 ]
650}
651
652phony {
653 name: "adbd_system_binaries_recovery",
654 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700655 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700656 ],
657}
658
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800659cc_binary {
660 name: "abb",
661
Josh Gao776c2ec2019-01-22 19:36:15 -0800662 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800663 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800664 recovery_available: false,
665
666 srcs: [
667 "daemon/abb.cpp",
668 ],
669
670 cflags: [
671 "-D_GNU_SOURCE",
672 "-Wno-deprecated-declarations",
673 ],
674
675 strip: {
676 keep_symbols: true,
677 },
678
679 static_libs: [
680 "libadbd_core",
681 "libadbd_services",
682 "libcmd",
683 ],
684
685 shared_libs: [
686 "libbase",
687 "libbinder",
688 "liblog",
689 "libutils",
690 "libselinux",
691 ],
692}
693
Josh Gao27768452018-01-02 12:01:43 -0800694cc_test {
695 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800696
Josh Gao776c2ec2019-01-22 19:36:15 -0800697 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800698 stl: "libc++_static",
699
700 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800701 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700702 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800703 "daemon/shell_service.cpp",
704 "daemon/shell_service_test.cpp",
705 "shell_service_protocol.cpp",
706 "shell_service_protocol_test.cpp",
707 ],
708
709 static_libs: [
710 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700711 "libadbd_auth",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800712 "libadb_crypto_static",
713 "libadb_pairing_connection_static",
714 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800715 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800716 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700717 "libcrypto_static",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800718 "libcutils_sockets",
Josh Gao27768452018-01-02 12:01:43 -0800719 "libdiagnose_usb",
720 "liblog",
721 "libusb",
722 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900723 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800724 ],
Josh Gao7e015872020-01-30 14:49:01 -0800725 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700726 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800727}
728
Julien Desprez75fea7e2018-08-08 12:08:50 -0700729python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800730 name: "adb_integration_test_adb",
731 main: "test_adb.py",
732 srcs: [
733 "test_adb.py",
734 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700735 test_config: "adb_integration_test_adb.xml",
736 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800737 version: {
738 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700739 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800740 },
741 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700742 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800743 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700744 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700745}
746
Julien Desprez618f0e12018-10-12 13:48:14 -0700747python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800748 name: "adb_integration_test_device",
749 main: "test_device.py",
750 srcs: [
751 "test_device.py",
752 ],
753 libs: [
754 "adb_py",
755 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700756 test_config: "adb_integration_test_device.xml",
757 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800758 version: {
759 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800760 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800761 },
762 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800763 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800764 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700765 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700766}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700767
768// Note: using pipe for xxd to control the variable name generated
769// the default name used by xxd is the path to the input file.
770java_genrule {
771 name: "bin2c_fastdeployagent",
772 out: ["deployagent.inc"],
773 srcs: [":deployagent"],
774 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
775}
776
777genrule {
778 name: "bin2c_fastdeployagentscript",
779 out: ["deployagentscript.inc"],
780 srcs: ["fastdeploy/deployagent/deployagent.sh"],
781 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
782}
783
784cc_library_host_static {
785 name: "libfastdeploy_host",
786 defaults: ["adb_defaults"],
787 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700788 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700789 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
790 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
791 "fastdeploy/proto/ApkEntry.proto",
792 ],
793 static_libs: [
794 "libadb_host",
795 "libandroidfw",
796 "libbase",
797 "libcutils",
798 "libcrypto_utils",
799 "libcrypto",
800 "libdiagnose_usb",
801 "liblog",
802 "libmdnssd",
803 "libusb",
804 "libutils",
805 "libziparchive",
806 "libz",
807 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700808 proto: {
809 type: "lite",
810 export_proto_headers: true,
811 },
812 target: {
813 windows: {
814 enabled: true,
815 shared_libs: ["AdbWinApi"],
816 },
817 },
818}
819
820cc_test_host {
821 name: "fastdeploy_test",
822 defaults: ["adb_defaults"],
823 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700824 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700825 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
826 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
827 ],
828 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800829 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700830 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800831 "libadb_pairing_auth_static",
832 "libadb_pairing_connection_static",
833 "libadb_protos_static",
834 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700835 "libandroidfw",
836 "libbase",
837 "libcutils",
838 "libcrypto_utils",
839 "libcrypto",
840 "libdiagnose_usb",
841 "libfastdeploy_host",
842 "liblog",
843 "libmdnssd",
844 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800845 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700846 "libusb",
847 "libutils",
848 "libziparchive",
849 "libz",
850 ],
851 target: {
852 windows: {
853 enabled: true,
854 shared_libs: ["AdbWinApi"],
855 },
856 },
857 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700858 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700859 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700860 "fastdeploy/testdata/sample.apk",
861 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700862 ],
863}