blob: a557090cc7431b57e599743b1ac8ccf90a74e143 [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
Josh Gao27768452018-01-02 12:01:43 -080015cc_defaults {
16 name: "adb_defaults",
17
18 cflags: [
19 "-Wall",
20 "-Wextra",
21 "-Werror",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070022 "-Wexit-time-destructors",
Josh Gao27768452018-01-02 12:01:43 -080023 "-Wno-unused-parameter",
24 "-Wno-missing-field-initializers",
Josh Gao776c2ec2019-01-22 19:36:15 -080025 "-Wthread-safety",
Josh Gao27768452018-01-02 12:01:43 -080026 "-Wvla",
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080027 "-DADB_HOST=1", // overridden by adbd_defaults
28 "-DALLOW_ADBD_ROOT=0", // overridden by adbd_defaults
Josh Gao27241a72019-04-25 14:04:57 -070029 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao27768452018-01-02 12:01:43 -080030 ],
Josh Gao6eb78822018-11-16 15:40:16 -080031 cpp_std: "experimental",
Josh Gao27768452018-01-02 12:01:43 -080032
Josh Gaoc7567fa2018-02-27 15:49:23 -080033 use_version_lib: true,
Josh Gao27768452018-01-02 12:01:43 -080034 compile_multilib: "first",
Josh Gao27768452018-01-02 12:01:43 -080035
36 target: {
Josh Gao27768452018-01-02 12:01:43 -080037 darwin: {
38 host_ldlibs: [
39 "-lpthread",
40 "-framework CoreFoundation",
41 "-framework IOKit",
42 "-lobjc",
43 ],
44 },
45
46 windows: {
47 cflags: [
48 // Define windows.h and tchar.h Unicode preprocessor symbols so that
49 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
50 // build if you accidentally pass char*. Fix by calling like:
51 // std::wstring path_wide;
52 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
53 // CreateFileW(path_wide.c_str());
54 "-DUNICODE=1",
55 "-D_UNICODE=1",
56
Elliott Hughes3c59cb82018-12-03 09:02:18 -080057 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao27768452018-01-02 12:01:43 -080058 "-D_GNU_SOURCE",
Josh Gao2e1e7892018-03-23 13:03:28 -070059
60 // MinGW hides some things behind _POSIX_SOURCE.
61 "-D_POSIX_SOURCE",
Josh Gao776c2ec2019-01-22 19:36:15 -080062
Josh Gao4710e532019-04-17 16:57:43 -070063 // libusb uses __stdcall on a variadic function, which gets ignored.
64 "-Wno-ignored-attributes",
65
Josh Gao776c2ec2019-01-22 19:36:15 -080066 // Not supported yet.
67 "-Wno-thread-safety",
Josh Gao27768452018-01-02 12:01:43 -080068 ],
Josh Gaof8a97c12018-03-23 15:37:20 -070069
70 host_ldlibs: [
71 "-lws2_32",
72 "-lgdi32",
73 "-luserenv",
74 ],
Josh Gao27768452018-01-02 12:01:43 -080075 },
Josh Gao776c2ec2019-01-22 19:36:15 -080076 },
77}
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070078
Josh Gao776c2ec2019-01-22 19:36:15 -080079cc_defaults {
80 name: "adbd_defaults",
81 defaults: ["adb_defaults"],
82
83 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
84 product_variables: {
85 debuggable: {
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070086 cflags: [
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080087 "-UALLOW_ADBD_ROOT",
88 "-DALLOW_ADBD_ROOT=1",
Josh Gao776c2ec2019-01-22 19:36:15 -080089 "-DALLOW_ADBD_DISABLE_VERITY",
90 "-DALLOW_ADBD_NO_AUTH",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070091 ],
92 },
Josh Gao27768452018-01-02 12:01:43 -080093 },
94}
95
Josh Gao776c2ec2019-01-22 19:36:15 -080096cc_defaults {
97 name: "host_adbd_supported",
98
99 host_supported: true,
100 target: {
101 linux: {
102 enabled: true,
103 host_ldlibs: [
104 "-lresolv", // b64_pton
105 "-lutil", // forkpty
106 ],
107 },
108 darwin: {
109 enabled: false,
110 },
111 windows: {
112 enabled: false,
113 },
114 },
115}
116
Josh Gao37356142020-03-27 19:41:59 -0700117cc_defaults {
118 name: "libadbd_binary_dependencies",
119 static_libs: [
120 "libadb_crypto",
121 "libadb_pairing_connection",
122 "libadb_tls_connection",
123 "libadbd",
124 "libadbd_core",
125 "libadbconnection_server",
126 "libasyncio",
127 "libbrotli",
128 "libcutils_sockets",
129 "libdiagnose_usb",
130 "libmdnssd",
131 "libbase",
132
133 "libadb_protos",
134 "libapp_processes_protos_lite",
135 "libprotobuf-cpp-lite",
136 ],
137
138 shared_libs: [
139 "libadbd_auth",
140 "libadbd_fs",
141 "libcrypto",
142 "libcrypto_utils",
143 "liblog",
144 "libselinux",
145 ],
146
147 target: {
148 recovery: {
149 exclude_static_libs: [
150 "libadb_pairing_auth",
151 "libadb_pairing_connection",
152 ],
153 },
154 },
155}
156
Josh Gao27768452018-01-02 12:01:43 -0800157// libadb
158// =========================================================
159// These files are compiled for both the host and the device.
160libadb_srcs = [
161 "adb.cpp",
162 "adb_io.cpp",
163 "adb_listeners.cpp",
164 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700165 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800166 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700167 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700168 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800169 "services.cpp",
170 "sockets.cpp",
171 "socket_spec.cpp",
172 "sysdeps/errno.cpp",
173 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700174 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800175 "transport_local.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700176 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800177]
178
179libadb_posix_srcs = [
180 "sysdeps_unix.cpp",
181 "sysdeps/posix/network.cpp",
182]
183
Josh Gaob43ad442019-07-11 13:47:44 -0700184libadb_linux_srcs = [
185 "fdevent/fdevent_epoll.cpp",
186]
187
Josh Gao27768452018-01-02 12:01:43 -0800188libadb_test_srcs = [
189 "adb_io_test.cpp",
190 "adb_listeners_test.cpp",
191 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700192 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800193 "socket_spec_test.cpp",
194 "socket_test.cpp",
195 "sysdeps_test.cpp",
196 "sysdeps/stat_test.cpp",
197 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700198 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800199]
200
201cc_library_host_static {
202 name: "libadb_host",
203 defaults: ["adb_defaults"],
204
205 srcs: libadb_srcs + [
206 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800207 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800208 "client/usb_libusb.cpp",
209 "client/usb_dispatch.cpp",
210 "client/transport_mdns.cpp",
Josh Gao08718242020-03-27 18:09:56 -0700211 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800212 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800213 ],
214
Dan Willemsenab971b52018-08-29 14:58:02 -0700215 generated_headers: ["platform_tools_version"],
216
Josh Gao27768452018-01-02 12:01:43 -0800217 target: {
218 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700219 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800220 },
221 darwin: {
222 srcs: ["client/usb_osx.cpp"],
223 },
Josh Gao27768452018-01-02 12:01:43 -0800224 not_windows: {
225 srcs: libadb_posix_srcs,
226 },
227 windows: {
228 enabled: true,
229 srcs: [
230 "client/usb_windows.cpp",
231 "sysdeps_win32.cpp",
232 "sysdeps/win32/errno.cpp",
233 "sysdeps/win32/stat.cpp",
234 ],
235 shared_libs: ["AdbWinApi"],
236 },
237 },
238
239 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800240 "libadb_crypto",
241 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800242 "libadb_pairing_connection",
243 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800244 "libbase",
245 "libcrypto_utils",
246 "libcrypto",
247 "libdiagnose_usb",
248 "libmdnssd",
249 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100250 "libutils",
251 "liblog",
252 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800253 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800254 ],
255}
256
257cc_test_host {
258 name: "adb_test",
259 defaults: ["adb_defaults"],
260 srcs: libadb_test_srcs,
261 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800262 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800263 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800264 "libadb_pairing_auth_static",
265 "libadb_pairing_connection_static",
266 "libadb_protos_static",
267 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800268 "libbase",
269 "libcutils",
270 "libcrypto_utils",
271 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800272 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800273 "libmdnssd",
274 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800275 "libprotobuf-cpp-lite",
276 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800277 "libusb",
278 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700279
280 target: {
281 windows: {
282 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700283 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700284 shared_libs: ["AdbWinApi"],
285 },
286 },
Josh Gao27768452018-01-02 12:01:43 -0800287}
288
289cc_binary_host {
290 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800291
Josh Gao99522582020-02-03 23:08:05 -0800292 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800293 defaults: ["adb_defaults"],
294
295 srcs: [
296 "client/adb_client.cpp",
297 "client/bugreport.cpp",
298 "client/commandline.cpp",
299 "client/file_sync_client.cpp",
300 "client/main.cpp",
301 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000302 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800303 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700304 "client/fastdeploy.cpp",
305 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800306 "client/incremental.cpp",
307 "client/incremental_server.cpp",
Songchun Fanc3eb3012020-03-13 13:11:43 -0700308 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800309 "shell_service_protocol.cpp",
310 ],
311
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700312 generated_headers: [
313 "bin2c_fastdeployagent",
314 "bin2c_fastdeployagentscript"
315 ],
316
Josh Gao27768452018-01-02 12:01:43 -0800317 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800318 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800319 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800320 "libadb_pairing_auth",
321 "libadb_pairing_connection",
322 "libadb_protos",
323 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700324 "libandroidfw",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800325 "libapp_processes_protos_full",
Josh Gao27768452018-01-02 12:01:43 -0800326 "libbase",
Josh Gao939fc192020-03-04 19:34:08 -0800327 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800328 "libcutils",
329 "libcrypto_utils",
330 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700331 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800332 "libdiagnose_usb",
333 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800334 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800335 "libmdnssd",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800336 "libprotobuf-cpp-full",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800337 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800338 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100339 "libutils",
340 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700341 "libziparchive",
342 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800343 ],
344
Josh Gao27768452018-01-02 12:01:43 -0800345 // Don't add anything here, we don't want additional shared dependencies
346 // on the host adb tool, and shared libraries that link against libc++
347 // will violate ODR
348 shared_libs: [],
349
Dan Willemsen3f439a72018-11-19 19:11:35 -0800350 // Archive adb, adb.exe.
351 dist: {
352 targets: [
353 "dist_files",
354 "sdk",
355 "win_sdk",
356 ],
357 },
358
Josh Gao27768452018-01-02 12:01:43 -0800359 target: {
360 darwin: {
361 cflags: [
362 "-Wno-sizeof-pointer-memaccess",
363 ],
364 },
365 windows: {
366 enabled: true,
367 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800368 shared_libs: ["AdbWinApi"],
369 required: [
370 "AdbWinUsbApi",
371 ],
372 },
373 },
374}
375
Tao Baoeca59ae2018-07-30 20:45:27 -0700376// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800377cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700378 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800379 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700380 recovery_available: true,
381
382 // libminadbd wants both, as it's used to build native tests.
383 compile_multilib: "both",
384
Josh Gaob43ad442019-07-11 13:47:44 -0700385 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700386 "daemon/auth.cpp",
387 "daemon/jdwp_service.cpp",
Josh Gao52d0b672020-02-26 16:39:20 -0800388 "daemon/logging.cpp",
Josh Gao6d949e82020-02-21 16:38:29 -0800389 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700390 ],
391
Dan Willemsenab971b52018-08-29 14:58:02 -0700392 generated_headers: ["platform_tools_version"],
393
Tao Baoeca59ae2018-07-30 20:45:27 -0700394 static_libs: [
395 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700396 ],
397
398 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700399 "libadbconnection_server",
Joshua Duongef28ca42019-12-19 16:36:30 -0800400 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800401 "libadb_pairing_connection",
402 "libadb_protos",
403 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700404 "libadbd_auth",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700405 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700406 "libasyncio",
407 "libbase",
408 "libcrypto",
409 "libcrypto_utils",
Josh Gao37356142020-03-27 19:41:59 -0700410 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700411 "liblog",
412 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800413
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800414 proto: {
415 type: "lite",
416 static: true,
417 export_proto_headers: true,
418 },
419
Josh Gao776c2ec2019-01-22 19:36:15 -0800420 target: {
421 android: {
422 whole_static_libs: [
423 "libqemu_pipe",
424 ],
425 srcs: [
426 "daemon/transport_qemu.cpp",
427 "daemon/usb.cpp",
428 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800429 ]
Joshua Duong0f53d172020-02-26 15:43:44 -0800430 },
431 recovery: {
432 exclude_shared_libs: [
433 "libadb_pairing_auth",
434 "libadb_pairing_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700435 "libapp_processes_protos_lite",
Joshua Duong0f53d172020-02-26 15:43:44 -0800436 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800437 }
438 },
Josh Gaob5673032020-03-16 12:48:18 -0700439
440 apex_available: [
441 "//apex_available:platform",
442 "com.android.adbd",
443 ],
444 visibility: [
445 "//bootable/recovery/minadbd",
446 "//system/core/adb",
447 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700448}
449
Josh Gao7f8a37c2020-03-09 15:20:55 -0700450cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700451 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800452 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700453 recovery_available: true,
454 compile_multilib: "both",
455
456 srcs: [
457 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700458 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700459 "daemon/shell_service.cpp",
460 "shell_service_protocol.cpp",
461 ],
462
463 cflags: [
464 "-D_GNU_SOURCE",
465 "-Wno-deprecated-declarations",
466 ],
467
468 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800469 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700470 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800471 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700472 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700473 ],
474
475 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800476 "libadb_crypto",
477 "libadb_pairing_connection",
478 "libadb_protos",
479 "libadb_tls_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700480 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700481 "libasyncio",
482 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700483 "libcrypto_utils",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700484 "libcutils_sockets",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700485 "libprotobuf-cpp-lite",
Josh Gao37356142020-03-27 19:41:59 -0700486
487 // APEX dependencies.
488 "libadbd_auth",
489 "libadbd_fs",
490 "libcrypto",
491 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700492 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800493
494 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800495 android: {
496 srcs: [
497 "daemon/abb_service.cpp",
498 "daemon/framebuffer_service.cpp",
499 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800500 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800501 ],
502 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800503 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800504 "libselinux",
505 ],
506 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800507 recovery: {
508 exclude_srcs: [
509 "daemon/abb_service.cpp",
510 ],
Joshua Duong0f53d172020-02-26 15:43:44 -0800511 exclude_shared_libs: [
512 "libadb_pairing_auth",
513 "libadb_pairing_connection",
514 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800515 },
516 },
Josh Gaob5673032020-03-16 12:48:18 -0700517
518 apex_available: [
519 "//apex_available:platform",
520 "com.android.adbd",
521 ],
522 visibility: [
523 "//system/core/adb",
524 ],
525
Tao Baoeca59ae2018-07-30 20:45:27 -0700526}
527
528cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800529 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800530 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900531 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000532 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800533
Josh Gaobb7fc922020-01-22 17:58:03 -0800534 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700535 use_version_lib: false,
536
537 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800538 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700539
Tao Baoeca59ae2018-07-30 20:45:27 -0700540 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700541 "libadbconnection_server",
542 "libapp_processes_protos_lite",
543 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800544 "libadb_crypto",
545 "libadb_pairing_connection",
546 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800547 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800548 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700549 "libcrypto",
550 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700551 "liblog",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800552 "libselinux",
Josh Gao37356142020-03-27 19:41:59 -0700553
554 // APEX dependencies on the system image.
555 "libadbd_auth",
556 "libadbd_fs",
557 "libadbd_services",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800558 ],
559
Joshua Duong0f53d172020-02-26 15:43:44 -0800560 target: {
561 recovery: {
562 exclude_shared_libs: [
563 "libadb_pairing_auth",
564 "libadb_pairing_connection",
565 ],
566 }
567 },
568
Josh Gaoa9b62d52020-02-19 13:50:57 -0800569 static_libs: [
Josh Gao37356142020-03-27 19:41:59 -0700570 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800571 "libbrotli",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800572 "libcutils_sockets",
573 "libdiagnose_usb",
Josh Gao6d949e82020-02-21 16:38:29 -0800574 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800575 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700576
Josh Gao08718242020-03-27 18:09:56 -0700577 visibility: [
578 "//bootable/recovery/minadbd",
579 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700580 ],
Josh Gao27768452018-01-02 12:01:43 -0800581}
582
583cc_binary {
584 name: "adbd",
Josh Gao37356142020-03-27 19:41:59 -0700585 defaults: ["adbd_defaults", "host_adbd_supported", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800586 stl: "libc++_static",
Jiyong Parka0e75042018-05-24 14:11:00 +0900587 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000588 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800589
Josh Gao27768452018-01-02 12:01:43 -0800590 srcs: [
591 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800592 ],
593
594 cflags: [
595 "-D_GNU_SOURCE",
596 "-Wno-deprecated-declarations",
597 ],
598
599 strip: {
600 keep_symbols: true,
601 },
602
Josh Gao594f70f2019-08-15 14:05:12 -0700603 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800604 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700605 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700606 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700607 "libcap",
Josh Gao27768452018-01-02 12:01:43 -0800608 "libminijail",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800609 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800610 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700611
612 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800613 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800614 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700615 ],
Josh Gao99522582020-02-03 23:08:05 -0800616
Joshua Duong0f53d172020-02-26 15:43:44 -0800617 target: {
618 recovery: {
619 exclude_shared_libs: [
620 "libadb_pairing_auth",
621 "libadb_pairing_connection",
622 ],
623 }
624 },
625
Josh Gaoa9b62d52020-02-19 13:50:57 -0800626 required: [
627 "libadbd_auth",
628 "libadbd_fs",
629 ],
Josh Gao27768452018-01-02 12:01:43 -0800630}
631
Josh Gao7b7ee192019-10-23 13:27:17 -0700632phony {
633 name: "adbd_system_binaries",
634 required: [
635 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700636 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700637 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700638 ]
639}
640
641phony {
642 name: "adbd_system_binaries_recovery",
643 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700644 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700645 ],
646}
647
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800648cc_binary {
649 name: "abb",
650
Josh Gao776c2ec2019-01-22 19:36:15 -0800651 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800652 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800653 recovery_available: false,
654
655 srcs: [
656 "daemon/abb.cpp",
657 ],
658
659 cflags: [
660 "-D_GNU_SOURCE",
661 "-Wno-deprecated-declarations",
662 ],
663
664 strip: {
665 keep_symbols: true,
666 },
667
668 static_libs: [
669 "libadbd_core",
670 "libadbd_services",
671 "libcmd",
672 ],
673
674 shared_libs: [
675 "libbase",
676 "libbinder",
677 "liblog",
678 "libutils",
679 "libselinux",
680 ],
681}
682
Josh Gao27768452018-01-02 12:01:43 -0800683cc_test {
684 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800685
Josh Gao37356142020-03-27 19:41:59 -0700686 defaults: ["adbd_defaults", "libadbd_binary_dependencies"],
Josh Gao99522582020-02-03 23:08:05 -0800687
688 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800689 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700690 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800691 "daemon/shell_service.cpp",
692 "daemon/shell_service_test.cpp",
693 "shell_service_protocol.cpp",
694 "shell_service_protocol_test.cpp",
695 ],
696
Josh Gao37356142020-03-27 19:41:59 -0700697 shared_libs: [
698 "liblog",
699 ],
700
Josh Gao27768452018-01-02 12:01:43 -0800701 static_libs: [
702 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700703 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800704 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800705 "libcrypto_utils",
Josh Gao27768452018-01-02 12:01:43 -0800706 "libusb",
Josh Gao27768452018-01-02 12:01:43 -0800707 ],
Josh Gao7e015872020-01-30 14:49:01 -0800708 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700709 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800710}
711
Julien Desprez75fea7e2018-08-08 12:08:50 -0700712python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800713 name: "adb_integration_test_adb",
714 main: "test_adb.py",
715 srcs: [
716 "test_adb.py",
717 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700718 test_config: "adb_integration_test_adb.xml",
719 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800720 version: {
721 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700722 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800723 },
724 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700725 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800726 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700727 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700728}
729
Julien Desprez618f0e12018-10-12 13:48:14 -0700730python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800731 name: "adb_integration_test_device",
732 main: "test_device.py",
733 srcs: [
734 "test_device.py",
735 ],
736 libs: [
737 "adb_py",
738 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700739 test_config: "adb_integration_test_device.xml",
740 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800741 version: {
742 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800743 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800744 },
745 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800746 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800747 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700748 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700749}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700750
751// Note: using pipe for xxd to control the variable name generated
752// the default name used by xxd is the path to the input file.
753java_genrule {
754 name: "bin2c_fastdeployagent",
755 out: ["deployagent.inc"],
756 srcs: [":deployagent"],
757 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
758}
759
760genrule {
761 name: "bin2c_fastdeployagentscript",
762 out: ["deployagentscript.inc"],
763 srcs: ["fastdeploy/deployagent/deployagent.sh"],
764 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
765}
766
767cc_library_host_static {
768 name: "libfastdeploy_host",
769 defaults: ["adb_defaults"],
770 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700771 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700772 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
773 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
774 "fastdeploy/proto/ApkEntry.proto",
775 ],
776 static_libs: [
777 "libadb_host",
778 "libandroidfw",
779 "libbase",
780 "libcutils",
781 "libcrypto_utils",
782 "libcrypto",
783 "libdiagnose_usb",
784 "liblog",
785 "libmdnssd",
786 "libusb",
787 "libutils",
788 "libziparchive",
789 "libz",
790 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700791 proto: {
792 type: "lite",
793 export_proto_headers: true,
794 },
795 target: {
796 windows: {
797 enabled: true,
798 shared_libs: ["AdbWinApi"],
799 },
800 },
801}
802
803cc_test_host {
804 name: "fastdeploy_test",
805 defaults: ["adb_defaults"],
806 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700807 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700808 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
809 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
810 ],
811 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800812 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700813 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800814 "libadb_pairing_auth_static",
815 "libadb_pairing_connection_static",
816 "libadb_protos_static",
817 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700818 "libandroidfw",
819 "libbase",
820 "libcutils",
821 "libcrypto_utils",
822 "libcrypto",
823 "libdiagnose_usb",
824 "libfastdeploy_host",
825 "liblog",
826 "libmdnssd",
827 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800828 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700829 "libusb",
830 "libutils",
831 "libziparchive",
832 "libz",
833 ],
834 target: {
835 windows: {
836 enabled: true,
837 shared_libs: ["AdbWinApi"],
838 },
839 },
840 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700841 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700842 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700843 "fastdeploy/testdata/sample.apk",
844 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700845 ],
846}