blob: 64c5bc70eeb46ccbbf7a00be847dc5db430a978e [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",
Joshua Duongf4ba8d72021-01-13 12:18:15 -080035 "bugprone-use-after-move",
Joshua Duongb5c3bec2020-07-17 14:14:00 -070036]
37
Josh Gao361148b2018-01-02 12:01:43 -080038cc_defaults {
39 name: "adb_defaults",
40
41 cflags: [
42 "-Wall",
43 "-Wextra",
44 "-Werror",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070045 "-Wexit-time-destructors",
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",
Bowgo Tsai35b817b2019-03-12 04:25:33 +080051 "-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",
65 "-lobjc",
66 ],
Joshua Duong28fd4e52021-03-19 12:12:35 -070067 cflags: [
68 // Required, to use the new IPv6 Sockets options introduced by RFC 3542.
69 "-D__APPLE_USE_RFC_3542",
70 ],
Josh Gao361148b2018-01-02 12:01:43 -080071 },
72
73 windows: {
74 cflags: [
75 // Define windows.h and tchar.h Unicode preprocessor symbols so that
76 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
77 // build if you accidentally pass char*. Fix by calling like:
78 // std::wstring path_wide;
79 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
80 // CreateFileW(path_wide.c_str());
81 "-DUNICODE=1",
82 "-D_UNICODE=1",
83
Elliott Hughesc229a722018-12-03 09:02:18 -080084 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao361148b2018-01-02 12:01:43 -080085 "-D_GNU_SOURCE",
Josh Gao96049b92018-03-23 13:03:28 -070086
87 // MinGW hides some things behind _POSIX_SOURCE.
88 "-D_POSIX_SOURCE",
Josh Gao0560feb2019-01-22 19:36:15 -080089
Josh Gaoc3b64032019-04-17 16:57:43 -070090 // libusb uses __stdcall on a variadic function, which gets ignored.
91 "-Wno-ignored-attributes",
92
Josh Gao0560feb2019-01-22 19:36:15 -080093 // Not supported yet.
94 "-Wno-thread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080095 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -070096
97 host_ldlibs: [
98 "-lws2_32",
99 "-lgdi32",
100 "-luserenv",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800101 "-liphlpapi",
Josh Gaoea7b95a2018-03-23 15:37:20 -0700102 ],
Josh Gao361148b2018-01-02 12:01:43 -0800103 },
Josh Gao0560feb2019-01-22 19:36:15 -0800104 },
Joshua Duongb5c3bec2020-07-17 14:14:00 -0700105
106 tidy: true,
107 tidy_checks: tidy_errors,
108 tidy_checks_as_errors: tidy_errors,
Josh Gao0560feb2019-01-22 19:36:15 -0800109}
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -0700110
Josh Gao0560feb2019-01-22 19:36:15 -0800111cc_defaults {
112 name: "adbd_defaults",
113 defaults: ["adb_defaults"],
114
115 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
Josh Gao361148b2018-01-02 12:01:43 -0800116}
117
Josh Gao0560feb2019-01-22 19:36:15 -0800118cc_defaults {
119 name: "host_adbd_supported",
120
121 host_supported: true,
122 target: {
123 linux: {
124 enabled: true,
125 host_ldlibs: [
126 "-lresolv", // b64_pton
127 "-lutil", // forkpty
128 ],
129 },
130 darwin: {
131 enabled: false,
132 },
133 windows: {
134 enabled: false,
135 },
136 },
137}
138
Liz Kammer6836b052021-01-22 13:39:03 -0500139soong_config_module_type_import {
140 from: "system/apex/Android.bp",
141 module_types: ["library_linking_strategy_cc_defaults"],
142}
143
144library_linking_strategy_cc_defaults {
Josh Gaodc20c2f2020-03-27 19:41:59 -0700145 name: "libadbd_binary_dependencies",
146 static_libs: [
147 "libadb_crypto",
148 "libadb_pairing_connection",
Joshua Duong93b407c2020-07-30 16:34:29 -0700149 "libadb_sysdeps",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700150 "libadb_tls_connection",
151 "libadbd",
152 "libadbd_core",
153 "libadbconnection_server",
154 "libasyncio",
155 "libbrotli",
Josh Gao7e3f8112021-04-09 17:32:58 -0700156 "libcrypto_utils",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700157 "libcutils_sockets",
158 "libdiagnose_usb",
159 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700160 "libzstd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700161
162 "libadb_protos",
163 "libapp_processes_protos_lite",
164 "libprotobuf-cpp-lite",
165 ],
166
167 shared_libs: [
168 "libadbd_auth",
169 "libadbd_fs",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700170 "liblog",
171 "libselinux",
172 ],
173
Liz Kammer6836b052021-01-22 13:39:03 -0500174 soong_config_variables:{
175 library_linking_strategy: {
176 prefer_static: {
177 static_libs: [
178 "libbase",
179 ],
180 },
181 conditions_default: {
182 shared_libs: [
183 "libbase",
184 ],
185 },
186 },
187 },
188
Josh Gaodc20c2f2020-03-27 19:41:59 -0700189 target: {
Josh Gao7e3f8112021-04-09 17:32:58 -0700190 android: {
191 shared_libs: ["libcrypto"],
192 },
193 linux_glibc: {
194 static_libs: ["libcrypto_static"],
195 },
Josh Gaodc20c2f2020-03-27 19:41:59 -0700196 recovery: {
197 exclude_static_libs: [
198 "libadb_pairing_auth",
199 "libadb_pairing_connection",
200 ],
201 },
202 },
203}
204
Josh Gao361148b2018-01-02 12:01:43 -0800205// libadb
206// =========================================================
207// These files are compiled for both the host and the device.
208libadb_srcs = [
209 "adb.cpp",
210 "adb_io.cpp",
211 "adb_listeners.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800212 "adb_mdns.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800213 "adb_trace.cpp",
Josh Gao7d5762c2018-05-24 22:54:50 -0700214 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800215 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700216 "fdevent/fdevent.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800217 "services.cpp",
218 "sockets.cpp",
219 "socket_spec.cpp",
Joshua Duong93b407c2020-07-30 16:34:29 -0700220 "sysdeps/env.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800221 "sysdeps/errno.cpp",
222 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700223 "transport_fd.cpp",
Yurii Zubrytskyie5e6b0d2019-07-12 14:11:54 -0700224 "types.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800225]
226
Josh Gaod7c49ec2020-04-20 19:22:05 -0700227libadb_darwin_srcs = [
228 "fdevent/fdevent_poll.cpp",
229]
230
231libadb_windows_srcs = [
232 "fdevent/fdevent_poll.cpp",
233 "sysdeps_win32.cpp",
234 "sysdeps/win32/errno.cpp",
235 "sysdeps/win32/stat.cpp",
236]
237
Josh Gao361148b2018-01-02 12:01:43 -0800238libadb_posix_srcs = [
239 "sysdeps_unix.cpp",
240 "sysdeps/posix/network.cpp",
241]
242
Josh Gaodd716422019-07-11 13:47:44 -0700243libadb_linux_srcs = [
244 "fdevent/fdevent_epoll.cpp",
245]
246
Josh Gao361148b2018-01-02 12:01:43 -0800247libadb_test_srcs = [
248 "adb_io_test.cpp",
249 "adb_listeners_test.cpp",
250 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700251 "fdevent/fdevent_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800252 "socket_spec_test.cpp",
253 "socket_test.cpp",
254 "sysdeps_test.cpp",
255 "sysdeps/stat_test.cpp",
256 "transport_test.cpp",
Josh Gao9f155db2018-04-03 14:37:11 -0700257 "types_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800258]
259
260cc_library_host_static {
261 name: "libadb_host",
262 defaults: ["adb_defaults"],
263
264 srcs: libadb_srcs + [
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800265 "client/openscreen/mdns_service_info.cpp",
266 "client/openscreen/mdns_service_watcher.cpp",
267 "client/openscreen/platform/logging.cpp",
268 "client/openscreen/platform/task_runner.cpp",
269 "client/openscreen/platform/udp_socket.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800270 "client/auth.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800271 "client/adb_wifi.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800272 "client/usb_libusb.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700273 "client/transport_local.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800274 "client/mdnsresponder_client.cpp",
Joshua Duongf2a0d872020-04-30 15:45:38 -0700275 "client/mdns_utils.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800276 "client/transport_mdns.cpp",
Josh Gao6b55e752020-03-27 18:09:56 -0700277 "client/transport_usb.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800278 "client/pairing/pairing_client.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800279 ],
280
Dan Willemsen18861892018-08-29 14:58:02 -0700281 generated_headers: ["platform_tools_version"],
282
Josh Gao361148b2018-01-02 12:01:43 -0800283 target: {
284 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700285 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800286 },
287 darwin: {
Josh Gaod7c49ec2020-04-20 19:22:05 -0700288 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800289 },
Josh Gao361148b2018-01-02 12:01:43 -0800290 not_windows: {
291 srcs: libadb_posix_srcs,
292 },
293 windows: {
294 enabled: true,
295 srcs: [
296 "client/usb_windows.cpp",
Josh Gaod7c49ec2020-04-20 19:22:05 -0700297 ] + libadb_windows_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800298 shared_libs: ["AdbWinApi"],
299 },
300 },
301
302 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800303 "libadb_crypto",
304 "libadb_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800305 "libadb_pairing_connection",
306 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800307 "libbase",
308 "libcrypto_utils",
309 "libcrypto",
310 "libdiagnose_usb",
311 "libmdnssd",
312 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100313 "libutils",
314 "liblog",
315 "libcutils",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800316 "libopenscreen-discovery",
317 "libopenscreen-platform-impl",
Joshua Duong290ccb52019-11-20 14:18:43 -0800318 "libprotobuf-cpp-lite",
Josh Gao361148b2018-01-02 12:01:43 -0800319 ],
320}
321
Joshua Duong93b407c2020-07-30 16:34:29 -0700322cc_library {
323 name: "libadb_sysdeps",
324 defaults: ["adb_defaults"],
325 recovery_available: true,
326 host_supported: true,
327 compile_multilib: "both",
328 min_sdk_version: "apex_inherit",
Jiyong Parkc55fa5c2020-08-25 17:05:41 +0900329 // This library doesn't use build::GetBuildNumber()
330 use_version_lib: false,
Joshua Duong93b407c2020-07-30 16:34:29 -0700331
332 srcs: [
333 "sysdeps/env.cpp",
334 ],
335
336 shared_libs: [
337 "libbase",
338 "liblog",
339 ],
340
341 target: {
342 windows: {
343 enabled: true,
344 ldflags: ["-municode"],
345 },
346 },
347
348 export_include_dirs: ["."],
349
350 visibility: [
Joshua Duong93b407c2020-07-30 16:34:29 -0700351 "//bootable/recovery/minadbd:__subpackages__",
Baligh Uddin95e03672020-10-18 15:09:52 +0000352 "//packages/modules/adb:__subpackages__",
Joshua Duong93b407c2020-07-30 16:34:29 -0700353 ],
354
355 apex_available: [
356 "com.android.adbd",
357 "test_com.android.adbd",
358 ],
359}
360
Josh Gao361148b2018-01-02 12:01:43 -0800361cc_test_host {
362 name: "adb_test",
363 defaults: ["adb_defaults"],
Joshua Duongf2a0d872020-04-30 15:45:38 -0700364 srcs: libadb_test_srcs + [
365 "client/mdns_utils_test.cpp",
366 ],
367
Josh Gao361148b2018-01-02 12:01:43 -0800368 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800369 "libadb_crypto_static",
Josh Gao361148b2018-01-02 12:01:43 -0800370 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800371 "libadb_pairing_auth_static",
372 "libadb_pairing_connection_static",
373 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700374 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800375 "libadb_tls_connection_static",
Josh Gao361148b2018-01-02 12:01:43 -0800376 "libbase",
377 "libcutils",
378 "libcrypto_utils",
379 "libcrypto",
Tom Cherry49b96ec2020-01-08 13:41:56 -0800380 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800381 "libmdnssd",
382 "libdiagnose_usb",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800383 "libopenscreen-discovery",
384 "libopenscreen-platform-impl",
Joshua Duong290ccb52019-11-20 14:18:43 -0800385 "libprotobuf-cpp-lite",
386 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800387 "libusb",
388 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700389
390 target: {
391 windows: {
392 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700393 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700394 shared_libs: ["AdbWinApi"],
395 },
396 },
Josh Gao361148b2018-01-02 12:01:43 -0800397}
398
399cc_binary_host {
400 name: "adb",
Josh Gao361148b2018-01-02 12:01:43 -0800401
Josh Gao06af61e2020-02-03 23:08:05 -0800402 stl: "libc++_static",
Josh Gao361148b2018-01-02 12:01:43 -0800403 defaults: ["adb_defaults"],
404
405 srcs: [
406 "client/adb_client.cpp",
407 "client/bugreport.cpp",
408 "client/commandline.cpp",
409 "client/file_sync_client.cpp",
410 "client/main.cpp",
411 "client/console.cpp",
Idries Hamadi1ecee442018-01-29 16:30:36 +0000412 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800413 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700414 "client/fastdeploy.cpp",
415 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800416 "client/incremental.cpp",
417 "client/incremental_server.cpp",
Songchun Fan965301e2020-03-13 13:11:43 -0700418 "client/incremental_utils.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800419 "shell_service_protocol.cpp",
420 ],
421
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700422 generated_headers: [
423 "bin2c_fastdeployagent",
424 "bin2c_fastdeployagentscript"
425 ],
426
Josh Gao361148b2018-01-02 12:01:43 -0800427 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800428 "libadb_crypto",
Josh Gao361148b2018-01-02 12:01:43 -0800429 "libadb_host",
Josh Gaod8bad8e2020-03-26 13:46:08 -0700430 "libadb_pairing_auth",
431 "libadb_pairing_connection",
Joshua Duong290ccb52019-11-20 14:18:43 -0800432 "libadb_protos",
Joshua Duong93b407c2020-07-30 16:34:29 -0700433 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800434 "libadb_tls_connection",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700435 "libandroidfw",
Shukang Zhou420ad552020-02-13 17:01:39 -0800436 "libapp_processes_protos_full",
Josh Gao361148b2018-01-02 12:01:43 -0800437 "libbase",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800438 "libbrotli",
Josh Gao361148b2018-01-02 12:01:43 -0800439 "libcutils",
440 "libcrypto_utils",
441 "libcrypto",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700442 "libfastdeploy_host",
Josh Gao361148b2018-01-02 12:01:43 -0800443 "libdiagnose_usb",
444 "liblog",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800445 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800446 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800447 "libopenscreen-discovery",
448 "libopenscreen-platform-impl",
Shukang Zhou420ad552020-02-13 17:01:39 -0800449 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -0800450 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800451 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100452 "libutils",
453 "liblog",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700454 "libziparchive",
455 "libz",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700456 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800457 ],
458
Josh Gao361148b2018-01-02 12:01:43 -0800459 // Don't add anything here, we don't want additional shared dependencies
460 // on the host adb tool, and shared libraries that link against libc++
461 // will violate ODR
462 shared_libs: [],
463
Dan Willemsen7024da42018-11-19 19:11:35 -0800464 // Archive adb, adb.exe.
465 dist: {
466 targets: [
467 "dist_files",
468 "sdk",
469 "win_sdk",
470 ],
471 },
472
Josh Gao361148b2018-01-02 12:01:43 -0800473 target: {
474 darwin: {
475 cflags: [
476 "-Wno-sizeof-pointer-memaccess",
477 ],
478 },
479 windows: {
480 enabled: true,
481 ldflags: ["-municode"],
Josh Gao361148b2018-01-02 12:01:43 -0800482 shared_libs: ["AdbWinApi"],
483 required: [
484 "AdbWinUsbApi",
485 ],
486 },
487 },
488}
489
Tao Bao49042e32018-07-30 20:45:27 -0700490// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800491cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700492 name: "libadbd_core",
Josh Gao0560feb2019-01-22 19:36:15 -0800493 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700494 recovery_available: true,
495
496 // libminadbd wants both, as it's used to build native tests.
497 compile_multilib: "both",
498
Josh Gaodd716422019-07-11 13:47:44 -0700499 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gaoa5baef92020-04-22 17:30:06 -0700500 "daemon/adb_wifi.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700501 "daemon/auth.cpp",
502 "daemon/jdwp_service.cpp",
Josh Gaobd775212020-02-26 16:39:20 -0800503 "daemon/logging.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700504 "daemon/transport_local.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700505 ],
506
Dan Willemsen18861892018-08-29 14:58:02 -0700507 generated_headers: ["platform_tools_version"],
508
Tao Bao49042e32018-07-30 20:45:27 -0700509 static_libs: [
510 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700511 ],
512
513 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700514 "libadbconnection_server",
Joshua Duong090c8072019-12-19 16:36:30 -0800515 "libadb_crypto",
Joshua Duong290ccb52019-11-20 14:18:43 -0800516 "libadb_pairing_connection",
517 "libadb_protos",
518 "libadb_tls_connection",
Josh Gao7cac88a2019-10-22 12:30:39 -0700519 "libadbd_auth",
Josh Gaofa3605a2020-03-16 11:30:09 -0700520 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700521 "libasyncio",
522 "libbase",
523 "libcrypto",
524 "libcrypto_utils",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700525 "libcutils_sockets",
Tao Bao49042e32018-07-30 20:45:27 -0700526 "liblog",
527 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800528
Shukang Zhou420ad552020-02-13 17:01:39 -0800529 proto: {
530 type: "lite",
531 static: true,
532 export_proto_headers: true,
533 },
534
Josh Gao0560feb2019-01-22 19:36:15 -0800535 target: {
536 android: {
Josh Gao0560feb2019-01-22 19:36:15 -0800537 srcs: [
Josh Gao822f6742021-02-03 22:12:41 -0800538 "daemon/property_monitor.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800539 "daemon/usb.cpp",
540 "daemon/usb_ffs.cpp",
Josh Gao2dc61962021-02-03 22:11:45 -0800541 "daemon/watchdog.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800542 ]
Joshua Duong929364a2020-02-26 15:43:44 -0800543 },
544 recovery: {
545 exclude_shared_libs: [
546 "libadb_pairing_auth",
547 "libadb_pairing_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700548 "libapp_processes_protos_lite",
Joshua Duong929364a2020-02-26 15:43:44 -0800549 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800550 }
551 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700552
553 apex_available: [
554 "//apex_available:platform",
555 "com.android.adbd",
556 ],
557 visibility: [
558 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000559 "//packages/modules/adb:__subpackages__",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700560 ],
Tao Bao49042e32018-07-30 20:45:27 -0700561}
562
Josh Gao2029a372020-03-09 15:20:55 -0700563cc_library {
Tao Bao49042e32018-07-30 20:45:27 -0700564 name: "libadbd_services",
Josh Gao0560feb2019-01-22 19:36:15 -0800565 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700566 recovery_available: true,
567 compile_multilib: "both",
568
569 srcs: [
570 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700571 "daemon/services.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700572 "daemon/shell_service.cpp",
573 "shell_service_protocol.cpp",
574 ],
575
576 cflags: [
577 "-D_GNU_SOURCE",
578 "-Wno-deprecated-declarations",
579 ],
580
581 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800582 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700583 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800584 "libbrotli",
Tao Bao49042e32018-07-30 20:45:27 -0700585 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700586 "liblz4",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700587 "libzstd",
Tao Bao49042e32018-07-30 20:45:27 -0700588 ],
589
590 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800591 "libadb_crypto",
592 "libadb_pairing_connection",
593 "libadb_protos",
594 "libadb_tls_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700595 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700596 "libasyncio",
597 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700598 "libcrypto_utils",
Josh Gao2029a372020-03-09 15:20:55 -0700599 "libcutils_sockets",
Josh Gaofa3605a2020-03-16 11:30:09 -0700600 "libprotobuf-cpp-lite",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700601
602 // APEX dependencies.
603 "libadbd_auth",
604 "libadbd_fs",
605 "libcrypto",
606 "liblog",
Tao Bao49042e32018-07-30 20:45:27 -0700607 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800608
609 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800610 android: {
611 srcs: [
612 "daemon/abb_service.cpp",
613 "daemon/framebuffer_service.cpp",
614 "daemon/mdns.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800615 "daemon/restart_service.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800616 ],
617 shared_libs: [
Josh Gao0560feb2019-01-22 19:36:15 -0800618 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800619 "libselinux",
620 ],
621 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800622 recovery: {
623 exclude_srcs: [
624 "daemon/abb_service.cpp",
625 ],
Joshua Duong929364a2020-02-26 15:43:44 -0800626 exclude_shared_libs: [
627 "libadb_pairing_auth",
628 "libadb_pairing_connection",
629 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800630 },
631 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700632
633 apex_available: [
634 "//apex_available:platform",
635 "com.android.adbd",
636 ],
637 visibility: [
Baligh Uddin95e03672020-10-18 15:09:52 +0000638 "//packages/modules/adb",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700639 ],
640
Tao Bao49042e32018-07-30 20:45:27 -0700641}
642
643cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800644 name: "libadbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800645 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900646 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000647 apex_available: ["com.android.adbd"],
Josh Gao361148b2018-01-02 12:01:43 -0800648
Josh Gaobf5a9362020-01-22 17:58:03 -0800649 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Bao49042e32018-07-30 20:45:27 -0700650 use_version_lib: false,
651
652 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800653 compile_multilib: "both",
Tao Bao49042e32018-07-30 20:45:27 -0700654
Tao Bao49042e32018-07-30 20:45:27 -0700655 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700656 "libadbconnection_server",
657 "libapp_processes_protos_lite",
658 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800659 "libadb_crypto",
660 "libadb_pairing_connection",
661 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800662 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800663 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700664 "libcrypto",
665 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700666 "liblog",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800667 "libselinux",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700668
669 // APEX dependencies on the system image.
670 "libadbd_auth",
671 "libadbd_fs",
672 "libadbd_services",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800673 ],
674
Joshua Duong929364a2020-02-26 15:43:44 -0800675 target: {
676 recovery: {
677 exclude_shared_libs: [
678 "libadb_pairing_auth",
679 "libadb_pairing_connection",
680 ],
681 }
682 },
683
Josh Gaoa4dfc142020-02-19 13:50:57 -0800684 static_libs: [
Josh Gaodc20c2f2020-03-27 19:41:59 -0700685 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800686 "libbrotli",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800687 "libcutils_sockets",
688 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700689 "liblz4",
Josh Gao2e24c962020-02-21 16:38:29 -0800690 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700691 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800692 ],
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700693
Josh Gao6b55e752020-03-27 18:09:56 -0700694 visibility: [
695 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000696 "//packages/modules/adb",
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700697 ],
Josh Gao361148b2018-01-02 12:01:43 -0800698}
699
700cc_binary {
701 name: "adbd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700702 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900703 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000704 apex_available: ["com.android.adbd"],
Josh Gao3e0540a2018-03-06 12:57:27 -0800705
Josh Gao361148b2018-01-02 12:01:43 -0800706 srcs: [
707 "daemon/main.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800708 ],
709
710 cflags: [
711 "-D_GNU_SOURCE",
712 "-Wno-deprecated-declarations",
713 ],
714
715 strip: {
716 keep_symbols: true,
717 },
718
Josh Gao2bfc85e2019-08-15 14:05:12 -0700719 static_libs: [
Josh Gao361148b2018-01-02 12:01:43 -0800720 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700721 "libadbd_services",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700722 "libasyncio",
Tao Bao49042e32018-07-30 20:45:27 -0700723 "libcap",
Josh Gaofb386cc2020-03-26 22:02:03 -0700724 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800725 "libminijail",
Joshua Duong290ccb52019-11-20 14:18:43 -0800726 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800727 ],
Josh Gao2bfc85e2019-08-15 14:05:12 -0700728
729 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800730 "libadb_protos",
Josh Gao090712a2020-01-16 12:40:43 -0800731 "libadbd_auth",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700732 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800733
Joshua Duong929364a2020-02-26 15:43:44 -0800734 target: {
735 recovery: {
736 exclude_shared_libs: [
737 "libadb_pairing_auth",
738 "libadb_pairing_connection",
739 ],
740 }
741 },
Josh Gao361148b2018-01-02 12:01:43 -0800742}
743
Josh Gao06e45932019-10-23 13:27:17 -0700744phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700745 // Interface between adbd in a module and the system.
746 name: "adbd_system_api",
Josh Gao06e45932019-10-23 13:27:17 -0700747 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700748 "libadbd_auth",
749 "libadbd_fs",
Josh Gao06e45932019-10-23 13:27:17 -0700750 "abb",
Josh Gao83ce3e22019-10-22 12:30:36 -0700751 "reboot",
Josh Gaob554f4b2019-10-22 12:30:30 -0700752 "set-verity-state",
Josh Gao06e45932019-10-23 13:27:17 -0700753 ]
754}
755
756phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700757 name: "adbd_system_api_recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700758 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700759 "libadbd_auth",
760 "libadbd_fs",
Josh Gao83ce3e22019-10-22 12:30:36 -0700761 "reboot.recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700762 ],
763}
764
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800765cc_binary {
766 name: "abb",
767
Josh Gao0560feb2019-01-22 19:36:15 -0800768 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800769 stl: "libc++",
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800770 recovery_available: false,
771
772 srcs: [
773 "daemon/abb.cpp",
774 ],
775
776 cflags: [
777 "-D_GNU_SOURCE",
778 "-Wno-deprecated-declarations",
779 ],
780
781 strip: {
782 keep_symbols: true,
783 },
784
785 static_libs: [
786 "libadbd_core",
787 "libadbd_services",
788 "libcmd",
789 ],
790
791 shared_libs: [
792 "libbase",
793 "libbinder",
794 "liblog",
795 "libutils",
796 "libselinux",
797 ],
798}
799
Josh Gao361148b2018-01-02 12:01:43 -0800800cc_test {
801 name: "adbd_test",
Josh Gao06af61e2020-02-03 23:08:05 -0800802
Josh Gaodc20c2f2020-03-27 19:41:59 -0700803 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao06af61e2020-02-03 23:08:05 -0800804
805 recovery_available: false,
Josh Gao361148b2018-01-02 12:01:43 -0800806 srcs: libadb_test_srcs + [
Josh Gao5607e922018-07-25 18:15:52 -0700807 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800808 "daemon/shell_service.cpp",
809 "daemon/shell_service_test.cpp",
810 "shell_service_protocol.cpp",
811 "shell_service_protocol_test.cpp",
Joshua Duong77b8ff32020-04-16 15:58:19 -0700812 "mdns_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800813 ],
814
Chen Zhu72ccee32020-05-08 16:45:11 -0700815 test_config: "adb_test.xml",
816
Josh Gao822f6742021-02-03 22:12:41 -0800817 target: {
818 android: {
819 srcs: [
820 "daemon/property_monitor_test.cpp",
821 ],
822 },
823 },
824
Josh Gaodc20c2f2020-03-27 19:41:59 -0700825 shared_libs: [
826 "liblog",
827 ],
828
Josh Gao361148b2018-01-02 12:01:43 -0800829 static_libs: [
830 "libadbd",
Josh Gao7cac88a2019-10-22 12:30:39 -0700831 "libadbd_auth",
Josh Gao361148b2018-01-02 12:01:43 -0800832 "libbase",
Josh Gao361148b2018-01-02 12:01:43 -0800833 "libcrypto_utils",
Josh Gao361148b2018-01-02 12:01:43 -0800834 "libusb",
Josh Gao361148b2018-01-02 12:01:43 -0800835 ],
easoncylee83d1c9d2021-04-15 16:28:54 +0800836 test_suites: ["general-tests", "mts-adbd"],
Dan Shi22e091b2019-09-24 09:04:05 -0700837 require_root: true,
Josh Gao361148b2018-01-02 12:01:43 -0800838}
839
Julien Desprezae94f512018-08-08 12:08:50 -0700840python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800841 name: "adb_integration_test_adb",
842 main: "test_adb.py",
843 srcs: [
844 "test_adb.py",
845 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700846 test_config: "adb_integration_test_adb.xml",
847 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800848 version: {
849 py2: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700850 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800851 },
852 py3: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700853 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800854 },
GuangHui Liu35994392017-05-10 14:37:17 -0700855 },
Julien Desprezb099b532021-03-25 19:26:23 +0000856 test_options: {
857 unit_test: false,
858 },
GuangHui Liu35994392017-05-10 14:37:17 -0700859}
860
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700861python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800862 name: "adb_integration_test_device",
863 main: "test_device.py",
864 srcs: [
865 "test_device.py",
866 ],
867 libs: [
868 "adb_py",
869 ],
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700870 test_config: "adb_integration_test_device.xml",
871 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800872 version: {
873 py2: {
Josh Gao4218d852020-02-06 17:52:38 -0800874 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800875 },
876 py3: {
Josh Gao4218d852020-02-06 17:52:38 -0800877 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800878 },
GuangHui Liu35994392017-05-10 14:37:17 -0700879 },
Julien Desprezb099b532021-03-25 19:26:23 +0000880 test_options: {
881 unit_test: false,
882 },
GuangHui Liu35994392017-05-10 14:37:17 -0700883}
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700884
885// Note: using pipe for xxd to control the variable name generated
886// the default name used by xxd is the path to the input file.
887java_genrule {
888 name: "bin2c_fastdeployagent",
889 out: ["deployagent.inc"],
890 srcs: [":deployagent"],
891 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
892}
893
894genrule {
895 name: "bin2c_fastdeployagentscript",
896 out: ["deployagentscript.inc"],
897 srcs: ["fastdeploy/deployagent/deployagent.sh"],
898 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
899}
900
901cc_library_host_static {
902 name: "libfastdeploy_host",
903 defaults: ["adb_defaults"],
904 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700905 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700906 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
907 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
908 "fastdeploy/proto/ApkEntry.proto",
909 ],
910 static_libs: [
911 "libadb_host",
912 "libandroidfw",
913 "libbase",
914 "libcutils",
915 "libcrypto_utils",
916 "libcrypto",
917 "libdiagnose_usb",
918 "liblog",
919 "libmdnssd",
920 "libusb",
921 "libutils",
922 "libziparchive",
923 "libz",
924 ],
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700925 proto: {
926 type: "lite",
927 export_proto_headers: true,
928 },
929 target: {
930 windows: {
931 enabled: true,
932 shared_libs: ["AdbWinApi"],
933 },
934 },
935}
936
937cc_test_host {
938 name: "fastdeploy_test",
939 defaults: ["adb_defaults"],
940 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700941 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700942 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
943 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
944 ],
945 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800946 "libadb_crypto_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700947 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800948 "libadb_pairing_auth_static",
949 "libadb_pairing_connection_static",
950 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700951 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800952 "libadb_tls_connection_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700953 "libandroidfw",
954 "libbase",
955 "libcutils",
956 "libcrypto_utils",
957 "libcrypto",
958 "libdiagnose_usb",
959 "libfastdeploy_host",
960 "liblog",
961 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800962 "libopenscreen-discovery",
963 "libopenscreen-platform-impl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700964 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800965 "libssl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700966 "libusb",
967 "libutils",
968 "libziparchive",
969 "libz",
970 ],
971 target: {
972 windows: {
973 enabled: true,
974 shared_libs: ["AdbWinApi"],
975 },
976 },
977 data: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700978 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700979 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700980 "fastdeploy/testdata/sample.apk",
981 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700982 ],
983}