blob: b4566bfff6602c1ac78545c8eee6635dc46ef1a6 [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",
156 "libcutils_sockets",
157 "libdiagnose_usb",
158 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700159 "libzstd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700160
161 "libadb_protos",
162 "libapp_processes_protos_lite",
163 "libprotobuf-cpp-lite",
164 ],
165
166 shared_libs: [
167 "libadbd_auth",
168 "libadbd_fs",
169 "libcrypto",
170 "libcrypto_utils",
171 "liblog",
172 "libselinux",
173 ],
174
Liz Kammer6836b052021-01-22 13:39:03 -0500175 soong_config_variables:{
176 library_linking_strategy: {
177 prefer_static: {
178 static_libs: [
179 "libbase",
180 ],
181 },
182 conditions_default: {
183 shared_libs: [
184 "libbase",
185 ],
186 },
187 },
188 },
189
Josh Gaodc20c2f2020-03-27 19:41:59 -0700190 target: {
191 recovery: {
192 exclude_static_libs: [
193 "libadb_pairing_auth",
194 "libadb_pairing_connection",
195 ],
196 },
197 },
198}
199
Josh Gao361148b2018-01-02 12:01:43 -0800200// libadb
201// =========================================================
202// These files are compiled for both the host and the device.
203libadb_srcs = [
204 "adb.cpp",
205 "adb_io.cpp",
206 "adb_listeners.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800207 "adb_mdns.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800208 "adb_trace.cpp",
Josh Gao7d5762c2018-05-24 22:54:50 -0700209 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800210 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700211 "fdevent/fdevent.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800212 "services.cpp",
213 "sockets.cpp",
214 "socket_spec.cpp",
Joshua Duong93b407c2020-07-30 16:34:29 -0700215 "sysdeps/env.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800216 "sysdeps/errno.cpp",
217 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700218 "transport_fd.cpp",
Yurii Zubrytskyie5e6b0d2019-07-12 14:11:54 -0700219 "types.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800220]
221
Josh Gaod7c49ec2020-04-20 19:22:05 -0700222libadb_darwin_srcs = [
223 "fdevent/fdevent_poll.cpp",
224]
225
226libadb_windows_srcs = [
227 "fdevent/fdevent_poll.cpp",
228 "sysdeps_win32.cpp",
229 "sysdeps/win32/errno.cpp",
230 "sysdeps/win32/stat.cpp",
231]
232
Josh Gao361148b2018-01-02 12:01:43 -0800233libadb_posix_srcs = [
234 "sysdeps_unix.cpp",
235 "sysdeps/posix/network.cpp",
236]
237
Josh Gaodd716422019-07-11 13:47:44 -0700238libadb_linux_srcs = [
239 "fdevent/fdevent_epoll.cpp",
240]
241
Josh Gao361148b2018-01-02 12:01:43 -0800242libadb_test_srcs = [
243 "adb_io_test.cpp",
244 "adb_listeners_test.cpp",
245 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700246 "fdevent/fdevent_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800247 "socket_spec_test.cpp",
248 "socket_test.cpp",
249 "sysdeps_test.cpp",
250 "sysdeps/stat_test.cpp",
251 "transport_test.cpp",
Josh Gao9f155db2018-04-03 14:37:11 -0700252 "types_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800253]
254
255cc_library_host_static {
256 name: "libadb_host",
257 defaults: ["adb_defaults"],
258
259 srcs: libadb_srcs + [
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800260 "client/openscreen/mdns_service_info.cpp",
261 "client/openscreen/mdns_service_watcher.cpp",
262 "client/openscreen/platform/logging.cpp",
263 "client/openscreen/platform/task_runner.cpp",
264 "client/openscreen/platform/udp_socket.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800265 "client/auth.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800266 "client/adb_wifi.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800267 "client/usb_libusb.cpp",
268 "client/usb_dispatch.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700269 "client/transport_local.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800270 "client/mdnsresponder_client.cpp",
Joshua Duongf2a0d872020-04-30 15:45:38 -0700271 "client/mdns_utils.cpp",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800272 "client/transport_mdns.cpp",
Josh Gao6b55e752020-03-27 18:09:56 -0700273 "client/transport_usb.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800274 "client/pairing/pairing_client.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800275 ],
276
Dan Willemsen18861892018-08-29 14:58:02 -0700277 generated_headers: ["platform_tools_version"],
278
Josh Gao361148b2018-01-02 12:01:43 -0800279 target: {
280 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700281 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800282 },
283 darwin: {
Josh Gaod7c49ec2020-04-20 19:22:05 -0700284 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800285 },
Josh Gao361148b2018-01-02 12:01:43 -0800286 not_windows: {
287 srcs: libadb_posix_srcs,
288 },
289 windows: {
290 enabled: true,
291 srcs: [
292 "client/usb_windows.cpp",
Josh Gaod7c49ec2020-04-20 19:22:05 -0700293 ] + libadb_windows_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800294 shared_libs: ["AdbWinApi"],
295 },
296 },
297
298 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800299 "libadb_crypto",
300 "libadb_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800301 "libadb_pairing_connection",
302 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800303 "libbase",
304 "libcrypto_utils",
305 "libcrypto",
306 "libdiagnose_usb",
307 "libmdnssd",
308 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100309 "libutils",
310 "liblog",
311 "libcutils",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800312 "libopenscreen-discovery",
313 "libopenscreen-platform-impl",
Joshua Duong290ccb52019-11-20 14:18:43 -0800314 "libprotobuf-cpp-lite",
Josh Gao361148b2018-01-02 12:01:43 -0800315 ],
316}
317
Joshua Duong93b407c2020-07-30 16:34:29 -0700318cc_library {
319 name: "libadb_sysdeps",
320 defaults: ["adb_defaults"],
321 recovery_available: true,
322 host_supported: true,
323 compile_multilib: "both",
324 min_sdk_version: "apex_inherit",
Jiyong Parkc55fa5c2020-08-25 17:05:41 +0900325 // This library doesn't use build::GetBuildNumber()
326 use_version_lib: false,
Joshua Duong93b407c2020-07-30 16:34:29 -0700327
328 srcs: [
329 "sysdeps/env.cpp",
330 ],
331
332 shared_libs: [
333 "libbase",
334 "liblog",
335 ],
336
337 target: {
338 windows: {
339 enabled: true,
340 ldflags: ["-municode"],
341 },
342 },
343
344 export_include_dirs: ["."],
345
346 visibility: [
Joshua Duong93b407c2020-07-30 16:34:29 -0700347 "//bootable/recovery/minadbd:__subpackages__",
Baligh Uddin95e03672020-10-18 15:09:52 +0000348 "//packages/modules/adb:__subpackages__",
Joshua Duong93b407c2020-07-30 16:34:29 -0700349 ],
350
351 apex_available: [
352 "com.android.adbd",
353 "test_com.android.adbd",
354 ],
355}
356
Josh Gao361148b2018-01-02 12:01:43 -0800357cc_test_host {
358 name: "adb_test",
359 defaults: ["adb_defaults"],
Joshua Duongf2a0d872020-04-30 15:45:38 -0700360 srcs: libadb_test_srcs + [
361 "client/mdns_utils_test.cpp",
362 ],
363
Josh Gao361148b2018-01-02 12:01:43 -0800364 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800365 "libadb_crypto_static",
Josh Gao361148b2018-01-02 12:01:43 -0800366 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800367 "libadb_pairing_auth_static",
368 "libadb_pairing_connection_static",
369 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700370 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800371 "libadb_tls_connection_static",
Josh Gao361148b2018-01-02 12:01:43 -0800372 "libbase",
373 "libcutils",
374 "libcrypto_utils",
375 "libcrypto",
Tom Cherry49b96ec2020-01-08 13:41:56 -0800376 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800377 "libmdnssd",
378 "libdiagnose_usb",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800379 "libopenscreen-discovery",
380 "libopenscreen-platform-impl",
Joshua Duong290ccb52019-11-20 14:18:43 -0800381 "libprotobuf-cpp-lite",
382 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800383 "libusb",
384 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700385
386 target: {
387 windows: {
388 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700389 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700390 shared_libs: ["AdbWinApi"],
391 },
392 },
Josh Gao361148b2018-01-02 12:01:43 -0800393}
394
395cc_binary_host {
396 name: "adb",
Josh Gao361148b2018-01-02 12:01:43 -0800397
Josh Gao06af61e2020-02-03 23:08:05 -0800398 stl: "libc++_static",
Josh Gao361148b2018-01-02 12:01:43 -0800399 defaults: ["adb_defaults"],
400
401 srcs: [
402 "client/adb_client.cpp",
403 "client/bugreport.cpp",
404 "client/commandline.cpp",
405 "client/file_sync_client.cpp",
406 "client/main.cpp",
407 "client/console.cpp",
Idries Hamadi1ecee442018-01-29 16:30:36 +0000408 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800409 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700410 "client/fastdeploy.cpp",
411 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800412 "client/incremental.cpp",
413 "client/incremental_server.cpp",
Songchun Fan965301e2020-03-13 13:11:43 -0700414 "client/incremental_utils.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800415 "shell_service_protocol.cpp",
416 ],
417
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700418 generated_headers: [
419 "bin2c_fastdeployagent",
420 "bin2c_fastdeployagentscript"
421 ],
422
Josh Gao361148b2018-01-02 12:01:43 -0800423 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800424 "libadb_crypto",
Josh Gao361148b2018-01-02 12:01:43 -0800425 "libadb_host",
Josh Gaod8bad8e2020-03-26 13:46:08 -0700426 "libadb_pairing_auth",
427 "libadb_pairing_connection",
Joshua Duong290ccb52019-11-20 14:18:43 -0800428 "libadb_protos",
Joshua Duong93b407c2020-07-30 16:34:29 -0700429 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800430 "libadb_tls_connection",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700431 "libandroidfw",
Shukang Zhou420ad552020-02-13 17:01:39 -0800432 "libapp_processes_protos_full",
Josh Gao361148b2018-01-02 12:01:43 -0800433 "libbase",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800434 "libbrotli",
Josh Gao361148b2018-01-02 12:01:43 -0800435 "libcutils",
436 "libcrypto_utils",
437 "libcrypto",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700438 "libfastdeploy_host",
Josh Gao361148b2018-01-02 12:01:43 -0800439 "libdiagnose_usb",
440 "liblog",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800441 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800442 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800443 "libopenscreen-discovery",
444 "libopenscreen-platform-impl",
Shukang Zhou420ad552020-02-13 17:01:39 -0800445 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -0800446 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800447 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100448 "libutils",
449 "liblog",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700450 "libziparchive",
451 "libz",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700452 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800453 ],
454
Josh Gao361148b2018-01-02 12:01:43 -0800455 // Don't add anything here, we don't want additional shared dependencies
456 // on the host adb tool, and shared libraries that link against libc++
457 // will violate ODR
458 shared_libs: [],
459
Dan Willemsen7024da42018-11-19 19:11:35 -0800460 // Archive adb, adb.exe.
461 dist: {
462 targets: [
463 "dist_files",
464 "sdk",
465 "win_sdk",
466 ],
467 },
468
Josh Gao361148b2018-01-02 12:01:43 -0800469 target: {
470 darwin: {
471 cflags: [
472 "-Wno-sizeof-pointer-memaccess",
473 ],
474 },
475 windows: {
476 enabled: true,
477 ldflags: ["-municode"],
Josh Gao361148b2018-01-02 12:01:43 -0800478 shared_libs: ["AdbWinApi"],
479 required: [
480 "AdbWinUsbApi",
481 ],
482 },
483 },
484}
485
Tao Bao49042e32018-07-30 20:45:27 -0700486// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800487cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700488 name: "libadbd_core",
Josh Gao0560feb2019-01-22 19:36:15 -0800489 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700490 recovery_available: true,
491
492 // libminadbd wants both, as it's used to build native tests.
493 compile_multilib: "both",
494
Josh Gaodd716422019-07-11 13:47:44 -0700495 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gaoa5baef92020-04-22 17:30:06 -0700496 "daemon/adb_wifi.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700497 "daemon/auth.cpp",
498 "daemon/jdwp_service.cpp",
Josh Gaobd775212020-02-26 16:39:20 -0800499 "daemon/logging.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700500 "daemon/transport_local.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700501 ],
502
Dan Willemsen18861892018-08-29 14:58:02 -0700503 generated_headers: ["platform_tools_version"],
504
Tao Bao49042e32018-07-30 20:45:27 -0700505 static_libs: [
506 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700507 ],
508
509 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700510 "libadbconnection_server",
Joshua Duong090c8072019-12-19 16:36:30 -0800511 "libadb_crypto",
Joshua Duong290ccb52019-11-20 14:18:43 -0800512 "libadb_pairing_connection",
513 "libadb_protos",
514 "libadb_tls_connection",
Josh Gao7cac88a2019-10-22 12:30:39 -0700515 "libadbd_auth",
Josh Gaofa3605a2020-03-16 11:30:09 -0700516 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700517 "libasyncio",
518 "libbase",
519 "libcrypto",
520 "libcrypto_utils",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700521 "libcutils_sockets",
Tao Bao49042e32018-07-30 20:45:27 -0700522 "liblog",
523 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800524
Shukang Zhou420ad552020-02-13 17:01:39 -0800525 proto: {
526 type: "lite",
527 static: true,
528 export_proto_headers: true,
529 },
530
Josh Gao0560feb2019-01-22 19:36:15 -0800531 target: {
532 android: {
Josh Gao0560feb2019-01-22 19:36:15 -0800533 srcs: [
Josh Gao822f6742021-02-03 22:12:41 -0800534 "daemon/property_monitor.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800535 "daemon/usb.cpp",
536 "daemon/usb_ffs.cpp",
Josh Gao2dc61962021-02-03 22:11:45 -0800537 "daemon/watchdog.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800538 ]
Joshua Duong929364a2020-02-26 15:43:44 -0800539 },
540 recovery: {
541 exclude_shared_libs: [
542 "libadb_pairing_auth",
543 "libadb_pairing_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700544 "libapp_processes_protos_lite",
Joshua Duong929364a2020-02-26 15:43:44 -0800545 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800546 }
547 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700548
549 apex_available: [
550 "//apex_available:platform",
551 "com.android.adbd",
552 ],
553 visibility: [
554 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000555 "//packages/modules/adb:__subpackages__",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700556 ],
Tao Bao49042e32018-07-30 20:45:27 -0700557}
558
Josh Gao2029a372020-03-09 15:20:55 -0700559cc_library {
Tao Bao49042e32018-07-30 20:45:27 -0700560 name: "libadbd_services",
Josh Gao0560feb2019-01-22 19:36:15 -0800561 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700562 recovery_available: true,
563 compile_multilib: "both",
564
565 srcs: [
566 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700567 "daemon/services.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700568 "daemon/shell_service.cpp",
569 "shell_service_protocol.cpp",
570 ],
571
572 cflags: [
573 "-D_GNU_SOURCE",
574 "-Wno-deprecated-declarations",
575 ],
576
577 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800578 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700579 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800580 "libbrotli",
Tao Bao49042e32018-07-30 20:45:27 -0700581 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700582 "liblz4",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700583 "libzstd",
Tao Bao49042e32018-07-30 20:45:27 -0700584 ],
585
586 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800587 "libadb_crypto",
588 "libadb_pairing_connection",
589 "libadb_protos",
590 "libadb_tls_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700591 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700592 "libasyncio",
593 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700594 "libcrypto_utils",
Josh Gao2029a372020-03-09 15:20:55 -0700595 "libcutils_sockets",
Josh Gaofa3605a2020-03-16 11:30:09 -0700596 "libprotobuf-cpp-lite",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700597
598 // APEX dependencies.
599 "libadbd_auth",
600 "libadbd_fs",
601 "libcrypto",
602 "liblog",
Tao Bao49042e32018-07-30 20:45:27 -0700603 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800604
605 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800606 android: {
607 srcs: [
608 "daemon/abb_service.cpp",
609 "daemon/framebuffer_service.cpp",
610 "daemon/mdns.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800611 "daemon/restart_service.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800612 ],
613 shared_libs: [
Josh Gao0560feb2019-01-22 19:36:15 -0800614 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800615 "libselinux",
616 ],
617 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800618 recovery: {
619 exclude_srcs: [
620 "daemon/abb_service.cpp",
621 ],
Joshua Duong929364a2020-02-26 15:43:44 -0800622 exclude_shared_libs: [
623 "libadb_pairing_auth",
624 "libadb_pairing_connection",
625 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800626 },
627 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700628
629 apex_available: [
630 "//apex_available:platform",
631 "com.android.adbd",
632 ],
633 visibility: [
Baligh Uddin95e03672020-10-18 15:09:52 +0000634 "//packages/modules/adb",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700635 ],
636
Tao Bao49042e32018-07-30 20:45:27 -0700637}
638
639cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800640 name: "libadbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800641 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900642 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000643 apex_available: ["com.android.adbd"],
Josh Gao361148b2018-01-02 12:01:43 -0800644
Josh Gaobf5a9362020-01-22 17:58:03 -0800645 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Bao49042e32018-07-30 20:45:27 -0700646 use_version_lib: false,
647
648 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800649 compile_multilib: "both",
Tao Bao49042e32018-07-30 20:45:27 -0700650
Tao Bao49042e32018-07-30 20:45:27 -0700651 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700652 "libadbconnection_server",
653 "libapp_processes_protos_lite",
654 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800655 "libadb_crypto",
656 "libadb_pairing_connection",
657 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800658 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800659 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700660 "libcrypto",
661 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700662 "liblog",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800663 "libselinux",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700664
665 // APEX dependencies on the system image.
666 "libadbd_auth",
667 "libadbd_fs",
668 "libadbd_services",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800669 ],
670
Joshua Duong929364a2020-02-26 15:43:44 -0800671 target: {
672 recovery: {
673 exclude_shared_libs: [
674 "libadb_pairing_auth",
675 "libadb_pairing_connection",
676 ],
677 }
678 },
679
Josh Gaoa4dfc142020-02-19 13:50:57 -0800680 static_libs: [
Josh Gaodc20c2f2020-03-27 19:41:59 -0700681 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800682 "libbrotli",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800683 "libcutils_sockets",
684 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700685 "liblz4",
Josh Gao2e24c962020-02-21 16:38:29 -0800686 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700687 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800688 ],
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700689
Josh Gao6b55e752020-03-27 18:09:56 -0700690 visibility: [
691 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000692 "//packages/modules/adb",
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700693 ],
Josh Gao361148b2018-01-02 12:01:43 -0800694}
695
696cc_binary {
697 name: "adbd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700698 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900699 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000700 apex_available: ["com.android.adbd"],
Josh Gao3e0540a2018-03-06 12:57:27 -0800701
Josh Gao361148b2018-01-02 12:01:43 -0800702 srcs: [
703 "daemon/main.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800704 ],
705
706 cflags: [
707 "-D_GNU_SOURCE",
708 "-Wno-deprecated-declarations",
709 ],
710
711 strip: {
712 keep_symbols: true,
713 },
714
Josh Gao2bfc85e2019-08-15 14:05:12 -0700715 static_libs: [
Josh Gao361148b2018-01-02 12:01:43 -0800716 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700717 "libadbd_services",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700718 "libasyncio",
Tao Bao49042e32018-07-30 20:45:27 -0700719 "libcap",
Josh Gaofb386cc2020-03-26 22:02:03 -0700720 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800721 "libminijail",
Joshua Duong290ccb52019-11-20 14:18:43 -0800722 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800723 ],
Josh Gao2bfc85e2019-08-15 14:05:12 -0700724
725 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800726 "libadb_protos",
Josh Gao090712a2020-01-16 12:40:43 -0800727 "libadbd_auth",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700728 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800729
Joshua Duong929364a2020-02-26 15:43:44 -0800730 target: {
731 recovery: {
732 exclude_shared_libs: [
733 "libadb_pairing_auth",
734 "libadb_pairing_connection",
735 ],
736 }
737 },
Josh Gao361148b2018-01-02 12:01:43 -0800738}
739
Josh Gao06e45932019-10-23 13:27:17 -0700740phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700741 // Interface between adbd in a module and the system.
742 name: "adbd_system_api",
Josh Gao06e45932019-10-23 13:27:17 -0700743 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700744 "libadbd_auth",
745 "libadbd_fs",
Josh Gao06e45932019-10-23 13:27:17 -0700746 "abb",
Josh Gao83ce3e22019-10-22 12:30:36 -0700747 "reboot",
Josh Gaob554f4b2019-10-22 12:30:30 -0700748 "set-verity-state",
Josh Gao06e45932019-10-23 13:27:17 -0700749 ]
750}
751
752phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700753 name: "adbd_system_api_recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700754 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700755 "libadbd_auth",
756 "libadbd_fs",
Josh Gao83ce3e22019-10-22 12:30:36 -0700757 "reboot.recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700758 ],
759}
760
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800761cc_binary {
762 name: "abb",
763
Josh Gao0560feb2019-01-22 19:36:15 -0800764 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800765 stl: "libc++",
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800766 recovery_available: false,
767
768 srcs: [
769 "daemon/abb.cpp",
770 ],
771
772 cflags: [
773 "-D_GNU_SOURCE",
774 "-Wno-deprecated-declarations",
775 ],
776
777 strip: {
778 keep_symbols: true,
779 },
780
781 static_libs: [
782 "libadbd_core",
783 "libadbd_services",
784 "libcmd",
785 ],
786
787 shared_libs: [
788 "libbase",
789 "libbinder",
790 "liblog",
791 "libutils",
792 "libselinux",
793 ],
794}
795
Josh Gao361148b2018-01-02 12:01:43 -0800796cc_test {
797 name: "adbd_test",
Josh Gao06af61e2020-02-03 23:08:05 -0800798
Josh Gaodc20c2f2020-03-27 19:41:59 -0700799 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao06af61e2020-02-03 23:08:05 -0800800
801 recovery_available: false,
Josh Gao361148b2018-01-02 12:01:43 -0800802 srcs: libadb_test_srcs + [
Josh Gao5607e922018-07-25 18:15:52 -0700803 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800804 "daemon/shell_service.cpp",
805 "daemon/shell_service_test.cpp",
806 "shell_service_protocol.cpp",
807 "shell_service_protocol_test.cpp",
Joshua Duong77b8ff32020-04-16 15:58:19 -0700808 "mdns_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800809 ],
810
Chen Zhu72ccee32020-05-08 16:45:11 -0700811 test_config: "adb_test.xml",
812
Josh Gao822f6742021-02-03 22:12:41 -0800813 target: {
814 android: {
815 srcs: [
816 "daemon/property_monitor_test.cpp",
817 ],
818 },
819 },
820
Josh Gaodc20c2f2020-03-27 19:41:59 -0700821 shared_libs: [
822 "liblog",
823 ],
824
Josh Gao361148b2018-01-02 12:01:43 -0800825 static_libs: [
826 "libadbd",
Josh Gao7cac88a2019-10-22 12:30:39 -0700827 "libadbd_auth",
Josh Gao361148b2018-01-02 12:01:43 -0800828 "libbase",
Josh Gao361148b2018-01-02 12:01:43 -0800829 "libcrypto_utils",
Josh Gao361148b2018-01-02 12:01:43 -0800830 "libusb",
Josh Gao361148b2018-01-02 12:01:43 -0800831 ],
Kimberly Kreiderd3e4b712020-12-15 10:32:07 -0800832 test_suites: ["device-tests", "mts-adbd"],
Dan Shi22e091b2019-09-24 09:04:05 -0700833 require_root: true,
Josh Gao361148b2018-01-02 12:01:43 -0800834}
835
Julien Desprezae94f512018-08-08 12:08:50 -0700836python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800837 name: "adb_integration_test_adb",
838 main: "test_adb.py",
839 srcs: [
840 "test_adb.py",
841 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700842 test_config: "adb_integration_test_adb.xml",
843 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800844 version: {
845 py2: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700846 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800847 },
848 py3: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700849 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800850 },
GuangHui Liu35994392017-05-10 14:37:17 -0700851 },
GuangHui Liu35994392017-05-10 14:37:17 -0700852}
853
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700854python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800855 name: "adb_integration_test_device",
856 main: "test_device.py",
857 srcs: [
858 "test_device.py",
859 ],
860 libs: [
861 "adb_py",
862 ],
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700863 test_config: "adb_integration_test_device.xml",
864 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800865 version: {
866 py2: {
Josh Gao4218d852020-02-06 17:52:38 -0800867 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800868 },
869 py3: {
Josh Gao4218d852020-02-06 17:52:38 -0800870 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800871 },
GuangHui Liu35994392017-05-10 14:37:17 -0700872 },
GuangHui Liu35994392017-05-10 14:37:17 -0700873}
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700874
875// Note: using pipe for xxd to control the variable name generated
876// the default name used by xxd is the path to the input file.
877java_genrule {
878 name: "bin2c_fastdeployagent",
879 out: ["deployagent.inc"],
880 srcs: [":deployagent"],
881 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
882}
883
884genrule {
885 name: "bin2c_fastdeployagentscript",
886 out: ["deployagentscript.inc"],
887 srcs: ["fastdeploy/deployagent/deployagent.sh"],
888 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
889}
890
891cc_library_host_static {
892 name: "libfastdeploy_host",
893 defaults: ["adb_defaults"],
894 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700895 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700896 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
897 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
898 "fastdeploy/proto/ApkEntry.proto",
899 ],
900 static_libs: [
901 "libadb_host",
902 "libandroidfw",
903 "libbase",
904 "libcutils",
905 "libcrypto_utils",
906 "libcrypto",
907 "libdiagnose_usb",
908 "liblog",
909 "libmdnssd",
910 "libusb",
911 "libutils",
912 "libziparchive",
913 "libz",
914 ],
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700915 proto: {
916 type: "lite",
917 export_proto_headers: true,
918 },
919 target: {
920 windows: {
921 enabled: true,
922 shared_libs: ["AdbWinApi"],
923 },
924 },
925}
926
927cc_test_host {
928 name: "fastdeploy_test",
929 defaults: ["adb_defaults"],
930 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700931 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700932 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
933 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
934 ],
935 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800936 "libadb_crypto_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700937 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800938 "libadb_pairing_auth_static",
939 "libadb_pairing_connection_static",
940 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700941 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800942 "libadb_tls_connection_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700943 "libandroidfw",
944 "libbase",
945 "libcutils",
946 "libcrypto_utils",
947 "libcrypto",
948 "libdiagnose_usb",
949 "libfastdeploy_host",
950 "liblog",
951 "libmdnssd",
Joshua Duongf4ba8d72021-01-13 12:18:15 -0800952 "libopenscreen-discovery",
953 "libopenscreen-platform-impl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700954 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800955 "libssl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700956 "libusb",
957 "libutils",
958 "libziparchive",
959 "libz",
960 ],
961 target: {
962 windows: {
963 enabled: true,
964 shared_libs: ["AdbWinApi"],
965 },
966 },
967 data: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700968 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700969 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700970 "fastdeploy/testdata/sample.apk",
971 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700972 ],
973}