blob: 670a76089c725bd89848be727a1ad99161a7bb6a [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 Gao37356142020-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 "libapp_processes_protos_lite",
135 "libprotobuf-cpp-lite",
136 ],
137
138 shared_libs: [
139 "libadbd_auth",
140 "libadbd_fs",
141 "libcrypto",
142 "libcrypto_utils",
143 "liblog",
144 "libselinux",
145 ],
146
147 target: {
148 recovery: {
149 exclude_static_libs: [
150 "libadb_pairing_auth",
151 "libadb_pairing_connection",
152 ],
153 },
154 },
155}
156
Josh Gao27768452018-01-02 12:01:43 -0800157// libadb
158// =========================================================
159// These files are compiled for both the host and the device.
160libadb_srcs = [
161 "adb.cpp",
162 "adb_io.cpp",
163 "adb_listeners.cpp",
164 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700165 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800166 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700167 "fdevent/fdevent.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800168 "services.cpp",
169 "sockets.cpp",
170 "socket_spec.cpp",
171 "sysdeps/errno.cpp",
172 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700173 "transport_fd.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700174 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800175]
176
Josh Gao073c8d22020-04-20 19:22:05 -0700177libadb_darwin_srcs = [
178 "fdevent/fdevent_poll.cpp",
179]
180
181libadb_windows_srcs = [
182 "fdevent/fdevent_poll.cpp",
183 "sysdeps_win32.cpp",
184 "sysdeps/win32/errno.cpp",
185 "sysdeps/win32/stat.cpp",
186]
187
Josh Gao27768452018-01-02 12:01:43 -0800188libadb_posix_srcs = [
189 "sysdeps_unix.cpp",
190 "sysdeps/posix/network.cpp",
191]
192
Josh Gaob43ad442019-07-11 13:47:44 -0700193libadb_linux_srcs = [
194 "fdevent/fdevent_epoll.cpp",
195]
196
Josh Gao27768452018-01-02 12:01:43 -0800197libadb_test_srcs = [
198 "adb_io_test.cpp",
199 "adb_listeners_test.cpp",
200 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700201 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800202 "socket_spec_test.cpp",
203 "socket_test.cpp",
204 "sysdeps_test.cpp",
205 "sysdeps/stat_test.cpp",
206 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700207 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800208]
209
210cc_library_host_static {
211 name: "libadb_host",
212 defaults: ["adb_defaults"],
213
214 srcs: libadb_srcs + [
215 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800216 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800217 "client/usb_libusb.cpp",
218 "client/usb_dispatch.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700219 "client/transport_local.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800220 "client/transport_mdns.cpp",
Joshua Duong7be85192020-04-30 15:45:38 -0700221 "client/mdns_utils.cpp",
Josh Gao08718242020-03-27 18:09:56 -0700222 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800223 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800224 ],
225
Dan Willemsenab971b52018-08-29 14:58:02 -0700226 generated_headers: ["platform_tools_version"],
227
Josh Gao27768452018-01-02 12:01:43 -0800228 target: {
229 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700230 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800231 },
232 darwin: {
Josh Gao073c8d22020-04-20 19:22:05 -0700233 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800234 },
Josh Gao27768452018-01-02 12:01:43 -0800235 not_windows: {
236 srcs: libadb_posix_srcs,
237 },
238 windows: {
239 enabled: true,
240 srcs: [
241 "client/usb_windows.cpp",
Josh Gao073c8d22020-04-20 19:22:05 -0700242 ] + libadb_windows_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800243 shared_libs: ["AdbWinApi"],
244 },
245 },
246
247 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800248 "libadb_crypto",
249 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800250 "libadb_pairing_connection",
251 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800252 "libbase",
253 "libcrypto_utils",
254 "libcrypto",
255 "libdiagnose_usb",
256 "libmdnssd",
257 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100258 "libutils",
259 "liblog",
260 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800261 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800262 ],
263}
264
265cc_test_host {
266 name: "adb_test",
267 defaults: ["adb_defaults"],
Joshua Duong7be85192020-04-30 15:45:38 -0700268 srcs: libadb_test_srcs + [
269 "client/mdns_utils_test.cpp",
270 ],
271
Josh Gao27768452018-01-02 12:01:43 -0800272 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800273 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800274 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800275 "libadb_pairing_auth_static",
276 "libadb_pairing_connection_static",
277 "libadb_protos_static",
278 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800279 "libbase",
280 "libcutils",
281 "libcrypto_utils",
282 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800283 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800284 "libmdnssd",
285 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800286 "libprotobuf-cpp-lite",
287 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800288 "libusb",
289 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700290
291 target: {
292 windows: {
293 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700294 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700295 shared_libs: ["AdbWinApi"],
296 },
297 },
Josh Gao27768452018-01-02 12:01:43 -0800298}
299
300cc_binary_host {
301 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800302
Josh Gao99522582020-02-03 23:08:05 -0800303 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800304 defaults: ["adb_defaults"],
305
306 srcs: [
307 "client/adb_client.cpp",
308 "client/bugreport.cpp",
309 "client/commandline.cpp",
310 "client/file_sync_client.cpp",
311 "client/main.cpp",
312 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000313 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800314 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700315 "client/fastdeploy.cpp",
316 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800317 "client/incremental.cpp",
318 "client/incremental_server.cpp",
Songchun Fanc3eb3012020-03-13 13:11:43 -0700319 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800320 "shell_service_protocol.cpp",
321 ],
322
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700323 generated_headers: [
324 "bin2c_fastdeployagent",
325 "bin2c_fastdeployagentscript"
326 ],
327
Josh Gao27768452018-01-02 12:01:43 -0800328 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800329 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800330 "libadb_host",
Josh Gao31d42aa2020-03-26 13:46:08 -0700331 "libadb_pairing_auth",
332 "libadb_pairing_connection",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800333 "libadb_protos",
334 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700335 "libandroidfw",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800336 "libapp_processes_protos_full",
Josh Gao27768452018-01-02 12:01:43 -0800337 "libbase",
Josh Gao939fc192020-03-04 19:34:08 -0800338 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800339 "libcutils",
340 "libcrypto_utils",
341 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700342 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800343 "libdiagnose_usb",
344 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800345 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800346 "libmdnssd",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800347 "libprotobuf-cpp-full",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800348 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800349 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100350 "libutils",
351 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700352 "libziparchive",
353 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800354 ],
355
Josh Gao27768452018-01-02 12:01:43 -0800356 // Don't add anything here, we don't want additional shared dependencies
357 // on the host adb tool, and shared libraries that link against libc++
358 // will violate ODR
359 shared_libs: [],
360
Dan Willemsen3f439a72018-11-19 19:11:35 -0800361 // Archive adb, adb.exe.
362 dist: {
363 targets: [
364 "dist_files",
365 "sdk",
366 "win_sdk",
367 ],
368 },
369
Josh Gao27768452018-01-02 12:01:43 -0800370 target: {
371 darwin: {
372 cflags: [
373 "-Wno-sizeof-pointer-memaccess",
374 ],
375 },
376 windows: {
377 enabled: true,
378 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800379 shared_libs: ["AdbWinApi"],
380 required: [
381 "AdbWinUsbApi",
382 ],
383 },
384 },
385}
386
Tao Baoeca59ae2018-07-30 20:45:27 -0700387// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800388cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700389 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800390 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700391 recovery_available: true,
392
393 // libminadbd wants both, as it's used to build native tests.
394 compile_multilib: "both",
395
Josh Gaob43ad442019-07-11 13:47:44 -0700396 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gao8a9277a2020-04-22 17:30:06 -0700397 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700398 "daemon/auth.cpp",
399 "daemon/jdwp_service.cpp",
Josh Gao52d0b672020-02-26 16:39:20 -0800400 "daemon/logging.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700401 "daemon/transport_local.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700402 ],
403
Dan Willemsenab971b52018-08-29 14:58:02 -0700404 generated_headers: ["platform_tools_version"],
405
Tao Baoeca59ae2018-07-30 20:45:27 -0700406 static_libs: [
407 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700408 ],
409
410 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700411 "libadbconnection_server",
Joshua Duongef28ca42019-12-19 16:36:30 -0800412 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800413 "libadb_pairing_connection",
414 "libadb_protos",
415 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700416 "libadbd_auth",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700417 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700418 "libasyncio",
419 "libbase",
420 "libcrypto",
421 "libcrypto_utils",
Josh Gao37356142020-03-27 19:41:59 -0700422 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700423 "liblog",
424 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800425
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800426 proto: {
427 type: "lite",
428 static: true,
429 export_proto_headers: true,
430 },
431
Josh Gao776c2ec2019-01-22 19:36:15 -0800432 target: {
433 android: {
434 whole_static_libs: [
435 "libqemu_pipe",
436 ],
437 srcs: [
438 "daemon/transport_qemu.cpp",
439 "daemon/usb.cpp",
440 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800441 ]
Joshua Duong0f53d172020-02-26 15:43:44 -0800442 },
443 recovery: {
444 exclude_shared_libs: [
445 "libadb_pairing_auth",
446 "libadb_pairing_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700447 "libapp_processes_protos_lite",
Joshua Duong0f53d172020-02-26 15:43:44 -0800448 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800449 }
450 },
Josh Gaob5673032020-03-16 12:48:18 -0700451
452 apex_available: [
453 "//apex_available:platform",
454 "com.android.adbd",
455 ],
456 visibility: [
457 "//bootable/recovery/minadbd",
458 "//system/core/adb",
459 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700460}
461
Josh Gao7f8a37c2020-03-09 15:20:55 -0700462cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700463 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800464 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700465 recovery_available: true,
466 compile_multilib: "both",
467
468 srcs: [
469 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700470 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700471 "daemon/shell_service.cpp",
472 "shell_service_protocol.cpp",
473 ],
474
475 cflags: [
476 "-D_GNU_SOURCE",
477 "-Wno-deprecated-declarations",
478 ],
479
480 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800481 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700482 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800483 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700484 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700485 "liblz4",
Tao Baoeca59ae2018-07-30 20:45:27 -0700486 ],
487
488 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800489 "libadb_crypto",
490 "libadb_pairing_connection",
491 "libadb_protos",
492 "libadb_tls_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700493 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700494 "libasyncio",
495 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700496 "libcrypto_utils",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700497 "libcutils_sockets",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700498 "libprotobuf-cpp-lite",
Josh Gao37356142020-03-27 19:41:59 -0700499
500 // APEX dependencies.
501 "libadbd_auth",
502 "libadbd_fs",
503 "libcrypto",
504 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700505 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800506
507 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800508 android: {
509 srcs: [
510 "daemon/abb_service.cpp",
511 "daemon/framebuffer_service.cpp",
512 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800513 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800514 ],
515 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800516 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800517 "libselinux",
518 ],
519 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800520 recovery: {
521 exclude_srcs: [
522 "daemon/abb_service.cpp",
523 ],
Joshua Duong0f53d172020-02-26 15:43:44 -0800524 exclude_shared_libs: [
525 "libadb_pairing_auth",
526 "libadb_pairing_connection",
527 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800528 },
529 },
Josh Gaob5673032020-03-16 12:48:18 -0700530
531 apex_available: [
532 "//apex_available:platform",
533 "com.android.adbd",
534 ],
535 visibility: [
536 "//system/core/adb",
537 ],
538
Tao Baoeca59ae2018-07-30 20:45:27 -0700539}
540
541cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800542 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800543 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900544 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000545 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800546
Josh Gaobb7fc922020-01-22 17:58:03 -0800547 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700548 use_version_lib: false,
549
550 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800551 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700552
Tao Baoeca59ae2018-07-30 20:45:27 -0700553 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700554 "libadbconnection_server",
555 "libapp_processes_protos_lite",
556 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800557 "libadb_crypto",
558 "libadb_pairing_connection",
559 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800560 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800561 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700562 "libcrypto",
563 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700564 "liblog",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800565 "libselinux",
Josh Gao37356142020-03-27 19:41:59 -0700566
567 // APEX dependencies on the system image.
568 "libadbd_auth",
569 "libadbd_fs",
570 "libadbd_services",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800571 ],
572
Joshua Duong0f53d172020-02-26 15:43:44 -0800573 target: {
574 recovery: {
575 exclude_shared_libs: [
576 "libadb_pairing_auth",
577 "libadb_pairing_connection",
578 ],
579 }
580 },
581
Josh Gaoa9b62d52020-02-19 13:50:57 -0800582 static_libs: [
Josh Gao37356142020-03-27 19:41:59 -0700583 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800584 "libbrotli",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800585 "libcutils_sockets",
586 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700587 "liblz4",
Josh Gao6d949e82020-02-21 16:38:29 -0800588 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800589 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700590
Josh Gao08718242020-03-27 18:09:56 -0700591 visibility: [
592 "//bootable/recovery/minadbd",
593 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700594 ],
Josh Gao27768452018-01-02 12:01:43 -0800595}
596
597cc_binary {
598 name: "adbd",
Josh Gao37356142020-03-27 19:41:59 -0700599 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900600 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000601 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800602
Josh Gao27768452018-01-02 12:01:43 -0800603 srcs: [
604 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800605 ],
606
607 cflags: [
608 "-D_GNU_SOURCE",
609 "-Wno-deprecated-declarations",
610 ],
611
612 strip: {
613 keep_symbols: true,
614 },
615
Josh Gao594f70f2019-08-15 14:05:12 -0700616 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800617 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700618 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700619 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700620 "libcap",
Josh Gaoec44d352020-03-26 22:02:03 -0700621 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800622 "libminijail",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800623 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800624 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700625
626 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800627 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800628 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700629 ],
Josh Gao99522582020-02-03 23:08:05 -0800630
Joshua Duong0f53d172020-02-26 15:43:44 -0800631 target: {
632 recovery: {
633 exclude_shared_libs: [
634 "libadb_pairing_auth",
635 "libadb_pairing_connection",
636 ],
637 }
638 },
Josh Gao27768452018-01-02 12:01:43 -0800639}
640
Josh Gao7b7ee192019-10-23 13:27:17 -0700641phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700642 // Interface between adbd in a module and the system.
643 name: "adbd_system_api",
Josh Gao7b7ee192019-10-23 13:27:17 -0700644 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700645 "libadbd_auth",
646 "libadbd_fs",
Josh Gao7b7ee192019-10-23 13:27:17 -0700647 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700648 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700649 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700650 ]
651}
652
653phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700654 name: "adbd_system_api_recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700655 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700656 "libadbd_auth",
657 "libadbd_fs",
Josh Gao2c356bb2019-10-22 12:30:36 -0700658 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700659 ],
660}
661
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800662cc_binary {
663 name: "abb",
664
Josh Gao776c2ec2019-01-22 19:36:15 -0800665 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800666 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800667 recovery_available: false,
668
669 srcs: [
670 "daemon/abb.cpp",
671 ],
672
673 cflags: [
674 "-D_GNU_SOURCE",
675 "-Wno-deprecated-declarations",
676 ],
677
678 strip: {
679 keep_symbols: true,
680 },
681
682 static_libs: [
683 "libadbd_core",
684 "libadbd_services",
685 "libcmd",
686 ],
687
688 shared_libs: [
689 "libbase",
690 "libbinder",
691 "liblog",
692 "libutils",
693 "libselinux",
694 ],
695}
696
Josh Gao27768452018-01-02 12:01:43 -0800697cc_test {
698 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800699
Josh Gao37356142020-03-27 19:41:59 -0700700 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800701
702 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800703 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700704 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800705 "daemon/shell_service.cpp",
706 "daemon/shell_service_test.cpp",
707 "shell_service_protocol.cpp",
708 "shell_service_protocol_test.cpp",
Joshua Duong81f2db42020-04-16 15:58:19 -0700709 "mdns_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800710 ],
711
Josh Gao37356142020-03-27 19:41:59 -0700712 shared_libs: [
713 "liblog",
714 ],
715
Josh Gao27768452018-01-02 12:01:43 -0800716 static_libs: [
717 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700718 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800719 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800720 "libcrypto_utils",
Josh Gao27768452018-01-02 12:01:43 -0800721 "libusb",
Josh Gao27768452018-01-02 12:01:43 -0800722 ],
Josh Gao7e015872020-01-30 14:49:01 -0800723 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700724 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800725}
726
Julien Desprez75fea7e2018-08-08 12:08:50 -0700727python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800728 name: "adb_integration_test_adb",
729 main: "test_adb.py",
730 srcs: [
731 "test_adb.py",
732 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700733 test_config: "adb_integration_test_adb.xml",
734 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800735 version: {
736 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700737 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800738 },
739 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700740 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800741 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700742 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700743}
744
Julien Desprez618f0e12018-10-12 13:48:14 -0700745python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800746 name: "adb_integration_test_device",
747 main: "test_device.py",
748 srcs: [
749 "test_device.py",
750 ],
751 libs: [
752 "adb_py",
753 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700754 test_config: "adb_integration_test_device.xml",
755 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800756 version: {
757 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800758 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800759 },
760 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800761 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800762 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700763 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700764}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700765
766// Note: using pipe for xxd to control the variable name generated
767// the default name used by xxd is the path to the input file.
768java_genrule {
769 name: "bin2c_fastdeployagent",
770 out: ["deployagent.inc"],
771 srcs: [":deployagent"],
772 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
773}
774
775genrule {
776 name: "bin2c_fastdeployagentscript",
777 out: ["deployagentscript.inc"],
778 srcs: ["fastdeploy/deployagent/deployagent.sh"],
779 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
780}
781
782cc_library_host_static {
783 name: "libfastdeploy_host",
784 defaults: ["adb_defaults"],
785 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700786 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700787 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
788 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
789 "fastdeploy/proto/ApkEntry.proto",
790 ],
791 static_libs: [
792 "libadb_host",
793 "libandroidfw",
794 "libbase",
795 "libcutils",
796 "libcrypto_utils",
797 "libcrypto",
798 "libdiagnose_usb",
799 "liblog",
800 "libmdnssd",
801 "libusb",
802 "libutils",
803 "libziparchive",
804 "libz",
805 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700806 proto: {
807 type: "lite",
808 export_proto_headers: true,
809 },
810 target: {
811 windows: {
812 enabled: true,
813 shared_libs: ["AdbWinApi"],
814 },
815 },
816}
817
818cc_test_host {
819 name: "fastdeploy_test",
820 defaults: ["adb_defaults"],
821 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700822 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700823 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
824 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
825 ],
826 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800827 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700828 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800829 "libadb_pairing_auth_static",
830 "libadb_pairing_connection_static",
831 "libadb_protos_static",
832 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700833 "libandroidfw",
834 "libbase",
835 "libcutils",
836 "libcrypto_utils",
837 "libcrypto",
838 "libdiagnose_usb",
839 "libfastdeploy_host",
840 "liblog",
841 "libmdnssd",
842 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800843 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700844 "libusb",
845 "libutils",
846 "libziparchive",
847 "libz",
848 ],
849 target: {
850 windows: {
851 enabled: true,
852 shared_libs: ["AdbWinApi"],
853 },
854 },
855 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700856 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700857 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700858 "fastdeploy/testdata/sample.apk",
859 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700860 ],
861}