blob: b8a484b74a61acec374b34129af73e984a445d7b [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 {
Aditya Choudhary1d87c972024-02-02 13:55:51 +000016 default_team: "trendy_team_native_tools_libraries",
Bob Badour4a6774b2021-02-12 19:46:09 -080017 default_applicable_licenses: ["packages_modules_adb_license"],
18}
19
20// Added automatically by a large-scale-change
21// See: http://go/android-license-faq
22license {
23 name: "packages_modules_adb_license",
24 visibility: [":__subpackages__"],
25 license_kinds: [
26 "SPDX-license-identifier-Apache-2.0",
27 ],
28 license_text: [
29 "NOTICE",
30 ],
31}
32
Joshua Duongb5c3bec2020-07-17 14:14:00 -070033tidy_errors = [
34 "-*",
35 "bugprone-inaccurate-erase",
Joshua Duongf4ba8d72021-01-13 12:18:15 -080036 "bugprone-use-after-move",
Joshua Duongb5c3bec2020-07-17 14:14:00 -070037]
38
Josh Gao361148b2018-01-02 12:01:43 -080039cc_defaults {
40 name: "adb_defaults",
41
42 cflags: [
43 "-Wall",
44 "-Wextra",
45 "-Werror",
Jiyong Parkf2721bc2020-09-18 16:35:06 +090046 "-Wno-non-virtual-dtor",
Josh Gao361148b2018-01-02 12:01:43 -080047 "-Wno-unused-parameter",
48 "-Wno-missing-field-initializers",
Josh Gao0560feb2019-01-22 19:36:15 -080049 "-Wthread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080050 "-Wvla",
Aditya Choudhary1d87c972024-02-02 13:55:51 +000051 "-DADB_HOST=1", // overridden by adbd_defaults
Josh Gao90228a62019-04-25 14:04:57 -070052 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao361148b2018-01-02 12:01:43 -080053 ],
Josh Gao3edf8072018-11-16 15:40:16 -080054 cpp_std: "experimental",
Josh Gao361148b2018-01-02 12:01:43 -080055
Josh Gao66766f82018-02-27 15:49:23 -080056 use_version_lib: true,
Josh Gao361148b2018-01-02 12:01:43 -080057 compile_multilib: "first",
Josh Gao361148b2018-01-02 12:01:43 -080058
59 target: {
Josh Gao361148b2018-01-02 12:01:43 -080060 darwin: {
61 host_ldlibs: [
62 "-lpthread",
63 "-framework CoreFoundation",
64 "-framework IOKit",
Elliott Hughes038a7ac2022-08-12 15:26:44 +000065 "-framework Security",
Josh Gao361148b2018-01-02 12:01:43 -080066 "-lobjc",
67 ],
Joshua Duong28fd4e52021-03-19 12:12:35 -070068 cflags: [
69 // Required, to use the new IPv6 Sockets options introduced by RFC 3542.
70 "-D__APPLE_USE_RFC_3542",
71 ],
Josh Gao361148b2018-01-02 12:01:43 -080072 },
73
74 windows: {
75 cflags: [
76 // Define windows.h and tchar.h Unicode preprocessor symbols so that
77 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
78 // build if you accidentally pass char*. Fix by calling like:
79 // std::wstring path_wide;
80 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
81 // CreateFileW(path_wide.c_str());
82 "-DUNICODE=1",
83 "-D_UNICODE=1",
84
Elliott Hughesc229a722018-12-03 09:02:18 -080085 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao361148b2018-01-02 12:01:43 -080086 "-D_GNU_SOURCE",
Josh Gao96049b92018-03-23 13:03:28 -070087
88 // MinGW hides some things behind _POSIX_SOURCE.
89 "-D_POSIX_SOURCE",
Josh Gao0560feb2019-01-22 19:36:15 -080090
Josh Gaoc3b64032019-04-17 16:57:43 -070091 // libusb uses __stdcall on a variadic function, which gets ignored.
92 "-Wno-ignored-attributes",
93
Josh Gao0560feb2019-01-22 19:36:15 -080094 // Not supported yet.
95 "-Wno-thread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080096 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -070097
98 host_ldlibs: [
99 "-lws2_32",
100 "-lgdi32",
101 "-luserenv",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800102 "-liphlpapi",
Josh Gaoea7b95a2018-03-23 15:37:20 -0700103 ],
Josh Gao361148b2018-01-02 12:01:43 -0800104 },
Josh Gao0560feb2019-01-22 19:36:15 -0800105 },
Joshua Duongb5c3bec2020-07-17 14:14:00 -0700106
107 tidy: true,
108 tidy_checks: tidy_errors,
109 tidy_checks_as_errors: tidy_errors,
Josh Gao0560feb2019-01-22 19:36:15 -0800110}
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -0700111
Josh Gao0560feb2019-01-22 19:36:15 -0800112cc_defaults {
113 name: "adbd_defaults",
114 defaults: ["adb_defaults"],
115
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000116 cflags: [
117 "-UADB_HOST",
118 "-DADB_HOST=0",
119 ],
Josh Gao361148b2018-01-02 12:01:43 -0800120}
121
Josh Gao0560feb2019-01-22 19:36:15 -0800122cc_defaults {
123 name: "host_adbd_supported",
124
125 host_supported: true,
126 target: {
127 linux: {
128 enabled: true,
129 host_ldlibs: [
130 "-lresolv", // b64_pton
131 "-lutil", // forkpty
132 ],
133 },
134 darwin: {
135 enabled: false,
136 },
137 windows: {
138 enabled: false,
139 },
140 },
141}
142
Liz Kammer6836b052021-01-22 13:39:03 -0500143soong_config_module_type_import {
144 from: "system/apex/Android.bp",
145 module_types: ["library_linking_strategy_cc_defaults"],
146}
147
148library_linking_strategy_cc_defaults {
Josh Gaodc20c2f2020-03-27 19:41:59 -0700149 name: "libadbd_binary_dependencies",
150 static_libs: [
151 "libadb_crypto",
152 "libadb_pairing_connection",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000153 "libadb_protos",
Joshua Duong93b407c2020-07-30 16:34:29 -0700154 "libadb_sysdeps",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700155 "libadb_tls_connection",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000156 "libadbconnection_server",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700157 "libadbd",
158 "libadbd_core",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000159 "libapp_processes_protos_lite",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700160 "libasyncio",
161 "libbrotli",
Josh Gao7e3f8112021-04-09 17:32:58 -0700162 "libcrypto_utils",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700163 "libcutils_sockets",
164 "libdiagnose_usb",
165 "libmdnssd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700166 "libprotobuf-cpp-lite",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000167 "libzstd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700168 ],
169
170 shared_libs: [
171 "libadbd_auth",
172 "libadbd_fs",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700173 "liblog",
174 "libselinux",
175 ],
176
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000177 soong_config_variables: {
Liz Kammer6836b052021-01-22 13:39:03 -0500178 library_linking_strategy: {
179 prefer_static: {
180 static_libs: [
181 "libbase",
182 ],
183 },
184 conditions_default: {
185 shared_libs: [
186 "libbase",
187 ],
188 },
189 },
190 },
191
Josh Gaodc20c2f2020-03-27 19:41:59 -0700192 target: {
Josh Gao7e3f8112021-04-09 17:32:58 -0700193 android: {
194 shared_libs: ["libcrypto"],
195 },
Colin Cross02290862022-03-24 15:47:28 -0700196 host_linux: {
Josh Gao7e3f8112021-04-09 17:32:58 -0700197 static_libs: ["libcrypto_static"],
198 },
Josh Gaodc20c2f2020-03-27 19:41:59 -0700199 recovery: {
200 exclude_static_libs: [
201 "libadb_pairing_auth",
202 "libadb_pairing_connection",
203 ],
204 },
205 },
206}
207
Josh Gao361148b2018-01-02 12:01:43 -0800208// libadb
209// =========================================================
210// These files are compiled for both the host and the device.
211libadb_srcs = [
212 "adb.cpp",
213 "adb_io.cpp",
214 "adb_listeners.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800215 "adb_mdns.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800216 "adb_trace.cpp",
Josh Gao7d5762c2018-05-24 22:54:50 -0700217 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800218 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700219 "fdevent/fdevent.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800220 "services.cpp",
221 "sockets.cpp",
222 "socket_spec.cpp",
Joshua Duong93b407c2020-07-30 16:34:29 -0700223 "sysdeps/env.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800224 "sysdeps/errno.cpp",
225 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700226 "transport_fd.cpp",
Yurii Zubrytskyie5e6b0d2019-07-12 14:11:54 -0700227 "types.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800228]
229
Josh Gaod7c49ec2020-04-20 19:22:05 -0700230libadb_darwin_srcs = [
231 "fdevent/fdevent_poll.cpp",
232]
233
234libadb_windows_srcs = [
235 "fdevent/fdevent_poll.cpp",
236 "sysdeps_win32.cpp",
237 "sysdeps/win32/errno.cpp",
238 "sysdeps/win32/stat.cpp",
239]
240
Josh Gao361148b2018-01-02 12:01:43 -0800241libadb_posix_srcs = [
242 "sysdeps_unix.cpp",
243 "sysdeps/posix/network.cpp",
244]
245
Josh Gaodd716422019-07-11 13:47:44 -0700246libadb_linux_srcs = [
247 "fdevent/fdevent_epoll.cpp",
248]
249
Josh Gao361148b2018-01-02 12:01:43 -0800250libadb_test_srcs = [
251 "adb_io_test.cpp",
252 "adb_listeners_test.cpp",
253 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700254 "fdevent/fdevent_test.cpp",
Shaju Mathew3f7b4402023-01-19 21:56:37 -0800255 "shell_service_protocol.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800256 "socket_spec_test.cpp",
257 "socket_test.cpp",
258 "sysdeps_test.cpp",
259 "sysdeps/stat_test.cpp",
260 "transport_test.cpp",
Josh Gao9f155db2018-04-03 14:37:11 -0700261 "types_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800262]
263
264cc_library_host_static {
265 name: "libadb_host",
266 defaults: ["adb_defaults"],
267
268 srcs: libadb_srcs + [
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800269 "client/openscreen/mdns_service_info.cpp",
270 "client/openscreen/mdns_service_watcher.cpp",
271 "client/openscreen/platform/logging.cpp",
272 "client/openscreen/platform/task_runner.cpp",
273 "client/openscreen/platform/udp_socket.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800274 "client/auth.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800275 "client/adb_wifi.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800276 "client/usb_libusb.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700277 "client/transport_local.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800278 "client/mdnsresponder_client.cpp",
Joshua Duongf2a0d872020-04-30 15:45:38 -0700279 "client/mdns_utils.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800280 "client/transport_mdns.cpp",
Josh Gao6b55e752020-03-27 18:09:56 -0700281 "client/transport_usb.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800282 "client/pairing/pairing_client.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800283 ],
284
Dan Willemsen18861892018-08-29 14:58:02 -0700285 generated_headers: ["platform_tools_version"],
286
Josh Gao361148b2018-01-02 12:01:43 -0800287 target: {
288 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700289 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800290 },
291 darwin: {
Josh Gaod7c49ec2020-04-20 19:22:05 -0700292 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800293 },
Josh Gao361148b2018-01-02 12:01:43 -0800294 not_windows: {
295 srcs: libadb_posix_srcs,
296 },
297 windows: {
298 enabled: true,
299 srcs: [
300 "client/usb_windows.cpp",
Josh Gaod7c49ec2020-04-20 19:22:05 -0700301 ] + libadb_windows_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800302 shared_libs: ["AdbWinApi"],
303 },
304 },
305
306 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800307 "libadb_crypto",
Fabien Sanglard05789412024-05-30 23:00:18 -0700308 "libadb_host_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800309 "libadb_pairing_connection",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000310 "libadb_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800311 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800312 "libbase",
Josh Gao361148b2018-01-02 12:01:43 -0800313 "libcrypto",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000314 "libcrypto_utils",
Idries Hamadi78330f02018-09-13 18:00:25 +0100315 "libcutils",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000316 "libdiagnose_usb",
317 "liblog",
318 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800319 "libopenscreen-discovery",
320 "libopenscreen-platform-impl",
Joshua Duong290ccb52019-11-20 14:18:43 -0800321 "libprotobuf-cpp-lite",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000322 "libusb",
323 "libutils",
Josh Gao361148b2018-01-02 12:01:43 -0800324 ],
325}
326
Joshua Duong93b407c2020-07-30 16:34:29 -0700327cc_library {
328 name: "libadb_sysdeps",
329 defaults: ["adb_defaults"],
330 recovery_available: true,
331 host_supported: true,
332 compile_multilib: "both",
333 min_sdk_version: "apex_inherit",
Jiyong Parkc55fa5c2020-08-25 17:05:41 +0900334 // This library doesn't use build::GetBuildNumber()
335 use_version_lib: false,
Joshua Duong93b407c2020-07-30 16:34:29 -0700336
337 srcs: [
338 "sysdeps/env.cpp",
339 ],
340
341 shared_libs: [
342 "libbase",
343 "liblog",
344 ],
345
346 target: {
347 windows: {
348 enabled: true,
349 ldflags: ["-municode"],
350 },
351 },
352
353 export_include_dirs: ["."],
354
355 visibility: [
Joshua Duong93b407c2020-07-30 16:34:29 -0700356 "//bootable/recovery/minadbd:__subpackages__",
Baligh Uddin95e03672020-10-18 15:09:52 +0000357 "//packages/modules/adb:__subpackages__",
Joshua Duong93b407c2020-07-30 16:34:29 -0700358 ],
359
360 apex_available: [
361 "com.android.adbd",
362 "test_com.android.adbd",
363 ],
364}
365
Josh Gao361148b2018-01-02 12:01:43 -0800366cc_test_host {
367 name: "adb_test",
368 defaults: ["adb_defaults"],
Joshua Duongf2a0d872020-04-30 15:45:38 -0700369 srcs: libadb_test_srcs + [
370 "client/mdns_utils_test.cpp",
Shaju Mathew3f7b4402023-01-19 21:56:37 -0800371 "test_utils/test_utils.cpp",
Joshua Duongf2a0d872020-04-30 15:45:38 -0700372 ],
373
Josh Gao361148b2018-01-02 12:01:43 -0800374 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800375 "libadb_crypto_static",
Josh Gao361148b2018-01-02 12:01:43 -0800376 "libadb_host",
Fabien Sanglard05789412024-05-30 23:00:18 -0700377 "libadb_host_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800378 "libadb_pairing_auth_static",
379 "libadb_pairing_connection_static",
380 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700381 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800382 "libadb_tls_connection_static",
Josh Gao361148b2018-01-02 12:01:43 -0800383 "libbase",
Josh Gao361148b2018-01-02 12:01:43 -0800384 "libcrypto",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000385 "libcrypto_utils",
386 "libcutils",
387 "libdiagnose_usb",
Tom Cherry49b96ec2020-01-08 13:41:56 -0800388 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800389 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800390 "libopenscreen-discovery",
391 "libopenscreen-platform-impl",
Fabien Sanglard3d155b62023-11-30 14:52:40 -0800392 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -0800393 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800394 "libusb",
395 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700396
397 target: {
398 windows: {
399 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700400 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700401 shared_libs: ["AdbWinApi"],
402 },
403 },
zeek9afe4f82022-09-20 00:49:44 +0800404
405 test_options: {
406 // TODO(b/247985207) remove "no-remote" tag when b/247985207 is fixed.
407 tags: ["no-remote"],
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000408 },
Josh Gao361148b2018-01-02 12:01:43 -0800409}
410
Fabien Sanglard45c08c52024-07-12 12:50:57 -0700411cc_defaults {
412 name: "adb_binary_host_defaults",
Josh Gao361148b2018-01-02 12:01:43 -0800413
Josh Gao06af61e2020-02-03 23:08:05 -0800414 stl: "libc++_static",
Josh Gao361148b2018-01-02 12:01:43 -0800415 defaults: ["adb_defaults"],
416
417 srcs: [
418 "client/adb_client.cpp",
419 "client/bugreport.cpp",
420 "client/commandline.cpp",
421 "client/file_sync_client.cpp",
422 "client/main.cpp",
423 "client/console.cpp",
Idries Hamadi1ecee442018-01-29 16:30:36 +0000424 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800425 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700426 "client/fastdeploy.cpp",
427 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800428 "client/incremental.cpp",
429 "client/incremental_server.cpp",
Songchun Fan965301e2020-03-13 13:11:43 -0700430 "client/incremental_utils.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800431 "shell_service_protocol.cpp",
432 ],
433
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700434 generated_headers: [
435 "bin2c_fastdeployagent",
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000436 "bin2c_fastdeployagentscript",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700437 ],
438
Josh Gao361148b2018-01-02 12:01:43 -0800439 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800440 "libadb_crypto",
Josh Gao361148b2018-01-02 12:01:43 -0800441 "libadb_host",
Fabien Sanglard05789412024-05-30 23:00:18 -0700442 "libadb_host_protos",
Josh Gaod8bad8e2020-03-26 13:46:08 -0700443 "libadb_pairing_auth",
444 "libadb_pairing_connection",
Joshua Duong290ccb52019-11-20 14:18:43 -0800445 "libadb_protos",
Joshua Duong93b407c2020-07-30 16:34:29 -0700446 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800447 "libadb_tls_connection",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700448 "libandroidfw",
Shukang Zhou420ad552020-02-13 17:01:39 -0800449 "libapp_processes_protos_full",
Josh Gao361148b2018-01-02 12:01:43 -0800450 "libbase",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800451 "libbrotli",
Josh Gao361148b2018-01-02 12:01:43 -0800452 "libcrypto",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000453 "libcrypto_utils",
454 "libcutils",
Josh Gao361148b2018-01-02 12:01:43 -0800455 "libdiagnose_usb",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000456 "libfastdeploy_host",
457 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800458 "liblog",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800459 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800460 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800461 "libopenscreen-discovery",
462 "libopenscreen-platform-impl",
Shukang Zhou420ad552020-02-13 17:01:39 -0800463 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -0800464 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800465 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100466 "libutils",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700467 "libz",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000468 "libziparchive",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700469 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800470 ],
471
Josh Gao361148b2018-01-02 12:01:43 -0800472 // Don't add anything here, we don't want additional shared dependencies
473 // on the host adb tool, and shared libraries that link against libc++
474 // will violate ODR
475 shared_libs: [],
476
Dan Willemsen7024da42018-11-19 19:11:35 -0800477 // Archive adb, adb.exe.
478 dist: {
479 targets: [
480 "dist_files",
481 "sdk",
Shaju Mathew9510d642022-10-06 22:18:29 +0000482 "sdk-repo-platform-tools",
483 "sdk_repo",
Dan Willemsen7024da42018-11-19 19:11:35 -0800484 "win_sdk",
485 ],
486 },
487
Josh Gao361148b2018-01-02 12:01:43 -0800488 target: {
489 darwin: {
490 cflags: [
491 "-Wno-sizeof-pointer-memaccess",
492 ],
493 },
494 windows: {
495 enabled: true,
496 ldflags: ["-municode"],
Josh Gao361148b2018-01-02 12:01:43 -0800497 shared_libs: ["AdbWinApi"],
498 required: [
499 "AdbWinUsbApi",
500 ],
501 },
502 },
503}
504
Fabien Sanglard45c08c52024-07-12 12:50:57 -0700505cc_binary_host {
506 name: "adb",
507 defaults: ["adb_binary_host_defaults"],
508}
509
510cc_binary_host {
511 name: "adb_asan",
512 defaults: ["adb_binary_host_defaults"],
513 target: {
Nadia Agueeva72e1ac42024-08-07 18:12:28 +0000514 darwin: {
515 sanitize: {
516 address: true,
Fabien Sanglard45c08c52024-07-12 12:50:57 -0700517 },
Nadia Agueeva72e1ac42024-08-07 18:12:28 +0000518 strip: {
519 none: true,
Fabien Sanglard45c08c52024-07-12 12:50:57 -0700520 },
Nadia Agueeva72e1ac42024-08-07 18:12:28 +0000521 },
522 linux: {
523 sanitize: {
524 address: true,
525 },
526 strip: {
527 none: true,
528 },
529 },
530 // Not supported on Windows yet...
531 windows: {
532 enabled: false,
533 },
Fabien Sanglard45c08c52024-07-12 12:50:57 -0700534 },
535}
536
Tao Bao49042e32018-07-30 20:45:27 -0700537// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800538cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700539 name: "libadbd_core",
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000540 defaults: [
541 "adbd_defaults",
542 "host_adbd_supported",
543 ],
Tao Bao49042e32018-07-30 20:45:27 -0700544 recovery_available: true,
545
546 // libminadbd wants both, as it's used to build native tests.
547 compile_multilib: "both",
548
Josh Gaodd716422019-07-11 13:47:44 -0700549 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gaoa5baef92020-04-22 17:30:06 -0700550 "daemon/adb_wifi.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700551 "daemon/auth.cpp",
552 "daemon/jdwp_service.cpp",
Josh Gaobd775212020-02-26 16:39:20 -0800553 "daemon/logging.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700554 "daemon/transport_local.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700555 ],
556
Dan Willemsen18861892018-08-29 14:58:02 -0700557 generated_headers: ["platform_tools_version"],
558
Tao Bao49042e32018-07-30 20:45:27 -0700559 static_libs: [
560 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700561 ],
562
563 shared_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800564 "libadb_crypto",
Joshua Duong290ccb52019-11-20 14:18:43 -0800565 "libadb_pairing_connection",
566 "libadb_protos",
567 "libadb_tls_connection",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000568 "libadbconnection_server",
Josh Gao7cac88a2019-10-22 12:30:39 -0700569 "libadbd_auth",
Josh Gaofa3605a2020-03-16 11:30:09 -0700570 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700571 "libasyncio",
572 "libbase",
573 "libcrypto",
574 "libcrypto_utils",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700575 "libcutils_sockets",
Tao Bao49042e32018-07-30 20:45:27 -0700576 "liblog",
577 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800578
Shukang Zhou420ad552020-02-13 17:01:39 -0800579 proto: {
580 type: "lite",
581 static: true,
582 export_proto_headers: true,
583 },
584
Josh Gao0560feb2019-01-22 19:36:15 -0800585 target: {
586 android: {
Josh Gao0560feb2019-01-22 19:36:15 -0800587 srcs: [
Josh Gao822f6742021-02-03 22:12:41 -0800588 "daemon/property_monitor.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800589 "daemon/usb.cpp",
590 "daemon/usb_ffs.cpp",
Josh Gao2dc61962021-02-03 22:11:45 -0800591 "daemon/watchdog.cpp",
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000592 ],
Joshua Duong929364a2020-02-26 15:43:44 -0800593 },
594 recovery: {
595 exclude_shared_libs: [
596 "libadb_pairing_auth",
597 "libadb_pairing_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700598 "libapp_processes_protos_lite",
Joshua Duong929364a2020-02-26 15:43:44 -0800599 ],
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000600 },
Josh Gao0560feb2019-01-22 19:36:15 -0800601 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700602
Jooyung Han9864dad2021-11-22 10:15:19 +0900603 min_sdk_version: "30",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700604 apex_available: [
605 "//apex_available:platform",
606 "com.android.adbd",
607 ],
608 visibility: [
609 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000610 "//packages/modules/adb:__subpackages__",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700611 ],
Tao Bao49042e32018-07-30 20:45:27 -0700612}
613
Josh Gao2029a372020-03-09 15:20:55 -0700614cc_library {
Tao Bao49042e32018-07-30 20:45:27 -0700615 name: "libadbd_services",
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000616 defaults: [
617 "adbd_defaults",
618 "host_adbd_supported",
619 ],
Tao Bao49042e32018-07-30 20:45:27 -0700620 recovery_available: true,
621 compile_multilib: "both",
622
Liz Kammer58c71732023-10-13 17:15:06 -0400623 // avoid getting duplicate symbol of android::build::getbuildnumber().
624 use_version_lib: false,
625
Tao Bao49042e32018-07-30 20:45:27 -0700626 srcs: [
627 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700628 "daemon/services.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700629 "daemon/shell_service.cpp",
630 "shell_service_protocol.cpp",
631 ],
632
633 cflags: [
634 "-D_GNU_SOURCE",
635 "-Wno-deprecated-declarations",
636 ],
637
638 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800639 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700640 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800641 "libbrotli",
Tao Bao49042e32018-07-30 20:45:27 -0700642 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700643 "liblz4",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000644 "libprotobuf-cpp-lite",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700645 "libzstd",
Tao Bao49042e32018-07-30 20:45:27 -0700646 ],
647
648 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800649 "libadb_crypto",
650 "libadb_pairing_connection",
651 "libadb_protos",
652 "libadb_tls_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700653 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700654 "libasyncio",
655 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700656 "libcrypto_utils",
Josh Gao2029a372020-03-09 15:20:55 -0700657 "libcutils_sockets",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700658
659 // APEX dependencies.
660 "libadbd_auth",
661 "libadbd_fs",
662 "libcrypto",
663 "liblog",
Tao Bao49042e32018-07-30 20:45:27 -0700664 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800665
666 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800667 android: {
668 srcs: [
669 "daemon/abb_service.cpp",
670 "daemon/framebuffer_service.cpp",
671 "daemon/mdns.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800672 "daemon/restart_service.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800673 ],
674 shared_libs: [
LuK13371c07e732020-09-16 19:35:05 +0200675 "libbinder_ndk",
Josh Gao0560feb2019-01-22 19:36:15 -0800676 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800677 "libselinux",
678 ],
LuK13371c07e732020-09-16 19:35:05 +0200679 static_libs: [
680 "adbroot_aidl_interface-ndk",
681 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800682 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800683 recovery: {
684 exclude_srcs: [
685 "daemon/abb_service.cpp",
686 ],
Joshua Duong929364a2020-02-26 15:43:44 -0800687 exclude_shared_libs: [
LuK13371c07e732020-09-16 19:35:05 +0200688 "libbinder_ndk",
Joshua Duong929364a2020-02-26 15:43:44 -0800689 "libadb_pairing_auth",
690 "libadb_pairing_connection",
691 ],
LuK13371c07e732020-09-16 19:35:05 +0200692 exclude_static_libs: [
693 "adbroot_aidl_interface-ndk",
694 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800695 },
696 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700697
Jooyung Han9864dad2021-11-22 10:15:19 +0900698 min_sdk_version: "30",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700699 apex_available: [
700 "//apex_available:platform",
701 "com.android.adbd",
702 ],
703 visibility: [
Baligh Uddin95e03672020-10-18 15:09:52 +0000704 "//packages/modules/adb",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700705 ],
706
Tao Bao49042e32018-07-30 20:45:27 -0700707}
708
709cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800710 name: "libadbd",
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000711 defaults: [
712 "adbd_defaults",
713 "host_adbd_supported",
714 ],
Jiyong Parkeb590392018-05-24 14:11:00 +0900715 recovery_available: true,
Jooyung Han9864dad2021-11-22 10:15:19 +0900716 min_sdk_version: "30",
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000717 apex_available: ["com.android.adbd"],
Josh Gao361148b2018-01-02 12:01:43 -0800718
Josh Gaobf5a9362020-01-22 17:58:03 -0800719 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Bao49042e32018-07-30 20:45:27 -0700720 use_version_lib: false,
721
722 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800723 compile_multilib: "both",
Tao Bao49042e32018-07-30 20:45:27 -0700724
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000725 static_libs: [
726 "libadbd_core",
727 "libadbd_services",
728 "libbrotli",
729 "libcutils_sockets",
730 "libdiagnose_usb",
731 "liblz4",
732 "libmdnssd",
733 "libprotobuf-cpp-lite",
734 "libzstd",
735 ],
736
Tao Bao49042e32018-07-30 20:45:27 -0700737 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700738 "libadbconnection_server",
739 "libapp_processes_protos_lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800740 "libadb_crypto",
741 "libadb_pairing_connection",
742 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800743 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800744 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700745 "libcrypto",
746 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700747 "liblog",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800748 "libselinux",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700749
750 // APEX dependencies on the system image.
751 "libadbd_auth",
752 "libadbd_fs",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800753 ],
754
Joshua Duong929364a2020-02-26 15:43:44 -0800755 target: {
756 recovery: {
757 exclude_shared_libs: [
758 "libadb_pairing_auth",
759 "libadb_pairing_connection",
760 ],
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000761 },
Joshua Duong929364a2020-02-26 15:43:44 -0800762 },
763
Josh Gao6b55e752020-03-27 18:09:56 -0700764 visibility: [
765 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000766 "//packages/modules/adb",
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700767 ],
Josh Gao361148b2018-01-02 12:01:43 -0800768}
769
770cc_binary {
771 name: "adbd",
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000772 defaults: [
773 "adbd_defaults",
774 "host_adbd_supported",
775 "libadbd_binary_dependencies",
776 ],
Jiyong Parkeb590392018-05-24 14:11:00 +0900777 recovery_available: true,
Jooyung Han9864dad2021-11-22 10:15:19 +0900778 min_sdk_version: "30",
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000779 apex_available: ["com.android.adbd"],
Josh Gao3e0540a2018-03-06 12:57:27 -0800780
Josh Gao361148b2018-01-02 12:01:43 -0800781 srcs: [
782 "daemon/main.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800783 ],
784
785 cflags: [
786 "-D_GNU_SOURCE",
787 "-Wno-deprecated-declarations",
788 ],
789
790 strip: {
791 keep_symbols: true,
792 },
793
Josh Gao2bfc85e2019-08-15 14:05:12 -0700794 static_libs: [
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +0000795 "libadb_protos",
Josh Gao361148b2018-01-02 12:01:43 -0800796 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700797 "libadbd_services",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700798 "libasyncio",
Tao Bao49042e32018-07-30 20:45:27 -0700799 "libcap",
Josh Gaofb386cc2020-03-26 22:02:03 -0700800 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800801 "libminijail",
Joshua Duong290ccb52019-11-20 14:18:43 -0800802 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800803 ],
Josh Gao2bfc85e2019-08-15 14:05:12 -0700804
805 shared_libs: [
Josh Gao090712a2020-01-16 12:40:43 -0800806 "libadbd_auth",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700807 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800808
Joshua Duong929364a2020-02-26 15:43:44 -0800809 target: {
LuK13371c07e732020-09-16 19:35:05 +0200810 android: {
811 shared_libs: [
812 "libbinder_ndk",
813 ],
814
815 static_libs: [
816 "adbroot_aidl_interface-ndk",
817 ],
818 },
819
Joshua Duong929364a2020-02-26 15:43:44 -0800820 recovery: {
821 exclude_shared_libs: [
822 "libadb_pairing_auth",
823 "libadb_pairing_connection",
LuK13371c07e732020-09-16 19:35:05 +0200824 "libbinder_ndk",
825 ],
826
827 exclude_static_libs: [
828 "adbroot_aidl_interface-ndk",
Joshua Duong929364a2020-02-26 15:43:44 -0800829 ],
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000830 },
Joshua Duong929364a2020-02-26 15:43:44 -0800831 },
Josh Gao361148b2018-01-02 12:01:43 -0800832}
833
Josh Gao06e45932019-10-23 13:27:17 -0700834phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700835 // Interface between adbd in a module and the system.
836 name: "adbd_system_api",
Josh Gao06e45932019-10-23 13:27:17 -0700837 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700838 "libadbd_auth",
839 "libadbd_fs",
Josh Gao06e45932019-10-23 13:27:17 -0700840 "abb",
Josh Gao83ce3e22019-10-22 12:30:36 -0700841 "reboot",
Yi-Yo Chiangc24ad0d2022-08-05 12:07:34 +0800842 ],
843 product_variables: {
844 debuggable: {
845 required: [
846 "remount",
Yi-Yo Chiangc24ad0d2022-08-05 12:07:34 +0800847 ],
848 },
849 },
Josh Gao06e45932019-10-23 13:27:17 -0700850}
851
852phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700853 name: "adbd_system_api_recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700854 required: [
Inseob Kimfc0410d2021-06-30 15:07:24 +0900855 "libadbd_auth.recovery",
856 "libadbd_fs.recovery",
Josh Gao83ce3e22019-10-22 12:30:36 -0700857 "reboot.recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700858 ],
859}
860
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800861cc_binary {
LuK13371c07e732020-09-16 19:35:05 +0200862 name: "adb_root",
863 srcs: [
864 "root/adbroot_service.cpp",
865 "root/main.cpp",
866 ],
867 init_rc: [
868 "root/adb_root.rc",
869 ],
870 shared_libs: [
871 "libbase",
872 "libbinder_ndk",
873 "liblog",
874 "libutils",
875 ],
876 static_libs: [
877 "adbroot_aidl_interface-ndk",
878 ],
879 system_ext_specific: true,
880}
881
882cc_binary {
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800883 name: "abb",
884
Josh Gao0560feb2019-01-22 19:36:15 -0800885 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800886 stl: "libc++",
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800887 recovery_available: false,
888
889 srcs: [
890 "daemon/abb.cpp",
891 ],
892
893 cflags: [
894 "-D_GNU_SOURCE",
895 "-Wno-deprecated-declarations",
896 ],
897
898 strip: {
899 keep_symbols: true,
900 },
901
902 static_libs: [
903 "libadbd_core",
904 "libadbd_services",
905 "libcmd",
906 ],
907
908 shared_libs: [
909 "libbase",
910 "libbinder",
911 "liblog",
912 "libutils",
913 "libselinux",
914 ],
915}
916
Jingwen Chene29935e2022-12-10 03:50:12 +0000917ADBD_TEST_LIBS = [
918 "libadbd",
919 "libadbd_auth",
920 "libbase",
Jingwen Chene29935e2022-12-10 03:50:12 +0000921 "libusb",
922]
923
Josh Gao361148b2018-01-02 12:01:43 -0800924cc_test {
925 name: "adbd_test",
Josh Gao06af61e2020-02-03 23:08:05 -0800926
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000927 defaults: [
928 "adbd_defaults",
929 "libadbd_binary_dependencies",
930 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800931
932 recovery_available: false,
Josh Gao361148b2018-01-02 12:01:43 -0800933 srcs: libadb_test_srcs + [
Shaju Mathewccdd7ff2023-02-01 03:00:40 -0800934 "daemon/restart_service.cpp",
935 "daemon/restart_service_test.cpp",
Josh Gao5607e922018-07-25 18:15:52 -0700936 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800937 "daemon/shell_service.cpp",
938 "daemon/shell_service_test.cpp",
Shaju Mathew3f7b4402023-01-19 21:56:37 -0800939 "test_utils/test_utils.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800940 "shell_service_protocol_test.cpp",
Joshua Duong77b8ff32020-04-16 15:58:19 -0700941 "mdns_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800942 ],
943
Fabien Sanglardfcd64992022-09-02 17:43:55 -0700944 test_config: "adbd_test.xml",
Chen Zhu72ccee32020-05-08 16:45:11 -0700945
Josh Gao822f6742021-02-03 22:12:41 -0800946 target: {
947 android: {
948 srcs: [
949 "daemon/property_monitor_test.cpp",
950 ],
951 },
952 },
953
Josh Gaodc20c2f2020-03-27 19:41:59 -0700954 shared_libs: [
955 "liblog",
956 ],
957
Ryan Pricharddbc810f2024-05-23 15:12:43 -0700958 version_script: "adbd_test.map",
959 stl: "libc++_static",
Jingwen Chene29935e2022-12-10 03:50:12 +0000960 static_libs: ADBD_TEST_LIBS,
961
962 // Shared lib versions of static libs can potentially come from
963 // libadbd_binary_dependencies (e.g. libbase as a shared_lib, depending on
964 // library_linking_strategy), which will cause both shared/static versions of
965 // the same library to be in the link action.
966 //
967 // adbd_test uses the static version of these libraries above, so exclude them here.
968 exclude_shared_libs: ADBD_TEST_LIBS,
969
Aditya Choudhary1d87c972024-02-02 13:55:51 +0000970 test_suites: [
971 "general-tests",
972 "mts-adbd",
973 ],
Dan Shi22e091b2019-09-24 09:04:05 -0700974 require_root: true,
Josh Gao361148b2018-01-02 12:01:43 -0800975}
976
Julien Desprezae94f512018-08-08 12:08:50 -0700977python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800978 name: "adb_integration_test_adb",
979 main: "test_adb.py",
980 srcs: [
981 "test_adb.py",
982 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700983 test_config: "adb_integration_test_adb.xml",
984 test_suites: ["general-tests"],
Julien Desprezb099b532021-03-25 19:26:23 +0000985 test_options: {
986 unit_test: false,
987 },
GuangHui Liu35994392017-05-10 14:37:17 -0700988}
989
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700990python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800991 name: "adb_integration_test_device",
992 main: "test_device.py",
993 srcs: [
Fabien Sanglard15335e02024-03-05 21:33:44 +0000994 "proto/app_processes.proto",
Nadia Agueeva72e1ac42024-08-07 18:12:28 +0000995 ":adb_host_proto",
Elliott Hughes307e7672018-02-16 17:58:14 -0800996 "test_device.py",
997 ],
Fabien Sanglard3d155b62023-11-30 14:52:40 -0800998 proto: {
999 canonical_path_from_root: false,
1000 },
Elliott Hughes307e7672018-02-16 17:58:14 -08001001 libs: [
1002 "adb_py",
Fabien Sanglard3d155b62023-11-30 14:52:40 -08001003 "libprotobuf-python",
Elliott Hughes307e7672018-02-16 17:58:14 -08001004 ],
Julien Desprezcd11d0d2018-10-12 13:48:14 -07001005 test_config: "adb_integration_test_device.xml",
1006 test_suites: ["general-tests"],
Julien Desprezb099b532021-03-25 19:26:23 +00001007 test_options: {
1008 unit_test: false,
1009 },
Fabien Sanglard15335e02024-03-05 21:33:44 +00001010 data: [
1011 ":adb_test_app1",
1012 ":adb_test_app2",
1013 ],
GuangHui Liu35994392017-05-10 14:37:17 -07001014}
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001015
1016// Note: using pipe for xxd to control the variable name generated
1017// the default name used by xxd is the path to the input file.
1018java_genrule {
1019 name: "bin2c_fastdeployagent",
1020 out: ["deployagent.inc"],
1021 srcs: [":deployagent"],
1022 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
1023}
1024
1025genrule {
1026 name: "bin2c_fastdeployagentscript",
1027 out: ["deployagentscript.inc"],
1028 srcs: ["fastdeploy/deployagent/deployagent.sh"],
1029 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
1030}
1031
1032cc_library_host_static {
1033 name: "libfastdeploy_host",
1034 defaults: ["adb_defaults"],
1035 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -07001036 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001037 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
1038 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
1039 "fastdeploy/proto/ApkEntry.proto",
1040 ],
1041 static_libs: [
1042 "libadb_host",
1043 "libandroidfw",
1044 "libbase",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001045 "libcrypto",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +00001046 "libcrypto_utils",
1047 "libcutils",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001048 "libdiagnose_usb",
1049 "liblog",
1050 "libmdnssd",
1051 "libusb",
1052 "libutils",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001053 "libz",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +00001054 "libziparchive",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001055 ],
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001056 proto: {
1057 type: "lite",
1058 export_proto_headers: true,
1059 },
1060 target: {
1061 windows: {
1062 enabled: true,
1063 shared_libs: ["AdbWinApi"],
1064 },
1065 },
1066}
1067
1068cc_test_host {
1069 name: "fastdeploy_test",
1070 defaults: ["adb_defaults"],
1071 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -07001072 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001073 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
1074 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
1075 ],
1076 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -08001077 "libadb_crypto_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001078 "libadb_host",
Fabien Sanglard05789412024-05-30 23:00:18 -07001079 "libadb_host_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -08001080 "libadb_pairing_auth_static",
1081 "libadb_pairing_connection_static",
1082 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -07001083 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -08001084 "libadb_tls_connection_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001085 "libandroidfw",
1086 "libbase",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001087 "libcrypto",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +00001088 "libcrypto_utils",
1089 "libcutils",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001090 "libdiagnose_usb",
1091 "libfastdeploy_host",
1092 "liblog",
1093 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -08001094 "libopenscreen-discovery",
1095 "libopenscreen-platform-impl",
Fabien Sanglard3d155b62023-11-30 14:52:40 -08001096 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -08001097 "libssl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001098 "libusb",
1099 "libutils",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001100 "libz",
Oriol Prieto Gasco532e5702021-08-20 14:36:42 +00001101 "libziparchive",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001102 ],
1103 target: {
1104 windows: {
1105 enabled: true,
1106 shared_libs: ["AdbWinApi"],
1107 },
1108 },
1109 data: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -07001110 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001111 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy1af550e2019-09-16 12:10:54 -07001112 "fastdeploy/testdata/sample.apk",
1113 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -07001114 ],
1115}
LuK13371c07e732020-09-16 19:35:05 +02001116
1117aidl_interface {
1118 name: "adbroot_aidl_interface",
1119 unstable: true,
1120 local_include_dir: "aidl",
1121 srcs: [
1122 "aidl/android/adbroot/IADBRootService.aidl",
1123 ],
1124 backend: {
1125 cpp: {
1126 enabled: false,
1127 },
1128 java: {
1129 enabled: false,
1130 },
1131 ndk: {
1132 apex_available: [
1133 "//apex_available:platform",
1134 "com.android.adbd",
1135 ],
1136 min_sdk_version: "30",
1137 },
1138 },
1139}
1140
1141filegroup {
1142 name: "adbrootservice_aidl",
1143 srcs: [
1144 "aidl/android/adbroot/IADBRootService.aidl",
1145 ],
1146}