blob: 230d41d3fcc2b542a3dcf4640e0d866329e76145 [file] [log] [blame]
GuangHui Liu35994392017-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
Bob Badour4a6774b2021-02-12 19:46:09 -080015package {
16 default_applicable_licenses: ["packages_modules_adb_license"],
17}
18
19// Added automatically by a large-scale-change
20// See: http://go/android-license-faq
21license {
22 name: "packages_modules_adb_license",
23 visibility: [":__subpackages__"],
24 license_kinds: [
25 "SPDX-license-identifier-Apache-2.0",
26 ],
27 license_text: [
28 "NOTICE",
29 ],
30}
31
Joshua Duongb5c3bec2020-07-17 14:14:00 -070032tidy_errors = [
33 "-*",
34 "bugprone-inaccurate-erase",
35]
36
Josh Gao361148b2018-01-02 12:01:43 -080037cc_defaults {
38 name: "adb_defaults",
39
40 cflags: [
41 "-Wall",
42 "-Wextra",
43 "-Werror",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070044 "-Wexit-time-destructors",
Jiyong Parkf2721bc2020-09-18 16:35:06 +090045 "-Wno-non-virtual-dtor",
Josh Gao361148b2018-01-02 12:01:43 -080046 "-Wno-unused-parameter",
47 "-Wno-missing-field-initializers",
Josh Gao0560feb2019-01-22 19:36:15 -080048 "-Wthread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080049 "-Wvla",
Bowgo Tsai35b817b2019-03-12 04:25:33 +080050 "-DADB_HOST=1", // overridden by adbd_defaults
Josh Gao90228a62019-04-25 14:04:57 -070051 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao361148b2018-01-02 12:01:43 -080052 ],
Josh Gao3edf8072018-11-16 15:40:16 -080053 cpp_std: "experimental",
Josh Gao361148b2018-01-02 12:01:43 -080054
Josh Gao66766f82018-02-27 15:49:23 -080055 use_version_lib: true,
Josh Gao361148b2018-01-02 12:01:43 -080056 compile_multilib: "first",
Josh Gao361148b2018-01-02 12:01:43 -080057
58 target: {
Josh Gao361148b2018-01-02 12:01:43 -080059 darwin: {
60 host_ldlibs: [
61 "-lpthread",
62 "-framework CoreFoundation",
63 "-framework IOKit",
64 "-lobjc",
65 ],
66 },
67
68 windows: {
69 cflags: [
70 // Define windows.h and tchar.h Unicode preprocessor symbols so that
71 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
72 // build if you accidentally pass char*. Fix by calling like:
73 // std::wstring path_wide;
74 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
75 // CreateFileW(path_wide.c_str());
76 "-DUNICODE=1",
77 "-D_UNICODE=1",
78
Elliott Hughesc229a722018-12-03 09:02:18 -080079 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao361148b2018-01-02 12:01:43 -080080 "-D_GNU_SOURCE",
Josh Gao96049b92018-03-23 13:03:28 -070081
82 // MinGW hides some things behind _POSIX_SOURCE.
83 "-D_POSIX_SOURCE",
Josh Gao0560feb2019-01-22 19:36:15 -080084
Josh Gaoc3b64032019-04-17 16:57:43 -070085 // libusb uses __stdcall on a variadic function, which gets ignored.
86 "-Wno-ignored-attributes",
87
Josh Gao0560feb2019-01-22 19:36:15 -080088 // Not supported yet.
89 "-Wno-thread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080090 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -070091
92 host_ldlibs: [
93 "-lws2_32",
94 "-lgdi32",
95 "-luserenv",
96 ],
Josh Gao361148b2018-01-02 12:01:43 -080097 },
Josh Gao0560feb2019-01-22 19:36:15 -080098 },
Joshua Duongb5c3bec2020-07-17 14:14:00 -070099
100 tidy: true,
101 tidy_checks: tidy_errors,
102 tidy_checks_as_errors: tidy_errors,
Josh Gao0560feb2019-01-22 19:36:15 -0800103}
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -0700104
Josh Gao0560feb2019-01-22 19:36:15 -0800105cc_defaults {
106 name: "adbd_defaults",
107 defaults: ["adb_defaults"],
108
109 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
Josh Gao361148b2018-01-02 12:01:43 -0800110}
111
Josh Gao0560feb2019-01-22 19:36:15 -0800112cc_defaults {
113 name: "host_adbd_supported",
114
115 host_supported: true,
116 target: {
117 linux: {
118 enabled: true,
119 host_ldlibs: [
120 "-lresolv", // b64_pton
121 "-lutil", // forkpty
122 ],
123 },
124 darwin: {
125 enabled: false,
126 },
127 windows: {
128 enabled: false,
129 },
130 },
131}
132
Liz Kammer6836b052021-01-22 13:39:03 -0500133soong_config_module_type_import {
134 from: "system/apex/Android.bp",
135 module_types: ["library_linking_strategy_cc_defaults"],
136}
137
138library_linking_strategy_cc_defaults {
Josh Gaodc20c2f2020-03-27 19:41:59 -0700139 name: "libadbd_binary_dependencies",
140 static_libs: [
141 "libadb_crypto",
142 "libadb_pairing_connection",
Joshua Duong93b407c2020-07-30 16:34:29 -0700143 "libadb_sysdeps",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700144 "libadb_tls_connection",
145 "libadbd",
146 "libadbd_core",
147 "libadbconnection_server",
148 "libasyncio",
149 "libbrotli",
150 "libcutils_sockets",
151 "libdiagnose_usb",
152 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700153 "libzstd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700154
155 "libadb_protos",
156 "libapp_processes_protos_lite",
157 "libprotobuf-cpp-lite",
158 ],
159
160 shared_libs: [
161 "libadbd_auth",
162 "libadbd_fs",
163 "libcrypto",
164 "libcrypto_utils",
165 "liblog",
166 "libselinux",
167 ],
168
Liz Kammer6836b052021-01-22 13:39:03 -0500169 soong_config_variables:{
170 library_linking_strategy: {
171 prefer_static: {
172 static_libs: [
173 "libbase",
174 ],
175 },
176 conditions_default: {
177 shared_libs: [
178 "libbase",
179 ],
180 },
181 },
182 },
183
Josh Gaodc20c2f2020-03-27 19:41:59 -0700184 target: {
185 recovery: {
186 exclude_static_libs: [
187 "libadb_pairing_auth",
188 "libadb_pairing_connection",
189 ],
190 },
191 },
192}
193
Josh Gao361148b2018-01-02 12:01:43 -0800194// libadb
195// =========================================================
196// These files are compiled for both the host and the device.
197libadb_srcs = [
198 "adb.cpp",
199 "adb_io.cpp",
200 "adb_listeners.cpp",
201 "adb_trace.cpp",
Josh Gao7d5762c2018-05-24 22:54:50 -0700202 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800203 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700204 "fdevent/fdevent.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800205 "services.cpp",
206 "sockets.cpp",
207 "socket_spec.cpp",
Joshua Duong93b407c2020-07-30 16:34:29 -0700208 "sysdeps/env.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800209 "sysdeps/errno.cpp",
210 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700211 "transport_fd.cpp",
Yurii Zubrytskyie5e6b0d2019-07-12 14:11:54 -0700212 "types.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800213]
214
Josh Gaod7c49ec2020-04-20 19:22:05 -0700215libadb_darwin_srcs = [
216 "fdevent/fdevent_poll.cpp",
217]
218
219libadb_windows_srcs = [
220 "fdevent/fdevent_poll.cpp",
221 "sysdeps_win32.cpp",
222 "sysdeps/win32/errno.cpp",
223 "sysdeps/win32/stat.cpp",
224]
225
Josh Gao361148b2018-01-02 12:01:43 -0800226libadb_posix_srcs = [
227 "sysdeps_unix.cpp",
228 "sysdeps/posix/network.cpp",
229]
230
Josh Gaodd716422019-07-11 13:47:44 -0700231libadb_linux_srcs = [
232 "fdevent/fdevent_epoll.cpp",
233]
234
Josh Gao361148b2018-01-02 12:01:43 -0800235libadb_test_srcs = [
236 "adb_io_test.cpp",
237 "adb_listeners_test.cpp",
238 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700239 "fdevent/fdevent_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800240 "socket_spec_test.cpp",
241 "socket_test.cpp",
242 "sysdeps_test.cpp",
243 "sysdeps/stat_test.cpp",
244 "transport_test.cpp",
Josh Gao9f155db2018-04-03 14:37:11 -0700245 "types_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800246]
247
248cc_library_host_static {
249 name: "libadb_host",
250 defaults: ["adb_defaults"],
251
252 srcs: libadb_srcs + [
253 "client/auth.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800254 "client/adb_wifi.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800255 "client/usb_libusb.cpp",
256 "client/usb_dispatch.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700257 "client/transport_local.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800258 "client/transport_mdns.cpp",
Joshua Duongf2a0d872020-04-30 15:45:38 -0700259 "client/mdns_utils.cpp",
Josh Gao6b55e752020-03-27 18:09:56 -0700260 "client/transport_usb.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800261 "client/pairing/pairing_client.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800262 ],
263
Dan Willemsen18861892018-08-29 14:58:02 -0700264 generated_headers: ["platform_tools_version"],
265
Josh Gao361148b2018-01-02 12:01:43 -0800266 target: {
267 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700268 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800269 },
270 darwin: {
Josh Gaod7c49ec2020-04-20 19:22:05 -0700271 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800272 },
Josh Gao361148b2018-01-02 12:01:43 -0800273 not_windows: {
274 srcs: libadb_posix_srcs,
275 },
276 windows: {
277 enabled: true,
278 srcs: [
279 "client/usb_windows.cpp",
Josh Gaod7c49ec2020-04-20 19:22:05 -0700280 ] + libadb_windows_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800281 shared_libs: ["AdbWinApi"],
282 },
283 },
284
285 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800286 "libadb_crypto",
287 "libadb_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800288 "libadb_pairing_connection",
289 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800290 "libbase",
291 "libcrypto_utils",
292 "libcrypto",
293 "libdiagnose_usb",
294 "libmdnssd",
295 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100296 "libutils",
297 "liblog",
298 "libcutils",
Joshua Duong290ccb52019-11-20 14:18:43 -0800299 "libprotobuf-cpp-lite",
Josh Gao361148b2018-01-02 12:01:43 -0800300 ],
301}
302
Joshua Duong93b407c2020-07-30 16:34:29 -0700303cc_library {
304 name: "libadb_sysdeps",
305 defaults: ["adb_defaults"],
306 recovery_available: true,
307 host_supported: true,
308 compile_multilib: "both",
309 min_sdk_version: "apex_inherit",
Jiyong Parkc55fa5c2020-08-25 17:05:41 +0900310 // This library doesn't use build::GetBuildNumber()
311 use_version_lib: false,
Joshua Duong93b407c2020-07-30 16:34:29 -0700312
313 srcs: [
314 "sysdeps/env.cpp",
315 ],
316
317 shared_libs: [
318 "libbase",
319 "liblog",
320 ],
321
322 target: {
323 windows: {
324 enabled: true,
325 ldflags: ["-municode"],
326 },
327 },
328
329 export_include_dirs: ["."],
330
331 visibility: [
Joshua Duong93b407c2020-07-30 16:34:29 -0700332 "//bootable/recovery/minadbd:__subpackages__",
Baligh Uddin95e03672020-10-18 15:09:52 +0000333 "//packages/modules/adb:__subpackages__",
Joshua Duong93b407c2020-07-30 16:34:29 -0700334 ],
335
336 apex_available: [
337 "com.android.adbd",
338 "test_com.android.adbd",
339 ],
340}
341
Josh Gao361148b2018-01-02 12:01:43 -0800342cc_test_host {
343 name: "adb_test",
344 defaults: ["adb_defaults"],
Joshua Duongf2a0d872020-04-30 15:45:38 -0700345 srcs: libadb_test_srcs + [
346 "client/mdns_utils_test.cpp",
347 ],
348
Josh Gao361148b2018-01-02 12:01:43 -0800349 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800350 "libadb_crypto_static",
Josh Gao361148b2018-01-02 12:01:43 -0800351 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800352 "libadb_pairing_auth_static",
353 "libadb_pairing_connection_static",
354 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700355 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800356 "libadb_tls_connection_static",
Josh Gao361148b2018-01-02 12:01:43 -0800357 "libbase",
358 "libcutils",
359 "libcrypto_utils",
360 "libcrypto",
Tom Cherry49b96ec2020-01-08 13:41:56 -0800361 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800362 "libmdnssd",
363 "libdiagnose_usb",
Joshua Duong290ccb52019-11-20 14:18:43 -0800364 "libprotobuf-cpp-lite",
365 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800366 "libusb",
367 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700368
369 target: {
370 windows: {
371 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700372 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700373 shared_libs: ["AdbWinApi"],
374 },
375 },
Josh Gao361148b2018-01-02 12:01:43 -0800376}
377
378cc_binary_host {
379 name: "adb",
Josh Gao361148b2018-01-02 12:01:43 -0800380
Josh Gao06af61e2020-02-03 23:08:05 -0800381 stl: "libc++_static",
Josh Gao361148b2018-01-02 12:01:43 -0800382 defaults: ["adb_defaults"],
383
384 srcs: [
385 "client/adb_client.cpp",
386 "client/bugreport.cpp",
387 "client/commandline.cpp",
388 "client/file_sync_client.cpp",
389 "client/main.cpp",
390 "client/console.cpp",
Idries Hamadi1ecee442018-01-29 16:30:36 +0000391 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800392 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700393 "client/fastdeploy.cpp",
394 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800395 "client/incremental.cpp",
396 "client/incremental_server.cpp",
Songchun Fan965301e2020-03-13 13:11:43 -0700397 "client/incremental_utils.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800398 "shell_service_protocol.cpp",
399 ],
400
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700401 generated_headers: [
402 "bin2c_fastdeployagent",
403 "bin2c_fastdeployagentscript"
404 ],
405
Josh Gao361148b2018-01-02 12:01:43 -0800406 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800407 "libadb_crypto",
Josh Gao361148b2018-01-02 12:01:43 -0800408 "libadb_host",
Josh Gaod8bad8e2020-03-26 13:46:08 -0700409 "libadb_pairing_auth",
410 "libadb_pairing_connection",
Joshua Duong290ccb52019-11-20 14:18:43 -0800411 "libadb_protos",
Joshua Duong93b407c2020-07-30 16:34:29 -0700412 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800413 "libadb_tls_connection",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700414 "libandroidfw",
Shukang Zhou420ad552020-02-13 17:01:39 -0800415 "libapp_processes_protos_full",
Josh Gao361148b2018-01-02 12:01:43 -0800416 "libbase",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800417 "libbrotli",
Josh Gao361148b2018-01-02 12:01:43 -0800418 "libcutils",
419 "libcrypto_utils",
420 "libcrypto",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700421 "libfastdeploy_host",
Josh Gao361148b2018-01-02 12:01:43 -0800422 "libdiagnose_usb",
423 "liblog",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800424 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800425 "libmdnssd",
Shukang Zhou420ad552020-02-13 17:01:39 -0800426 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -0800427 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800428 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100429 "libutils",
430 "liblog",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700431 "libziparchive",
432 "libz",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700433 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800434 ],
435
Josh Gao361148b2018-01-02 12:01:43 -0800436 // Don't add anything here, we don't want additional shared dependencies
437 // on the host adb tool, and shared libraries that link against libc++
438 // will violate ODR
439 shared_libs: [],
440
Dan Willemsen7024da42018-11-19 19:11:35 -0800441 // Archive adb, adb.exe.
442 dist: {
443 targets: [
444 "dist_files",
445 "sdk",
446 "win_sdk",
447 ],
448 },
449
Josh Gao361148b2018-01-02 12:01:43 -0800450 target: {
451 darwin: {
452 cflags: [
453 "-Wno-sizeof-pointer-memaccess",
454 ],
455 },
456 windows: {
457 enabled: true,
458 ldflags: ["-municode"],
Josh Gao361148b2018-01-02 12:01:43 -0800459 shared_libs: ["AdbWinApi"],
460 required: [
461 "AdbWinUsbApi",
462 ],
463 },
464 },
465}
466
Tao Bao49042e32018-07-30 20:45:27 -0700467// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800468cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700469 name: "libadbd_core",
Josh Gao0560feb2019-01-22 19:36:15 -0800470 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700471 recovery_available: true,
472
473 // libminadbd wants both, as it's used to build native tests.
474 compile_multilib: "both",
475
Josh Gaodd716422019-07-11 13:47:44 -0700476 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gaoa5baef92020-04-22 17:30:06 -0700477 "daemon/adb_wifi.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700478 "daemon/auth.cpp",
479 "daemon/jdwp_service.cpp",
Josh Gaobd775212020-02-26 16:39:20 -0800480 "daemon/logging.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700481 "daemon/transport_local.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700482 ],
483
Dan Willemsen18861892018-08-29 14:58:02 -0700484 generated_headers: ["platform_tools_version"],
485
Tao Bao49042e32018-07-30 20:45:27 -0700486 static_libs: [
487 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700488 ],
489
490 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700491 "libadbconnection_server",
Joshua Duong090c8072019-12-19 16:36:30 -0800492 "libadb_crypto",
Joshua Duong290ccb52019-11-20 14:18:43 -0800493 "libadb_pairing_connection",
494 "libadb_protos",
495 "libadb_tls_connection",
Josh Gao7cac88a2019-10-22 12:30:39 -0700496 "libadbd_auth",
Josh Gaofa3605a2020-03-16 11:30:09 -0700497 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700498 "libasyncio",
499 "libbase",
500 "libcrypto",
501 "libcrypto_utils",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700502 "libcutils_sockets",
Tao Bao49042e32018-07-30 20:45:27 -0700503 "liblog",
504 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800505
Shukang Zhou420ad552020-02-13 17:01:39 -0800506 proto: {
507 type: "lite",
508 static: true,
509 export_proto_headers: true,
510 },
511
Josh Gao0560feb2019-01-22 19:36:15 -0800512 target: {
513 android: {
Josh Gao0560feb2019-01-22 19:36:15 -0800514 srcs: [
Josh Gao822f6742021-02-03 22:12:41 -0800515 "daemon/property_monitor.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800516 "daemon/usb.cpp",
517 "daemon/usb_ffs.cpp",
Josh Gao2dc61962021-02-03 22:11:45 -0800518 "daemon/watchdog.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800519 ]
Joshua Duong929364a2020-02-26 15:43:44 -0800520 },
521 recovery: {
522 exclude_shared_libs: [
523 "libadb_pairing_auth",
524 "libadb_pairing_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700525 "libapp_processes_protos_lite",
Joshua Duong929364a2020-02-26 15:43:44 -0800526 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800527 }
528 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700529
530 apex_available: [
531 "//apex_available:platform",
532 "com.android.adbd",
533 ],
534 visibility: [
535 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000536 "//packages/modules/adb:__subpackages__",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700537 ],
Tao Bao49042e32018-07-30 20:45:27 -0700538}
539
Josh Gao2029a372020-03-09 15:20:55 -0700540cc_library {
Tao Bao49042e32018-07-30 20:45:27 -0700541 name: "libadbd_services",
Josh Gao0560feb2019-01-22 19:36:15 -0800542 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700543 recovery_available: true,
544 compile_multilib: "both",
545
546 srcs: [
547 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700548 "daemon/services.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700549 "daemon/shell_service.cpp",
550 "shell_service_protocol.cpp",
551 ],
552
553 cflags: [
554 "-D_GNU_SOURCE",
555 "-Wno-deprecated-declarations",
556 ],
557
558 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800559 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700560 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800561 "libbrotli",
Tao Bao49042e32018-07-30 20:45:27 -0700562 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700563 "liblz4",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700564 "libzstd",
Tao Bao49042e32018-07-30 20:45:27 -0700565 ],
566
567 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800568 "libadb_crypto",
569 "libadb_pairing_connection",
570 "libadb_protos",
571 "libadb_tls_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700572 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700573 "libasyncio",
574 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700575 "libcrypto_utils",
Josh Gao2029a372020-03-09 15:20:55 -0700576 "libcutils_sockets",
Josh Gaofa3605a2020-03-16 11:30:09 -0700577 "libprotobuf-cpp-lite",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700578
579 // APEX dependencies.
580 "libadbd_auth",
581 "libadbd_fs",
582 "libcrypto",
583 "liblog",
Tao Bao49042e32018-07-30 20:45:27 -0700584 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800585
586 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800587 android: {
588 srcs: [
589 "daemon/abb_service.cpp",
590 "daemon/framebuffer_service.cpp",
591 "daemon/mdns.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800592 "daemon/restart_service.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800593 ],
594 shared_libs: [
Josh Gao0560feb2019-01-22 19:36:15 -0800595 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800596 "libselinux",
597 ],
598 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800599 recovery: {
600 exclude_srcs: [
601 "daemon/abb_service.cpp",
602 ],
Joshua Duong929364a2020-02-26 15:43:44 -0800603 exclude_shared_libs: [
604 "libadb_pairing_auth",
605 "libadb_pairing_connection",
606 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800607 },
608 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700609
610 apex_available: [
611 "//apex_available:platform",
612 "com.android.adbd",
613 ],
614 visibility: [
Baligh Uddin95e03672020-10-18 15:09:52 +0000615 "//packages/modules/adb",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700616 ],
617
Tao Bao49042e32018-07-30 20:45:27 -0700618}
619
620cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800621 name: "libadbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800622 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900623 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000624 apex_available: ["com.android.adbd"],
Josh Gao361148b2018-01-02 12:01:43 -0800625
Josh Gaobf5a9362020-01-22 17:58:03 -0800626 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Bao49042e32018-07-30 20:45:27 -0700627 use_version_lib: false,
628
629 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800630 compile_multilib: "both",
Tao Bao49042e32018-07-30 20:45:27 -0700631
Tao Bao49042e32018-07-30 20:45:27 -0700632 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700633 "libadbconnection_server",
634 "libapp_processes_protos_lite",
635 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800636 "libadb_crypto",
637 "libadb_pairing_connection",
638 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800639 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800640 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700641 "libcrypto",
642 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700643 "liblog",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800644 "libselinux",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700645
646 // APEX dependencies on the system image.
647 "libadbd_auth",
648 "libadbd_fs",
649 "libadbd_services",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800650 ],
651
Joshua Duong929364a2020-02-26 15:43:44 -0800652 target: {
653 recovery: {
654 exclude_shared_libs: [
655 "libadb_pairing_auth",
656 "libadb_pairing_connection",
657 ],
658 }
659 },
660
Josh Gaoa4dfc142020-02-19 13:50:57 -0800661 static_libs: [
Josh Gaodc20c2f2020-03-27 19:41:59 -0700662 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800663 "libbrotli",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800664 "libcutils_sockets",
665 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700666 "liblz4",
Josh Gao2e24c962020-02-21 16:38:29 -0800667 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700668 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800669 ],
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700670
Josh Gao6b55e752020-03-27 18:09:56 -0700671 visibility: [
672 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000673 "//packages/modules/adb",
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700674 ],
Josh Gao361148b2018-01-02 12:01:43 -0800675}
676
677cc_binary {
678 name: "adbd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700679 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900680 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000681 apex_available: ["com.android.adbd"],
Josh Gao3e0540a2018-03-06 12:57:27 -0800682
Josh Gao361148b2018-01-02 12:01:43 -0800683 srcs: [
684 "daemon/main.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800685 ],
686
687 cflags: [
688 "-D_GNU_SOURCE",
689 "-Wno-deprecated-declarations",
690 ],
691
692 strip: {
693 keep_symbols: true,
694 },
695
Josh Gao2bfc85e2019-08-15 14:05:12 -0700696 static_libs: [
Josh Gao361148b2018-01-02 12:01:43 -0800697 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700698 "libadbd_services",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700699 "libasyncio",
Tao Bao49042e32018-07-30 20:45:27 -0700700 "libcap",
Josh Gaofb386cc2020-03-26 22:02:03 -0700701 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800702 "libminijail",
Joshua Duong290ccb52019-11-20 14:18:43 -0800703 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800704 ],
Josh Gao2bfc85e2019-08-15 14:05:12 -0700705
706 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800707 "libadb_protos",
Josh Gao090712a2020-01-16 12:40:43 -0800708 "libadbd_auth",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700709 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800710
Joshua Duong929364a2020-02-26 15:43:44 -0800711 target: {
712 recovery: {
713 exclude_shared_libs: [
714 "libadb_pairing_auth",
715 "libadb_pairing_connection",
716 ],
717 }
718 },
Josh Gao361148b2018-01-02 12:01:43 -0800719}
720
Josh Gao06e45932019-10-23 13:27:17 -0700721phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700722 // Interface between adbd in a module and the system.
723 name: "adbd_system_api",
Josh Gao06e45932019-10-23 13:27:17 -0700724 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700725 "libadbd_auth",
726 "libadbd_fs",
Josh Gao06e45932019-10-23 13:27:17 -0700727 "abb",
Josh Gao83ce3e22019-10-22 12:30:36 -0700728 "reboot",
Josh Gaob554f4b2019-10-22 12:30:30 -0700729 "set-verity-state",
Josh Gao06e45932019-10-23 13:27:17 -0700730 ]
731}
732
733phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700734 name: "adbd_system_api_recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700735 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700736 "libadbd_auth",
737 "libadbd_fs",
Josh Gao83ce3e22019-10-22 12:30:36 -0700738 "reboot.recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700739 ],
740}
741
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800742cc_binary {
743 name: "abb",
744
Josh Gao0560feb2019-01-22 19:36:15 -0800745 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800746 stl: "libc++",
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800747 recovery_available: false,
748
749 srcs: [
750 "daemon/abb.cpp",
751 ],
752
753 cflags: [
754 "-D_GNU_SOURCE",
755 "-Wno-deprecated-declarations",
756 ],
757
758 strip: {
759 keep_symbols: true,
760 },
761
762 static_libs: [
763 "libadbd_core",
764 "libadbd_services",
765 "libcmd",
766 ],
767
768 shared_libs: [
769 "libbase",
770 "libbinder",
771 "liblog",
772 "libutils",
773 "libselinux",
774 ],
775}
776
Josh Gao361148b2018-01-02 12:01:43 -0800777cc_test {
778 name: "adbd_test",
Josh Gao06af61e2020-02-03 23:08:05 -0800779
Josh Gaodc20c2f2020-03-27 19:41:59 -0700780 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao06af61e2020-02-03 23:08:05 -0800781
782 recovery_available: false,
Josh Gao361148b2018-01-02 12:01:43 -0800783 srcs: libadb_test_srcs + [
Josh Gao5607e922018-07-25 18:15:52 -0700784 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800785 "daemon/shell_service.cpp",
786 "daemon/shell_service_test.cpp",
787 "shell_service_protocol.cpp",
788 "shell_service_protocol_test.cpp",
Joshua Duong77b8ff32020-04-16 15:58:19 -0700789 "mdns_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800790 ],
791
Chen Zhu72ccee32020-05-08 16:45:11 -0700792 test_config: "adb_test.xml",
793
Josh Gao822f6742021-02-03 22:12:41 -0800794 target: {
795 android: {
796 srcs: [
797 "daemon/property_monitor_test.cpp",
798 ],
799 },
800 },
801
Josh Gaodc20c2f2020-03-27 19:41:59 -0700802 shared_libs: [
803 "liblog",
804 ],
805
Josh Gao361148b2018-01-02 12:01:43 -0800806 static_libs: [
807 "libadbd",
Josh Gao7cac88a2019-10-22 12:30:39 -0700808 "libadbd_auth",
Josh Gao361148b2018-01-02 12:01:43 -0800809 "libbase",
Josh Gao361148b2018-01-02 12:01:43 -0800810 "libcrypto_utils",
Josh Gao361148b2018-01-02 12:01:43 -0800811 "libusb",
Josh Gao361148b2018-01-02 12:01:43 -0800812 ],
Josh Gao9b06dca2020-01-30 14:49:01 -0800813 test_suites: ["device-tests", "mts"],
Dan Shi22e091b2019-09-24 09:04:05 -0700814 require_root: true,
Josh Gao361148b2018-01-02 12:01:43 -0800815}
816
Julien Desprezae94f512018-08-08 12:08:50 -0700817python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800818 name: "adb_integration_test_adb",
819 main: "test_adb.py",
820 srcs: [
821 "test_adb.py",
822 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700823 test_config: "adb_integration_test_adb.xml",
824 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800825 version: {
826 py2: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700827 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800828 },
829 py3: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700830 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800831 },
GuangHui Liu35994392017-05-10 14:37:17 -0700832 },
GuangHui Liu35994392017-05-10 14:37:17 -0700833}
834
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700835python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800836 name: "adb_integration_test_device",
837 main: "test_device.py",
838 srcs: [
839 "test_device.py",
840 ],
841 libs: [
842 "adb_py",
843 ],
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700844 test_config: "adb_integration_test_device.xml",
845 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800846 version: {
847 py2: {
Josh Gao4218d852020-02-06 17:52:38 -0800848 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800849 },
850 py3: {
Josh Gao4218d852020-02-06 17:52:38 -0800851 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800852 },
GuangHui Liu35994392017-05-10 14:37:17 -0700853 },
GuangHui Liu35994392017-05-10 14:37:17 -0700854}
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700855
856// Note: using pipe for xxd to control the variable name generated
857// the default name used by xxd is the path to the input file.
858java_genrule {
859 name: "bin2c_fastdeployagent",
860 out: ["deployagent.inc"],
861 srcs: [":deployagent"],
862 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
863}
864
865genrule {
866 name: "bin2c_fastdeployagentscript",
867 out: ["deployagentscript.inc"],
868 srcs: ["fastdeploy/deployagent/deployagent.sh"],
869 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
870}
871
872cc_library_host_static {
873 name: "libfastdeploy_host",
874 defaults: ["adb_defaults"],
875 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700876 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700877 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
878 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
879 "fastdeploy/proto/ApkEntry.proto",
880 ],
881 static_libs: [
882 "libadb_host",
883 "libandroidfw",
884 "libbase",
885 "libcutils",
886 "libcrypto_utils",
887 "libcrypto",
888 "libdiagnose_usb",
889 "liblog",
890 "libmdnssd",
891 "libusb",
892 "libutils",
893 "libziparchive",
894 "libz",
895 ],
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700896 proto: {
897 type: "lite",
898 export_proto_headers: true,
899 },
900 target: {
901 windows: {
902 enabled: true,
903 shared_libs: ["AdbWinApi"],
904 },
905 },
906}
907
908cc_test_host {
909 name: "fastdeploy_test",
910 defaults: ["adb_defaults"],
911 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700912 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700913 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
914 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
915 ],
916 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800917 "libadb_crypto_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700918 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800919 "libadb_pairing_auth_static",
920 "libadb_pairing_connection_static",
921 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700922 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800923 "libadb_tls_connection_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700924 "libandroidfw",
925 "libbase",
926 "libcutils",
927 "libcrypto_utils",
928 "libcrypto",
929 "libdiagnose_usb",
930 "libfastdeploy_host",
931 "liblog",
932 "libmdnssd",
933 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800934 "libssl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700935 "libusb",
936 "libutils",
937 "libziparchive",
938 "libz",
939 ],
940 target: {
941 windows: {
942 enabled: true,
943 shared_libs: ["AdbWinApi"],
944 },
945 },
946 data: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700947 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700948 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700949 "fastdeploy/testdata/sample.apk",
950 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700951 ],
952}