blob: c361a14bc397ac139b9e047601aa09150bc4ef33 [file] [log] [blame]
GuangHui Liu41bda342017-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 Duong89169a32020-07-17 14:14:00 -070015tidy_errors = [
16 "-*",
17 "bugprone-inaccurate-erase",
18]
19
Josh Gao27768452018-01-02 12:01:43 -080020cc_defaults {
21 name: "adb_defaults",
22
23 cflags: [
24 "-Wall",
25 "-Wextra",
26 "-Werror",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070027 "-Wexit-time-destructors",
Jiyong Parkee989fc2020-09-18 16:35:06 +090028 "-Wno-non-virtual-dtor",
Josh Gao27768452018-01-02 12:01:43 -080029 "-Wno-unused-parameter",
30 "-Wno-missing-field-initializers",
Josh Gao776c2ec2019-01-22 19:36:15 -080031 "-Wthread-safety",
Josh Gao27768452018-01-02 12:01:43 -080032 "-Wvla",
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080033 "-DADB_HOST=1", // overridden by adbd_defaults
Josh Gao27241a72019-04-25 14:04:57 -070034 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao27768452018-01-02 12:01:43 -080035 ],
Josh Gao6eb78822018-11-16 15:40:16 -080036 cpp_std: "experimental",
Josh Gao27768452018-01-02 12:01:43 -080037
Josh Gaoc7567fa2018-02-27 15:49:23 -080038 use_version_lib: true,
Josh Gao27768452018-01-02 12:01:43 -080039 compile_multilib: "first",
Josh Gao27768452018-01-02 12:01:43 -080040
41 target: {
Josh Gao27768452018-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 Hughes3c59cb82018-12-03 09:02:18 -080062 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao27768452018-01-02 12:01:43 -080063 "-D_GNU_SOURCE",
Josh Gao2e1e7892018-03-23 13:03:28 -070064
65 // MinGW hides some things behind _POSIX_SOURCE.
66 "-D_POSIX_SOURCE",
Josh Gao776c2ec2019-01-22 19:36:15 -080067
Josh Gao4710e532019-04-17 16:57:43 -070068 // libusb uses __stdcall on a variadic function, which gets ignored.
69 "-Wno-ignored-attributes",
70
Josh Gao776c2ec2019-01-22 19:36:15 -080071 // Not supported yet.
72 "-Wno-thread-safety",
Josh Gao27768452018-01-02 12:01:43 -080073 ],
Josh Gaof8a97c12018-03-23 15:37:20 -070074
75 host_ldlibs: [
76 "-lws2_32",
77 "-lgdi32",
78 "-luserenv",
79 ],
Josh Gao27768452018-01-02 12:01:43 -080080 },
Josh Gao776c2ec2019-01-22 19:36:15 -080081 },
Joshua Duong89169a32020-07-17 14:14:00 -070082
83 tidy: true,
84 tidy_checks: tidy_errors,
85 tidy_checks_as_errors: tidy_errors,
Josh Gao776c2ec2019-01-22 19:36:15 -080086}
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070087
Josh Gao776c2ec2019-01-22 19:36:15 -080088cc_defaults {
89 name: "adbd_defaults",
90 defaults: ["adb_defaults"],
91
92 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
Josh Gao27768452018-01-02 12:01:43 -080093}
94
Josh Gao776c2ec2019-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
Josh Gao37356142020-03-27 19:41:59 -0700116cc_defaults {
117 name: "libadbd_binary_dependencies",
118 static_libs: [
119 "libadb_crypto",
120 "libadb_pairing_connection",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700121 "libadb_sysdeps",
Josh Gao37356142020-03-27 19:41:59 -0700122 "libadb_tls_connection",
123 "libadbd",
124 "libadbd_core",
125 "libadbconnection_server",
126 "libasyncio",
Josh Gao317d3e12020-05-27 17:52:52 -0700127 "libbase",
Josh Gao37356142020-03-27 19:41:59 -0700128 "libbrotli",
129 "libcutils_sockets",
130 "libdiagnose_usb",
131 "libmdnssd",
Josh Gao317d3e12020-05-27 17:52:52 -0700132 "libzstd",
Josh Gao37356142020-03-27 19:41:59 -0700133
134 "libadb_protos",
135 "libapp_processes_protos_lite",
136 "libprotobuf-cpp-lite",
137 ],
138
139 shared_libs: [
140 "libadbd_auth",
141 "libadbd_fs",
142 "libcrypto",
143 "libcrypto_utils",
144 "liblog",
145 "libselinux",
146 ],
147
148 target: {
149 recovery: {
150 exclude_static_libs: [
151 "libadb_pairing_auth",
152 "libadb_pairing_connection",
153 ],
154 },
155 },
156}
157
Josh Gao27768452018-01-02 12:01:43 -0800158// libadb
159// =========================================================
160// These files are compiled for both the host and the device.
161libadb_srcs = [
162 "adb.cpp",
163 "adb_io.cpp",
164 "adb_listeners.cpp",
165 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700166 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800167 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700168 "fdevent/fdevent.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800169 "services.cpp",
170 "sockets.cpp",
171 "socket_spec.cpp",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700172 "sysdeps/env.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800173 "sysdeps/errno.cpp",
174 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700175 "transport_fd.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700176 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800177]
178
Josh Gao073c8d22020-04-20 19:22:05 -0700179libadb_darwin_srcs = [
180 "fdevent/fdevent_poll.cpp",
181]
182
183libadb_windows_srcs = [
184 "fdevent/fdevent_poll.cpp",
185 "sysdeps_win32.cpp",
186 "sysdeps/win32/errno.cpp",
187 "sysdeps/win32/stat.cpp",
188]
189
Josh Gao27768452018-01-02 12:01:43 -0800190libadb_posix_srcs = [
191 "sysdeps_unix.cpp",
192 "sysdeps/posix/network.cpp",
193]
194
Josh Gaob43ad442019-07-11 13:47:44 -0700195libadb_linux_srcs = [
196 "fdevent/fdevent_epoll.cpp",
197]
198
Josh Gao27768452018-01-02 12:01:43 -0800199libadb_test_srcs = [
200 "adb_io_test.cpp",
201 "adb_listeners_test.cpp",
202 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700203 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800204 "socket_spec_test.cpp",
205 "socket_test.cpp",
206 "sysdeps_test.cpp",
207 "sysdeps/stat_test.cpp",
208 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700209 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800210]
211
212cc_library_host_static {
213 name: "libadb_host",
214 defaults: ["adb_defaults"],
215
216 srcs: libadb_srcs + [
217 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800218 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800219 "client/usb_libusb.cpp",
220 "client/usb_dispatch.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700221 "client/transport_local.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800222 "client/transport_mdns.cpp",
Joshua Duong7be85192020-04-30 15:45:38 -0700223 "client/mdns_utils.cpp",
Josh Gao08718242020-03-27 18:09:56 -0700224 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800225 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800226 ],
227
Dan Willemsenab971b52018-08-29 14:58:02 -0700228 generated_headers: ["platform_tools_version"],
229
Josh Gao27768452018-01-02 12:01:43 -0800230 target: {
231 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700232 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800233 },
234 darwin: {
Josh Gao073c8d22020-04-20 19:22:05 -0700235 srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800236 },
Josh Gao27768452018-01-02 12:01:43 -0800237 not_windows: {
238 srcs: libadb_posix_srcs,
239 },
240 windows: {
241 enabled: true,
242 srcs: [
243 "client/usb_windows.cpp",
Josh Gao073c8d22020-04-20 19:22:05 -0700244 ] + libadb_windows_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800245 shared_libs: ["AdbWinApi"],
246 },
247 },
248
249 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800250 "libadb_crypto",
251 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800252 "libadb_pairing_connection",
253 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800254 "libbase",
255 "libcrypto_utils",
256 "libcrypto",
257 "libdiagnose_usb",
258 "libmdnssd",
259 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100260 "libutils",
261 "liblog",
262 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800263 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800264 ],
265}
266
Joshua Duong62a42ec2020-07-30 16:34:29 -0700267cc_library {
268 name: "libadb_sysdeps",
269 defaults: ["adb_defaults"],
270 recovery_available: true,
271 host_supported: true,
272 compile_multilib: "both",
273 min_sdk_version: "apex_inherit",
Jiyong Park4c575962020-08-25 17:05:41 +0900274 // This library doesn't use build::GetBuildNumber()
275 use_version_lib: false,
Joshua Duong62a42ec2020-07-30 16:34:29 -0700276
277 srcs: [
278 "sysdeps/env.cpp",
279 ],
280
281 shared_libs: [
282 "libbase",
283 "liblog",
284 ],
285
286 target: {
287 windows: {
288 enabled: true,
289 ldflags: ["-municode"],
290 },
291 },
292
293 export_include_dirs: ["."],
294
295 visibility: [
Joshua Duong62a42ec2020-07-30 16:34:29 -0700296 "//bootable/recovery/minadbd:__subpackages__",
Baligh Uddin27674472020-10-18 15:09:52 +0000297 "//packages/modules/adb:__subpackages__",
298 "//system/core/adb:__subpackages__",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700299 ],
300
301 apex_available: [
302 "com.android.adbd",
303 "test_com.android.adbd",
304 ],
305}
306
Josh Gao27768452018-01-02 12:01:43 -0800307cc_test_host {
308 name: "adb_test",
309 defaults: ["adb_defaults"],
Joshua Duong7be85192020-04-30 15:45:38 -0700310 srcs: libadb_test_srcs + [
311 "client/mdns_utils_test.cpp",
312 ],
313
Josh Gao27768452018-01-02 12:01:43 -0800314 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800315 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800316 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800317 "libadb_pairing_auth_static",
318 "libadb_pairing_connection_static",
319 "libadb_protos_static",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700320 "libadb_sysdeps",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800321 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800322 "libbase",
323 "libcutils",
324 "libcrypto_utils",
325 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800326 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800327 "libmdnssd",
328 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800329 "libprotobuf-cpp-lite",
330 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800331 "libusb",
332 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700333
334 target: {
335 windows: {
336 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700337 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700338 shared_libs: ["AdbWinApi"],
339 },
340 },
Josh Gao27768452018-01-02 12:01:43 -0800341}
342
343cc_binary_host {
344 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800345
Josh Gao99522582020-02-03 23:08:05 -0800346 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800347 defaults: ["adb_defaults"],
348
349 srcs: [
350 "client/adb_client.cpp",
351 "client/bugreport.cpp",
352 "client/commandline.cpp",
353 "client/file_sync_client.cpp",
354 "client/main.cpp",
355 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000356 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800357 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700358 "client/fastdeploy.cpp",
359 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800360 "client/incremental.cpp",
361 "client/incremental_server.cpp",
Songchun Fanc3eb3012020-03-13 13:11:43 -0700362 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800363 "shell_service_protocol.cpp",
364 ],
365
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700366 generated_headers: [
367 "bin2c_fastdeployagent",
368 "bin2c_fastdeployagentscript"
369 ],
370
Josh Gao27768452018-01-02 12:01:43 -0800371 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800372 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800373 "libadb_host",
Josh Gao31d42aa2020-03-26 13:46:08 -0700374 "libadb_pairing_auth",
375 "libadb_pairing_connection",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800376 "libadb_protos",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700377 "libadb_sysdeps",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800378 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700379 "libandroidfw",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800380 "libapp_processes_protos_full",
Josh Gao27768452018-01-02 12:01:43 -0800381 "libbase",
Josh Gao939fc192020-03-04 19:34:08 -0800382 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800383 "libcutils",
384 "libcrypto_utils",
385 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700386 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800387 "libdiagnose_usb",
388 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800389 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800390 "libmdnssd",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800391 "libprotobuf-cpp-full",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800392 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800393 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100394 "libutils",
395 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700396 "libziparchive",
397 "libz",
Josh Gao317d3e12020-05-27 17:52:52 -0700398 "libzstd",
Josh Gao27768452018-01-02 12:01:43 -0800399 ],
400
Josh Gao27768452018-01-02 12:01:43 -0800401 // Don't add anything here, we don't want additional shared dependencies
402 // on the host adb tool, and shared libraries that link against libc++
403 // will violate ODR
404 shared_libs: [],
405
Dan Willemsen3f439a72018-11-19 19:11:35 -0800406 // Archive adb, adb.exe.
407 dist: {
408 targets: [
409 "dist_files",
410 "sdk",
411 "win_sdk",
412 ],
413 },
414
Josh Gao27768452018-01-02 12:01:43 -0800415 target: {
416 darwin: {
417 cflags: [
418 "-Wno-sizeof-pointer-memaccess",
419 ],
420 },
421 windows: {
422 enabled: true,
423 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800424 shared_libs: ["AdbWinApi"],
425 required: [
426 "AdbWinUsbApi",
427 ],
428 },
429 },
430}
431
Tao Baoeca59ae2018-07-30 20:45:27 -0700432// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800433cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700434 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800435 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700436 recovery_available: true,
437
438 // libminadbd wants both, as it's used to build native tests.
439 compile_multilib: "both",
440
Josh Gaob43ad442019-07-11 13:47:44 -0700441 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Josh Gao8a9277a2020-04-22 17:30:06 -0700442 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700443 "daemon/auth.cpp",
444 "daemon/jdwp_service.cpp",
Josh Gao52d0b672020-02-26 16:39:20 -0800445 "daemon/logging.cpp",
Josh Gao8a9277a2020-04-22 17:30:06 -0700446 "daemon/transport_local.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700447 ],
448
Dan Willemsenab971b52018-08-29 14:58:02 -0700449 generated_headers: ["platform_tools_version"],
450
Tao Baoeca59ae2018-07-30 20:45:27 -0700451 static_libs: [
452 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700453 ],
454
455 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700456 "libadbconnection_server",
Joshua Duongef28ca42019-12-19 16:36:30 -0800457 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800458 "libadb_pairing_connection",
459 "libadb_protos",
460 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700461 "libadbd_auth",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700462 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700463 "libasyncio",
464 "libbase",
465 "libcrypto",
466 "libcrypto_utils",
Josh Gao37356142020-03-27 19:41:59 -0700467 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700468 "liblog",
469 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800470
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800471 proto: {
472 type: "lite",
473 static: true,
474 export_proto_headers: true,
475 },
476
Josh Gao776c2ec2019-01-22 19:36:15 -0800477 target: {
478 android: {
479 whole_static_libs: [
480 "libqemu_pipe",
481 ],
482 srcs: [
483 "daemon/transport_qemu.cpp",
484 "daemon/usb.cpp",
485 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800486 ]
Joshua Duong0f53d172020-02-26 15:43:44 -0800487 },
488 recovery: {
489 exclude_shared_libs: [
490 "libadb_pairing_auth",
491 "libadb_pairing_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700492 "libapp_processes_protos_lite",
Joshua Duong0f53d172020-02-26 15:43:44 -0800493 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800494 }
495 },
Josh Gaob5673032020-03-16 12:48:18 -0700496
497 apex_available: [
498 "//apex_available:platform",
499 "com.android.adbd",
500 ],
501 visibility: [
502 "//bootable/recovery/minadbd",
Baligh Uddin27674472020-10-18 15:09:52 +0000503 "//packages/modules/adb:__subpackages__",
Josh Gaob5673032020-03-16 12:48:18 -0700504 "//system/core/adb",
505 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700506}
507
Josh Gao7f8a37c2020-03-09 15:20:55 -0700508cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700509 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800510 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700511 recovery_available: true,
512 compile_multilib: "both",
513
514 srcs: [
515 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700516 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700517 "daemon/shell_service.cpp",
518 "shell_service_protocol.cpp",
519 ],
520
521 cflags: [
522 "-D_GNU_SOURCE",
523 "-Wno-deprecated-declarations",
524 ],
525
526 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800527 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700528 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800529 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700530 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700531 "liblz4",
Josh Gao317d3e12020-05-27 17:52:52 -0700532 "libzstd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700533 ],
534
535 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800536 "libadb_crypto",
537 "libadb_pairing_connection",
538 "libadb_protos",
539 "libadb_tls_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700540 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700541 "libasyncio",
542 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700543 "libcrypto_utils",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700544 "libcutils_sockets",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700545 "libprotobuf-cpp-lite",
Josh Gao37356142020-03-27 19:41:59 -0700546
547 // APEX dependencies.
548 "libadbd_auth",
549 "libadbd_fs",
550 "libcrypto",
551 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700552 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800553
554 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800555 android: {
556 srcs: [
557 "daemon/abb_service.cpp",
558 "daemon/framebuffer_service.cpp",
559 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800560 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800561 ],
562 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800563 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800564 "libselinux",
565 ],
566 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800567 recovery: {
568 exclude_srcs: [
569 "daemon/abb_service.cpp",
570 ],
Joshua Duong0f53d172020-02-26 15:43:44 -0800571 exclude_shared_libs: [
572 "libadb_pairing_auth",
573 "libadb_pairing_connection",
574 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800575 },
576 },
Josh Gaob5673032020-03-16 12:48:18 -0700577
578 apex_available: [
579 "//apex_available:platform",
580 "com.android.adbd",
581 ],
582 visibility: [
Baligh Uddin27674472020-10-18 15:09:52 +0000583 "//packages/modules/adb",
Josh Gaob5673032020-03-16 12:48:18 -0700584 "//system/core/adb",
585 ],
586
Tao Baoeca59ae2018-07-30 20:45:27 -0700587}
588
589cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800590 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800591 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900592 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000593 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800594
Josh Gaobb7fc922020-01-22 17:58:03 -0800595 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700596 use_version_lib: false,
597
598 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800599 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700600
Tao Baoeca59ae2018-07-30 20:45:27 -0700601 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700602 "libadbconnection_server",
603 "libapp_processes_protos_lite",
604 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800605 "libadb_crypto",
606 "libadb_pairing_connection",
607 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800608 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800609 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700610 "libcrypto",
611 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700612 "liblog",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800613 "libselinux",
Josh Gao37356142020-03-27 19:41:59 -0700614
615 // APEX dependencies on the system image.
616 "libadbd_auth",
617 "libadbd_fs",
618 "libadbd_services",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800619 ],
620
Joshua Duong0f53d172020-02-26 15:43:44 -0800621 target: {
622 recovery: {
623 exclude_shared_libs: [
624 "libadb_pairing_auth",
625 "libadb_pairing_connection",
626 ],
627 }
628 },
629
Josh Gaoa9b62d52020-02-19 13:50:57 -0800630 static_libs: [
Josh Gao37356142020-03-27 19:41:59 -0700631 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800632 "libbrotli",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800633 "libcutils_sockets",
634 "libdiagnose_usb",
Josh Gaoec44d352020-03-26 22:02:03 -0700635 "liblz4",
Josh Gao6d949e82020-02-21 16:38:29 -0800636 "libmdnssd",
Josh Gao317d3e12020-05-27 17:52:52 -0700637 "libzstd",
Josh Gao27768452018-01-02 12:01:43 -0800638 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700639
Josh Gao08718242020-03-27 18:09:56 -0700640 visibility: [
641 "//bootable/recovery/minadbd",
Baligh Uddin27674472020-10-18 15:09:52 +0000642 "//packages/modules/adb",
Josh Gao08718242020-03-27 18:09:56 -0700643 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700644 ],
Josh Gao27768452018-01-02 12:01:43 -0800645}
646
647cc_binary {
648 name: "adbd",
Josh Gao37356142020-03-27 19:41:59 -0700649 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900650 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000651 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800652
Josh Gao27768452018-01-02 12:01:43 -0800653 srcs: [
654 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800655 ],
656
657 cflags: [
658 "-D_GNU_SOURCE",
659 "-Wno-deprecated-declarations",
660 ],
661
662 strip: {
663 keep_symbols: true,
664 },
665
Josh Gao594f70f2019-08-15 14:05:12 -0700666 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800667 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700668 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700669 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700670 "libcap",
Josh Gaoec44d352020-03-26 22:02:03 -0700671 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800672 "libminijail",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800673 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800674 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700675
676 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800677 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800678 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700679 ],
Josh Gao99522582020-02-03 23:08:05 -0800680
Joshua Duong0f53d172020-02-26 15:43:44 -0800681 target: {
682 recovery: {
683 exclude_shared_libs: [
684 "libadb_pairing_auth",
685 "libadb_pairing_connection",
686 ],
687 }
688 },
Josh Gao27768452018-01-02 12:01:43 -0800689}
690
Josh Gao7b7ee192019-10-23 13:27:17 -0700691phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700692 // Interface between adbd in a module and the system.
693 name: "adbd_system_api",
Josh Gao7b7ee192019-10-23 13:27:17 -0700694 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700695 "libadbd_auth",
696 "libadbd_fs",
Josh Gao7b7ee192019-10-23 13:27:17 -0700697 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700698 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700699 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700700 ]
701}
702
703phony {
Josh Gaoe572f2f2020-06-01 18:59:21 -0700704 name: "adbd_system_api_recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700705 required: [
Josh Gaoe572f2f2020-06-01 18:59:21 -0700706 "libadbd_auth",
707 "libadbd_fs",
Josh Gao2c356bb2019-10-22 12:30:36 -0700708 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700709 ],
710}
711
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800712cc_binary {
713 name: "abb",
714
Josh Gao776c2ec2019-01-22 19:36:15 -0800715 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800716 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800717 recovery_available: false,
718
719 srcs: [
720 "daemon/abb.cpp",
721 ],
722
723 cflags: [
724 "-D_GNU_SOURCE",
725 "-Wno-deprecated-declarations",
726 ],
727
728 strip: {
729 keep_symbols: true,
730 },
731
732 static_libs: [
733 "libadbd_core",
734 "libadbd_services",
735 "libcmd",
736 ],
737
738 shared_libs: [
739 "libbase",
740 "libbinder",
741 "liblog",
742 "libutils",
743 "libselinux",
744 ],
745}
746
Josh Gao27768452018-01-02 12:01:43 -0800747cc_test {
748 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800749
Josh Gao37356142020-03-27 19:41:59 -0700750 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800751
752 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800753 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700754 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800755 "daemon/shell_service.cpp",
756 "daemon/shell_service_test.cpp",
757 "shell_service_protocol.cpp",
758 "shell_service_protocol_test.cpp",
Joshua Duong81f2db42020-04-16 15:58:19 -0700759 "mdns_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800760 ],
761
Chen Zhu5daea5a2020-05-08 16:45:11 -0700762 test_config: "adb_test.xml",
763
Josh Gao37356142020-03-27 19:41:59 -0700764 shared_libs: [
765 "liblog",
766 ],
767
Josh Gao27768452018-01-02 12:01:43 -0800768 static_libs: [
769 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700770 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800771 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800772 "libcrypto_utils",
Josh Gao27768452018-01-02 12:01:43 -0800773 "libusb",
Josh Gao27768452018-01-02 12:01:43 -0800774 ],
Josh Gao7e015872020-01-30 14:49:01 -0800775 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700776 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800777}
778
Julien Desprez75fea7e2018-08-08 12:08:50 -0700779python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800780 name: "adb_integration_test_adb",
781 main: "test_adb.py",
782 srcs: [
783 "test_adb.py",
784 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700785 test_config: "adb_integration_test_adb.xml",
786 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800787 version: {
788 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700789 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800790 },
791 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700792 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800793 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700794 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700795}
796
Julien Desprez618f0e12018-10-12 13:48:14 -0700797python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800798 name: "adb_integration_test_device",
799 main: "test_device.py",
800 srcs: [
801 "test_device.py",
802 ],
803 libs: [
804 "adb_py",
805 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700806 test_config: "adb_integration_test_device.xml",
807 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800808 version: {
809 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800810 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800811 },
812 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800813 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800814 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700815 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700816}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700817
818// Note: using pipe for xxd to control the variable name generated
819// the default name used by xxd is the path to the input file.
820java_genrule {
821 name: "bin2c_fastdeployagent",
822 out: ["deployagent.inc"],
823 srcs: [":deployagent"],
824 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
825}
826
827genrule {
828 name: "bin2c_fastdeployagentscript",
829 out: ["deployagentscript.inc"],
830 srcs: ["fastdeploy/deployagent/deployagent.sh"],
831 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
832}
833
834cc_library_host_static {
835 name: "libfastdeploy_host",
836 defaults: ["adb_defaults"],
837 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700838 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700839 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
840 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
841 "fastdeploy/proto/ApkEntry.proto",
842 ],
843 static_libs: [
844 "libadb_host",
845 "libandroidfw",
846 "libbase",
847 "libcutils",
848 "libcrypto_utils",
849 "libcrypto",
850 "libdiagnose_usb",
851 "liblog",
852 "libmdnssd",
853 "libusb",
854 "libutils",
855 "libziparchive",
856 "libz",
857 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700858 proto: {
859 type: "lite",
860 export_proto_headers: true,
861 },
862 target: {
863 windows: {
864 enabled: true,
865 shared_libs: ["AdbWinApi"],
866 },
867 },
868}
869
870cc_test_host {
871 name: "fastdeploy_test",
872 defaults: ["adb_defaults"],
873 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700874 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700875 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
876 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
877 ],
878 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800879 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700880 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800881 "libadb_pairing_auth_static",
882 "libadb_pairing_connection_static",
883 "libadb_protos_static",
Joshua Duong62a42ec2020-07-30 16:34:29 -0700884 "libadb_sysdeps",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800885 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700886 "libandroidfw",
887 "libbase",
888 "libcutils",
889 "libcrypto_utils",
890 "libcrypto",
891 "libdiagnose_usb",
892 "libfastdeploy_host",
893 "liblog",
894 "libmdnssd",
895 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800896 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700897 "libusb",
898 "libutils",
899 "libziparchive",
900 "libz",
901 ],
902 target: {
903 windows: {
904 enabled: true,
905 shared_libs: ["AdbWinApi"],
906 },
907 },
908 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700909 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700910 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700911 "fastdeploy/testdata/sample.apk",
912 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700913 ],
914}