blob: 5df1cf05d052993b2a408b5efd511bf338d118ce [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
Joshua Duongb5c3bec2020-07-17 14:14:00 -070015tidy_errors = [
16 "-*",
17 "bugprone-inaccurate-erase",
18]
19
Josh Gao361148b2018-01-02 12:01:43 -080020cc_defaults {
21 name: "adb_defaults",
22
23 cflags: [
24 "-Wall",
25 "-Wextra",
26 "-Werror",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070027 "-Wexit-time-destructors",
Jiyong Parkf2721bc2020-09-18 16:35:06 +090028 "-Wno-non-virtual-dtor",
Josh Gao361148b2018-01-02 12:01:43 -080029 "-Wno-unused-parameter",
30 "-Wno-missing-field-initializers",
Josh Gao0560feb2019-01-22 19:36:15 -080031 "-Wthread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080032 "-Wvla",
Bowgo Tsai35b817b2019-03-12 04:25:33 +080033 "-DADB_HOST=1", // overridden by adbd_defaults
Josh Gao90228a62019-04-25 14:04:57 -070034 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao361148b2018-01-02 12:01:43 -080035 ],
Josh Gao3edf8072018-11-16 15:40:16 -080036 cpp_std: "experimental",
Josh Gao361148b2018-01-02 12:01:43 -080037
Josh Gao66766f82018-02-27 15:49:23 -080038 use_version_lib: true,
Josh Gao361148b2018-01-02 12:01:43 -080039 compile_multilib: "first",
Josh Gao361148b2018-01-02 12:01:43 -080040
41 target: {
Josh Gao361148b2018-01-02 12:01:43 -080042 darwin: {
43 host_ldlibs: [
44 "-lpthread",
45 "-framework CoreFoundation",
46 "-framework IOKit",
47 "-lobjc",
48 ],
49 },
50
51 windows: {
52 cflags: [
53 // Define windows.h and tchar.h Unicode preprocessor symbols so that
54 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
55 // build if you accidentally pass char*. Fix by calling like:
56 // std::wstring path_wide;
57 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
58 // CreateFileW(path_wide.c_str());
59 "-DUNICODE=1",
60 "-D_UNICODE=1",
61
Elliott Hughesc229a722018-12-03 09:02:18 -080062 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao361148b2018-01-02 12:01:43 -080063 "-D_GNU_SOURCE",
Josh Gao96049b92018-03-23 13:03:28 -070064
65 // MinGW hides some things behind _POSIX_SOURCE.
66 "-D_POSIX_SOURCE",
Josh Gao0560feb2019-01-22 19:36:15 -080067
Josh Gaoc3b64032019-04-17 16:57:43 -070068 // libusb uses __stdcall on a variadic function, which gets ignored.
69 "-Wno-ignored-attributes",
70
Josh Gao0560feb2019-01-22 19:36:15 -080071 // Not supported yet.
72 "-Wno-thread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080073 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -070074
75 host_ldlibs: [
76 "-lws2_32",
77 "-lgdi32",
78 "-luserenv",
79 ],
Josh Gao361148b2018-01-02 12:01:43 -080080 },
Josh Gao0560feb2019-01-22 19:36:15 -080081 },
Joshua Duongb5c3bec2020-07-17 14:14:00 -070082
83 tidy: true,
84 tidy_checks: tidy_errors,
85 tidy_checks_as_errors: tidy_errors,
Josh Gao0560feb2019-01-22 19:36:15 -080086}
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070087
Josh Gao0560feb2019-01-22 19:36:15 -080088cc_defaults {
89 name: "adbd_defaults",
90 defaults: ["adb_defaults"],
91
92 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
Josh Gao361148b2018-01-02 12:01:43 -080093}
94
Josh Gao0560feb2019-01-22 19:36:15 -080095cc_defaults {
96 name: "host_adbd_supported",
97
98 host_supported: true,
99 target: {
100 linux: {
101 enabled: true,
102 host_ldlibs: [
103 "-lresolv", // b64_pton
104 "-lutil", // forkpty
105 ],
106 },
107 darwin: {
108 enabled: false,
109 },
110 windows: {
111 enabled: false,
112 },
113 },
114}
115
Liz Kammer6836b052021-01-22 13:39:03 -0500116soong_config_module_type_import {
117 from: "system/apex/Android.bp",
118 module_types: ["library_linking_strategy_cc_defaults"],
119}
120
121library_linking_strategy_cc_defaults {
Josh Gaodc20c2f2020-03-27 19:41:59 -0700122 name: "libadbd_binary_dependencies",
123 static_libs: [
124 "libadb_crypto",
125 "libadb_pairing_connection",
Joshua Duong93b407c2020-07-30 16:34:29 -0700126 "libadb_sysdeps",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700127 "libadb_tls_connection",
128 "libadbd",
129 "libadbd_core",
130 "libadbconnection_server",
131 "libasyncio",
132 "libbrotli",
133 "libcutils_sockets",
134 "libdiagnose_usb",
135 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700136 "libzstd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700137
138 "libadb_protos",
139 "libapp_processes_protos_lite",
140 "libprotobuf-cpp-lite",
141 ],
142
143 shared_libs: [
144 "libadbd_auth",
145 "libadbd_fs",
146 "libcrypto",
147 "libcrypto_utils",
148 "liblog",
149 "libselinux",
150 ],
151
Liz Kammer6836b052021-01-22 13:39:03 -0500152 soong_config_variables:{
153 library_linking_strategy: {
154 prefer_static: {
155 static_libs: [
156 "libbase",
157 ],
158 },
159 conditions_default: {
160 shared_libs: [
161 "libbase",
162 ],
163 },
164 },
165 },
166
Josh Gaodc20c2f2020-03-27 19:41:59 -0700167 target: {
168 recovery: {
169 exclude_static_libs: [
170 "libadb_pairing_auth",
171 "libadb_pairing_connection",
172 ],
173 },
174 },
175}
176
Josh Gao361148b2018-01-02 12:01:43 -0800177// libadb
178// =========================================================
179// These files are compiled for both the host and the device.
180libadb_srcs = [
181 "adb.cpp",
182 "adb_io.cpp",
183 "adb_listeners.cpp",
184 "adb_trace.cpp",
Josh Gao7d5762c2018-05-24 22:54:50 -0700185 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800186 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700187 "fdevent/fdevent.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800188 "services.cpp",
189 "sockets.cpp",
190 "socket_spec.cpp",
Joshua Duong93b407c2020-07-30 16:34:29 -0700191 "sysdeps/env.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800192 "sysdeps/errno.cpp",
193 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700194 "transport_fd.cpp",
Yurii Zubrytskyie5e6b0d2019-07-12 14:11:54 -0700195 "types.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800196]
197
Josh Gaod7c49ec2020-04-20 19:22:05 -0700198libadb_darwin_srcs = [
199 "fdevent/fdevent_poll.cpp",
200]
201
202libadb_windows_srcs = [
203 "fdevent/fdevent_poll.cpp",
204 "sysdeps_win32.cpp",
205 "sysdeps/win32/errno.cpp",
206 "sysdeps/win32/stat.cpp",
207]
208
Josh Gao361148b2018-01-02 12:01:43 -0800209libadb_posix_srcs = [
210 "sysdeps_unix.cpp",
211 "sysdeps/posix/network.cpp",
212]
213
Josh Gaodd716422019-07-11 13:47:44 -0700214libadb_linux_srcs = [
215 "fdevent/fdevent_epoll.cpp",
216]
217
Josh Gao361148b2018-01-02 12:01:43 -0800218libadb_test_srcs = [
219 "adb_io_test.cpp",
220 "adb_listeners_test.cpp",
221 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700222 "fdevent/fdevent_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800223 "socket_spec_test.cpp",
224 "socket_test.cpp",
225 "sysdeps_test.cpp",
226 "sysdeps/stat_test.cpp",
227 "transport_test.cpp",
Josh Gao9f155db2018-04-03 14:37:11 -0700228 "types_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800229]
230
231cc_library_host_static {
232 name: "libadb_host",
233 defaults: ["adb_defaults"],
234
235 srcs: libadb_srcs + [
236 "client/auth.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800237 "client/adb_wifi.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800238 "client/usb_libusb.cpp",
239 "client/usb_dispatch.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700240 "client/transport_local.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800241 "client/transport_mdns.cpp",
Joshua Duongf2a0d872020-04-30 15:45:38 -0700242 "client/mdns_utils.cpp",
Josh Gao6b55e752020-03-27 18:09:56 -0700243 "client/transport_usb.cpp",
Joshua Duong290ccb52019-11-20 14:18:43 -0800244 "client/pairing/pairing_client.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800245 ],
246
Dan Willemsen18861892018-08-29 14:58:02 -0700247 generated_headers: ["platform_tools_version"],
248
Josh Gao361148b2018-01-02 12:01:43 -0800249 target: {
250 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700251 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800252 },
253 darwin: {
Josh Gaod7c49ec2020-04-20 19:22:05 -0700254 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800255 },
Josh Gao361148b2018-01-02 12:01:43 -0800256 not_windows: {
257 srcs: libadb_posix_srcs,
258 },
259 windows: {
260 enabled: true,
261 srcs: [
262 "client/usb_windows.cpp",
Josh Gaod7c49ec2020-04-20 19:22:05 -0700263 ] + libadb_windows_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800264 shared_libs: ["AdbWinApi"],
265 },
266 },
267
268 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800269 "libadb_crypto",
270 "libadb_protos",
Joshua Duong290ccb52019-11-20 14:18:43 -0800271 "libadb_pairing_connection",
272 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800273 "libbase",
274 "libcrypto_utils",
275 "libcrypto",
276 "libdiagnose_usb",
277 "libmdnssd",
278 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100279 "libutils",
280 "liblog",
281 "libcutils",
Joshua Duong290ccb52019-11-20 14:18:43 -0800282 "libprotobuf-cpp-lite",
Josh Gao361148b2018-01-02 12:01:43 -0800283 ],
284}
285
Joshua Duong93b407c2020-07-30 16:34:29 -0700286cc_library {
287 name: "libadb_sysdeps",
288 defaults: ["adb_defaults"],
289 recovery_available: true,
290 host_supported: true,
291 compile_multilib: "both",
292 min_sdk_version: "apex_inherit",
Jiyong Parkc55fa5c2020-08-25 17:05:41 +0900293 // This library doesn't use build::GetBuildNumber()
294 use_version_lib: false,
Joshua Duong93b407c2020-07-30 16:34:29 -0700295
296 srcs: [
297 "sysdeps/env.cpp",
298 ],
299
300 shared_libs: [
301 "libbase",
302 "liblog",
303 ],
304
305 target: {
306 windows: {
307 enabled: true,
308 ldflags: ["-municode"],
309 },
310 },
311
312 export_include_dirs: ["."],
313
314 visibility: [
Joshua Duong93b407c2020-07-30 16:34:29 -0700315 "//bootable/recovery/minadbd:__subpackages__",
Baligh Uddin95e03672020-10-18 15:09:52 +0000316 "//packages/modules/adb:__subpackages__",
Joshua Duong93b407c2020-07-30 16:34:29 -0700317 ],
318
319 apex_available: [
320 "com.android.adbd",
321 "test_com.android.adbd",
322 ],
323}
324
Josh Gao361148b2018-01-02 12:01:43 -0800325cc_test_host {
326 name: "adb_test",
327 defaults: ["adb_defaults"],
Joshua Duongf2a0d872020-04-30 15:45:38 -0700328 srcs: libadb_test_srcs + [
329 "client/mdns_utils_test.cpp",
330 ],
331
Josh Gao361148b2018-01-02 12:01:43 -0800332 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800333 "libadb_crypto_static",
Josh Gao361148b2018-01-02 12:01:43 -0800334 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800335 "libadb_pairing_auth_static",
336 "libadb_pairing_connection_static",
337 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700338 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800339 "libadb_tls_connection_static",
Josh Gao361148b2018-01-02 12:01:43 -0800340 "libbase",
341 "libcutils",
342 "libcrypto_utils",
343 "libcrypto",
Tom Cherry49b96ec2020-01-08 13:41:56 -0800344 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800345 "libmdnssd",
346 "libdiagnose_usb",
Joshua Duong290ccb52019-11-20 14:18:43 -0800347 "libprotobuf-cpp-lite",
348 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800349 "libusb",
350 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700351
352 target: {
353 windows: {
354 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700355 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700356 shared_libs: ["AdbWinApi"],
357 },
358 },
Josh Gao361148b2018-01-02 12:01:43 -0800359}
360
361cc_binary_host {
362 name: "adb",
Josh Gao361148b2018-01-02 12:01:43 -0800363
Josh Gao06af61e2020-02-03 23:08:05 -0800364 stl: "libc++_static",
Josh Gao361148b2018-01-02 12:01:43 -0800365 defaults: ["adb_defaults"],
366
367 srcs: [
368 "client/adb_client.cpp",
369 "client/bugreport.cpp",
370 "client/commandline.cpp",
371 "client/file_sync_client.cpp",
372 "client/main.cpp",
373 "client/console.cpp",
Idries Hamadi1ecee442018-01-29 16:30:36 +0000374 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800375 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700376 "client/fastdeploy.cpp",
377 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800378 "client/incremental.cpp",
379 "client/incremental_server.cpp",
Songchun Fan965301e2020-03-13 13:11:43 -0700380 "client/incremental_utils.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800381 "shell_service_protocol.cpp",
382 ],
383
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700384 generated_headers: [
385 "bin2c_fastdeployagent",
386 "bin2c_fastdeployagentscript"
387 ],
388
Josh Gao361148b2018-01-02 12:01:43 -0800389 static_libs: [
Joshua Duong090c8072019-12-19 16:36:30 -0800390 "libadb_crypto",
Josh Gao361148b2018-01-02 12:01:43 -0800391 "libadb_host",
Josh Gaod8bad8e2020-03-26 13:46:08 -0700392 "libadb_pairing_auth",
393 "libadb_pairing_connection",
Joshua Duong290ccb52019-11-20 14:18:43 -0800394 "libadb_protos",
Joshua Duong93b407c2020-07-30 16:34:29 -0700395 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800396 "libadb_tls_connection",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700397 "libandroidfw",
Shukang Zhou420ad552020-02-13 17:01:39 -0800398 "libapp_processes_protos_full",
Josh Gao361148b2018-01-02 12:01:43 -0800399 "libbase",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800400 "libbrotli",
Josh Gao361148b2018-01-02 12:01:43 -0800401 "libcutils",
402 "libcrypto_utils",
403 "libcrypto",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700404 "libfastdeploy_host",
Josh Gao361148b2018-01-02 12:01:43 -0800405 "libdiagnose_usb",
406 "liblog",
Alex Buynytskyy175ce292020-02-13 06:52:04 -0800407 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800408 "libmdnssd",
Shukang Zhou420ad552020-02-13 17:01:39 -0800409 "libprotobuf-cpp-full",
Joshua Duong290ccb52019-11-20 14:18:43 -0800410 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800411 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100412 "libutils",
413 "liblog",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700414 "libziparchive",
415 "libz",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700416 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800417 ],
418
Josh Gao361148b2018-01-02 12:01:43 -0800419 // Don't add anything here, we don't want additional shared dependencies
420 // on the host adb tool, and shared libraries that link against libc++
421 // will violate ODR
422 shared_libs: [],
423
Dan Willemsen7024da42018-11-19 19:11:35 -0800424 // Archive adb, adb.exe.
425 dist: {
426 targets: [
427 "dist_files",
428 "sdk",
429 "win_sdk",
430 ],
431 },
432
Josh Gao361148b2018-01-02 12:01:43 -0800433 target: {
434 darwin: {
435 cflags: [
436 "-Wno-sizeof-pointer-memaccess",
437 ],
438 },
439 windows: {
440 enabled: true,
441 ldflags: ["-municode"],
Josh Gao361148b2018-01-02 12:01:43 -0800442 shared_libs: ["AdbWinApi"],
443 required: [
444 "AdbWinUsbApi",
445 ],
446 },
447 },
448}
449
Tao Bao49042e32018-07-30 20:45:27 -0700450// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800451cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700452 name: "libadbd_core",
Josh Gao0560feb2019-01-22 19:36:15 -0800453 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700454 recovery_available: true,
455
456 // libminadbd wants both, as it's used to build native tests.
457 compile_multilib: "both",
458
Josh Gaodd716422019-07-11 13:47:44 -0700459 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gaoa5baef92020-04-22 17:30:06 -0700460 "daemon/adb_wifi.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700461 "daemon/auth.cpp",
462 "daemon/jdwp_service.cpp",
Josh Gaobd775212020-02-26 16:39:20 -0800463 "daemon/logging.cpp",
Josh Gaoa5baef92020-04-22 17:30:06 -0700464 "daemon/transport_local.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700465 ],
466
Dan Willemsen18861892018-08-29 14:58:02 -0700467 generated_headers: ["platform_tools_version"],
468
Tao Bao49042e32018-07-30 20:45:27 -0700469 static_libs: [
470 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700471 ],
472
473 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700474 "libadbconnection_server",
Joshua Duong090c8072019-12-19 16:36:30 -0800475 "libadb_crypto",
Joshua Duong290ccb52019-11-20 14:18:43 -0800476 "libadb_pairing_connection",
477 "libadb_protos",
478 "libadb_tls_connection",
Josh Gao7cac88a2019-10-22 12:30:39 -0700479 "libadbd_auth",
Josh Gaofa3605a2020-03-16 11:30:09 -0700480 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700481 "libasyncio",
482 "libbase",
483 "libcrypto",
484 "libcrypto_utils",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700485 "libcutils_sockets",
Tao Bao49042e32018-07-30 20:45:27 -0700486 "liblog",
487 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800488
Shukang Zhou420ad552020-02-13 17:01:39 -0800489 proto: {
490 type: "lite",
491 static: true,
492 export_proto_headers: true,
493 },
494
Josh Gao0560feb2019-01-22 19:36:15 -0800495 target: {
496 android: {
497 whole_static_libs: [
498 "libqemu_pipe",
499 ],
500 srcs: [
501 "daemon/transport_qemu.cpp",
502 "daemon/usb.cpp",
503 "daemon/usb_ffs.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800504 ]
Joshua Duong929364a2020-02-26 15:43:44 -0800505 },
506 recovery: {
507 exclude_shared_libs: [
508 "libadb_pairing_auth",
509 "libadb_pairing_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700510 "libapp_processes_protos_lite",
Joshua Duong929364a2020-02-26 15:43:44 -0800511 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800512 }
513 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700514
515 apex_available: [
516 "//apex_available:platform",
517 "com.android.adbd",
518 ],
519 visibility: [
520 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000521 "//packages/modules/adb:__subpackages__",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700522 ],
Tao Bao49042e32018-07-30 20:45:27 -0700523}
524
Josh Gao2029a372020-03-09 15:20:55 -0700525cc_library {
Tao Bao49042e32018-07-30 20:45:27 -0700526 name: "libadbd_services",
Josh Gao0560feb2019-01-22 19:36:15 -0800527 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700528 recovery_available: true,
529 compile_multilib: "both",
530
531 srcs: [
532 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700533 "daemon/services.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700534 "daemon/shell_service.cpp",
535 "shell_service_protocol.cpp",
536 ],
537
538 cflags: [
539 "-D_GNU_SOURCE",
540 "-Wno-deprecated-declarations",
541 ],
542
543 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800544 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700545 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800546 "libbrotli",
Tao Bao49042e32018-07-30 20:45:27 -0700547 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700548 "liblz4",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700549 "libzstd",
Tao Bao49042e32018-07-30 20:45:27 -0700550 ],
551
552 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800553 "libadb_crypto",
554 "libadb_pairing_connection",
555 "libadb_protos",
556 "libadb_tls_connection",
Josh Gaofa3605a2020-03-16 11:30:09 -0700557 "libapp_processes_protos_lite",
Tao Bao49042e32018-07-30 20:45:27 -0700558 "libasyncio",
559 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700560 "libcrypto_utils",
Josh Gao2029a372020-03-09 15:20:55 -0700561 "libcutils_sockets",
Josh Gaofa3605a2020-03-16 11:30:09 -0700562 "libprotobuf-cpp-lite",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700563
564 // APEX dependencies.
565 "libadbd_auth",
566 "libadbd_fs",
567 "libcrypto",
568 "liblog",
Tao Bao49042e32018-07-30 20:45:27 -0700569 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800570
571 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800572 android: {
573 srcs: [
574 "daemon/abb_service.cpp",
575 "daemon/framebuffer_service.cpp",
576 "daemon/mdns.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800577 "daemon/restart_service.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800578 ],
579 shared_libs: [
Josh Gao0560feb2019-01-22 19:36:15 -0800580 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800581 "libselinux",
582 ],
583 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800584 recovery: {
585 exclude_srcs: [
586 "daemon/abb_service.cpp",
587 ],
Joshua Duong929364a2020-02-26 15:43:44 -0800588 exclude_shared_libs: [
589 "libadb_pairing_auth",
590 "libadb_pairing_connection",
591 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800592 },
593 },
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700594
595 apex_available: [
596 "//apex_available:platform",
597 "com.android.adbd",
598 ],
599 visibility: [
Baligh Uddin95e03672020-10-18 15:09:52 +0000600 "//packages/modules/adb",
Josh Gao5fcd7ae2020-03-16 12:48:18 -0700601 ],
602
Tao Bao49042e32018-07-30 20:45:27 -0700603}
604
605cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800606 name: "libadbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800607 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900608 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000609 apex_available: ["com.android.adbd"],
Josh Gao361148b2018-01-02 12:01:43 -0800610
Josh Gaobf5a9362020-01-22 17:58:03 -0800611 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Bao49042e32018-07-30 20:45:27 -0700612 use_version_lib: false,
613
614 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800615 compile_multilib: "both",
Tao Bao49042e32018-07-30 20:45:27 -0700616
Tao Bao49042e32018-07-30 20:45:27 -0700617 shared_libs: [
Josh Gaofa3605a2020-03-16 11:30:09 -0700618 "libadbconnection_server",
619 "libapp_processes_protos_lite",
620 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800621 "libadb_crypto",
622 "libadb_pairing_connection",
623 "libadb_tls_connection",
Josh Gao361148b2018-01-02 12:01:43 -0800624 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800625 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700626 "libcrypto",
627 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700628 "liblog",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800629 "libselinux",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700630
631 // APEX dependencies on the system image.
632 "libadbd_auth",
633 "libadbd_fs",
634 "libadbd_services",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800635 ],
636
Joshua Duong929364a2020-02-26 15:43:44 -0800637 target: {
638 recovery: {
639 exclude_shared_libs: [
640 "libadb_pairing_auth",
641 "libadb_pairing_connection",
642 ],
643 }
644 },
645
Josh Gaoa4dfc142020-02-19 13:50:57 -0800646 static_libs: [
Josh Gaodc20c2f2020-03-27 19:41:59 -0700647 "libadbd_core",
Josh Gao2f0f9eb2020-03-04 19:34:08 -0800648 "libbrotli",
Josh Gaoa4dfc142020-02-19 13:50:57 -0800649 "libcutils_sockets",
650 "libdiagnose_usb",
Josh Gaofb386cc2020-03-26 22:02:03 -0700651 "liblz4",
Josh Gao2e24c962020-02-21 16:38:29 -0800652 "libmdnssd",
Josh Gaobdebc9b2020-05-27 17:52:52 -0700653 "libzstd",
Josh Gao361148b2018-01-02 12:01:43 -0800654 ],
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700655
Josh Gao6b55e752020-03-27 18:09:56 -0700656 visibility: [
657 "//bootable/recovery/minadbd",
Baligh Uddin95e03672020-10-18 15:09:52 +0000658 "//packages/modules/adb",
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700659 ],
Josh Gao361148b2018-01-02 12:01:43 -0800660}
661
662cc_binary {
663 name: "adbd",
Josh Gaodc20c2f2020-03-27 19:41:59 -0700664 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900665 recovery_available: true,
Jiyong Parkc6afe4a2020-03-23 14:40:50 +0000666 apex_available: ["com.android.adbd"],
Josh Gao3e0540a2018-03-06 12:57:27 -0800667
Josh Gao361148b2018-01-02 12:01:43 -0800668 srcs: [
669 "daemon/main.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800670 ],
671
672 cflags: [
673 "-D_GNU_SOURCE",
674 "-Wno-deprecated-declarations",
675 ],
676
677 strip: {
678 keep_symbols: true,
679 },
680
Josh Gao2bfc85e2019-08-15 14:05:12 -0700681 static_libs: [
Josh Gao361148b2018-01-02 12:01:43 -0800682 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700683 "libadbd_services",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700684 "libasyncio",
Tao Bao49042e32018-07-30 20:45:27 -0700685 "libcap",
Josh Gaofb386cc2020-03-26 22:02:03 -0700686 "liblz4",
Josh Gao361148b2018-01-02 12:01:43 -0800687 "libminijail",
Joshua Duong290ccb52019-11-20 14:18:43 -0800688 "libssl",
Josh Gao361148b2018-01-02 12:01:43 -0800689 ],
Josh Gao2bfc85e2019-08-15 14:05:12 -0700690
691 shared_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800692 "libadb_protos",
Josh Gao090712a2020-01-16 12:40:43 -0800693 "libadbd_auth",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700694 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800695
Joshua Duong929364a2020-02-26 15:43:44 -0800696 target: {
697 recovery: {
698 exclude_shared_libs: [
699 "libadb_pairing_auth",
700 "libadb_pairing_connection",
701 ],
702 }
703 },
Josh Gao361148b2018-01-02 12:01:43 -0800704}
705
Josh Gao06e45932019-10-23 13:27:17 -0700706phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700707 // Interface between adbd in a module and the system.
708 name: "adbd_system_api",
Josh Gao06e45932019-10-23 13:27:17 -0700709 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700710 "libadbd_auth",
711 "libadbd_fs",
Josh Gao06e45932019-10-23 13:27:17 -0700712 "abb",
Josh Gao83ce3e22019-10-22 12:30:36 -0700713 "reboot",
Josh Gaob554f4b2019-10-22 12:30:30 -0700714 "set-verity-state",
Josh Gao06e45932019-10-23 13:27:17 -0700715 ]
716}
717
718phony {
Josh Gaodf43f5e2020-06-01 18:59:21 -0700719 name: "adbd_system_api_recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700720 required: [
Josh Gaodf43f5e2020-06-01 18:59:21 -0700721 "libadbd_auth",
722 "libadbd_fs",
Josh Gao83ce3e22019-10-22 12:30:36 -0700723 "reboot.recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700724 ],
725}
726
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800727cc_binary {
728 name: "abb",
729
Josh Gao0560feb2019-01-22 19:36:15 -0800730 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800731 stl: "libc++",
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800732 recovery_available: false,
733
734 srcs: [
735 "daemon/abb.cpp",
736 ],
737
738 cflags: [
739 "-D_GNU_SOURCE",
740 "-Wno-deprecated-declarations",
741 ],
742
743 strip: {
744 keep_symbols: true,
745 },
746
747 static_libs: [
748 "libadbd_core",
749 "libadbd_services",
750 "libcmd",
751 ],
752
753 shared_libs: [
754 "libbase",
755 "libbinder",
756 "liblog",
757 "libutils",
758 "libselinux",
759 ],
760}
761
Josh Gao361148b2018-01-02 12:01:43 -0800762cc_test {
763 name: "adbd_test",
Josh Gao06af61e2020-02-03 23:08:05 -0800764
Josh Gaodc20c2f2020-03-27 19:41:59 -0700765 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao06af61e2020-02-03 23:08:05 -0800766
767 recovery_available: false,
Josh Gao361148b2018-01-02 12:01:43 -0800768 srcs: libadb_test_srcs + [
Josh Gao5607e922018-07-25 18:15:52 -0700769 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800770 "daemon/shell_service.cpp",
771 "daemon/shell_service_test.cpp",
772 "shell_service_protocol.cpp",
773 "shell_service_protocol_test.cpp",
Joshua Duong77b8ff32020-04-16 15:58:19 -0700774 "mdns_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800775 ],
776
Chen Zhu72ccee32020-05-08 16:45:11 -0700777 test_config: "adb_test.xml",
778
Josh Gaodc20c2f2020-03-27 19:41:59 -0700779 shared_libs: [
780 "liblog",
781 ],
782
Josh Gao361148b2018-01-02 12:01:43 -0800783 static_libs: [
784 "libadbd",
Josh Gao7cac88a2019-10-22 12:30:39 -0700785 "libadbd_auth",
Josh Gao361148b2018-01-02 12:01:43 -0800786 "libbase",
Josh Gao361148b2018-01-02 12:01:43 -0800787 "libcrypto_utils",
Josh Gao361148b2018-01-02 12:01:43 -0800788 "libusb",
Josh Gao361148b2018-01-02 12:01:43 -0800789 ],
Josh Gao9b06dca2020-01-30 14:49:01 -0800790 test_suites: ["device-tests", "mts"],
Dan Shi22e091b2019-09-24 09:04:05 -0700791 require_root: true,
Josh Gao361148b2018-01-02 12:01:43 -0800792}
793
Julien Desprezae94f512018-08-08 12:08:50 -0700794python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800795 name: "adb_integration_test_adb",
796 main: "test_adb.py",
797 srcs: [
798 "test_adb.py",
799 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700800 test_config: "adb_integration_test_adb.xml",
801 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800802 version: {
803 py2: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700804 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800805 },
806 py3: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700807 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800808 },
GuangHui Liu35994392017-05-10 14:37:17 -0700809 },
GuangHui Liu35994392017-05-10 14:37:17 -0700810}
811
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700812python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800813 name: "adb_integration_test_device",
814 main: "test_device.py",
815 srcs: [
816 "test_device.py",
817 ],
818 libs: [
819 "adb_py",
820 ],
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700821 test_config: "adb_integration_test_device.xml",
822 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800823 version: {
824 py2: {
Josh Gao4218d852020-02-06 17:52:38 -0800825 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800826 },
827 py3: {
Josh Gao4218d852020-02-06 17:52:38 -0800828 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800829 },
GuangHui Liu35994392017-05-10 14:37:17 -0700830 },
GuangHui Liu35994392017-05-10 14:37:17 -0700831}
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700832
833// Note: using pipe for xxd to control the variable name generated
834// the default name used by xxd is the path to the input file.
835java_genrule {
836 name: "bin2c_fastdeployagent",
837 out: ["deployagent.inc"],
838 srcs: [":deployagent"],
839 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
840}
841
842genrule {
843 name: "bin2c_fastdeployagentscript",
844 out: ["deployagentscript.inc"],
845 srcs: ["fastdeploy/deployagent/deployagent.sh"],
846 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
847}
848
849cc_library_host_static {
850 name: "libfastdeploy_host",
851 defaults: ["adb_defaults"],
852 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700853 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700854 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
855 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
856 "fastdeploy/proto/ApkEntry.proto",
857 ],
858 static_libs: [
859 "libadb_host",
860 "libandroidfw",
861 "libbase",
862 "libcutils",
863 "libcrypto_utils",
864 "libcrypto",
865 "libdiagnose_usb",
866 "liblog",
867 "libmdnssd",
868 "libusb",
869 "libutils",
870 "libziparchive",
871 "libz",
872 ],
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700873 proto: {
874 type: "lite",
875 export_proto_headers: true,
876 },
877 target: {
878 windows: {
879 enabled: true,
880 shared_libs: ["AdbWinApi"],
881 },
882 },
883}
884
885cc_test_host {
886 name: "fastdeploy_test",
887 defaults: ["adb_defaults"],
888 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700889 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700890 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
891 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
892 ],
893 static_libs: [
Joshua Duong290ccb52019-11-20 14:18:43 -0800894 "libadb_crypto_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700895 "libadb_host",
Joshua Duong290ccb52019-11-20 14:18:43 -0800896 "libadb_pairing_auth_static",
897 "libadb_pairing_connection_static",
898 "libadb_protos_static",
Joshua Duong93b407c2020-07-30 16:34:29 -0700899 "libadb_sysdeps",
Joshua Duong290ccb52019-11-20 14:18:43 -0800900 "libadb_tls_connection_static",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700901 "libandroidfw",
902 "libbase",
903 "libcutils",
904 "libcrypto_utils",
905 "libcrypto",
906 "libdiagnose_usb",
907 "libfastdeploy_host",
908 "liblog",
909 "libmdnssd",
910 "libprotobuf-cpp-lite",
Joshua Duong290ccb52019-11-20 14:18:43 -0800911 "libssl",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700912 "libusb",
913 "libutils",
914 "libziparchive",
915 "libz",
916 ],
917 target: {
918 windows: {
919 enabled: true,
920 shared_libs: ["AdbWinApi"],
921 },
922 },
923 data: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700924 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700925 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700926 "fastdeploy/testdata/sample.apk",
927 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700928 ],
929}