blob: bff187cc3b14629790fe6adcc2321cd0ef134a9b [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 Gao27768452018-01-02 12:01:43 -0800117// libadb
118// =========================================================
119// These files are compiled for both the host and the device.
120libadb_srcs = [
121 "adb.cpp",
122 "adb_io.cpp",
123 "adb_listeners.cpp",
124 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700125 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800126 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700127 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700128 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800129 "services.cpp",
130 "sockets.cpp",
131 "socket_spec.cpp",
132 "sysdeps/errno.cpp",
133 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700134 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800135 "transport_local.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700136 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800137]
138
139libadb_posix_srcs = [
140 "sysdeps_unix.cpp",
141 "sysdeps/posix/network.cpp",
142]
143
Josh Gaob43ad442019-07-11 13:47:44 -0700144libadb_linux_srcs = [
145 "fdevent/fdevent_epoll.cpp",
146]
147
Josh Gao27768452018-01-02 12:01:43 -0800148libadb_test_srcs = [
149 "adb_io_test.cpp",
150 "adb_listeners_test.cpp",
151 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700152 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800153 "socket_spec_test.cpp",
154 "socket_test.cpp",
155 "sysdeps_test.cpp",
156 "sysdeps/stat_test.cpp",
157 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700158 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800159]
160
161cc_library_host_static {
162 name: "libadb_host",
163 defaults: ["adb_defaults"],
164
165 srcs: libadb_srcs + [
166 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800167 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800168 "client/usb_libusb.cpp",
169 "client/usb_dispatch.cpp",
170 "client/transport_mdns.cpp",
Josh Gao08718242020-03-27 18:09:56 -0700171 "client/transport_usb.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800172 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800173 ],
174
Dan Willemsenab971b52018-08-29 14:58:02 -0700175 generated_headers: ["platform_tools_version"],
176
Josh Gao27768452018-01-02 12:01:43 -0800177 target: {
178 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700179 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800180 },
181 darwin: {
182 srcs: ["client/usb_osx.cpp"],
183 },
Josh Gao27768452018-01-02 12:01:43 -0800184 not_windows: {
185 srcs: libadb_posix_srcs,
186 },
187 windows: {
188 enabled: true,
189 srcs: [
190 "client/usb_windows.cpp",
191 "sysdeps_win32.cpp",
192 "sysdeps/win32/errno.cpp",
193 "sysdeps/win32/stat.cpp",
194 ],
195 shared_libs: ["AdbWinApi"],
196 },
197 },
198
199 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800200 "libadb_crypto",
201 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800202 "libadb_pairing_connection",
203 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800204 "libbase",
205 "libcrypto_utils",
206 "libcrypto",
207 "libdiagnose_usb",
208 "libmdnssd",
209 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100210 "libutils",
211 "liblog",
212 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800213 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800214 ],
215}
216
217cc_test_host {
218 name: "adb_test",
219 defaults: ["adb_defaults"],
220 srcs: libadb_test_srcs,
221 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800222 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800223 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800224 "libadb_pairing_auth_static",
225 "libadb_pairing_connection_static",
226 "libadb_protos_static",
227 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800228 "libbase",
229 "libcutils",
230 "libcrypto_utils",
231 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800232 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800233 "libmdnssd",
234 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800235 "libprotobuf-cpp-lite",
236 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800237 "libusb",
238 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700239
240 target: {
241 windows: {
242 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700243 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700244 shared_libs: ["AdbWinApi"],
245 },
246 },
Josh Gao27768452018-01-02 12:01:43 -0800247}
248
249cc_binary_host {
250 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800251
Josh Gao99522582020-02-03 23:08:05 -0800252 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800253 defaults: ["adb_defaults"],
254
255 srcs: [
256 "client/adb_client.cpp",
257 "client/bugreport.cpp",
258 "client/commandline.cpp",
259 "client/file_sync_client.cpp",
260 "client/main.cpp",
261 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000262 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800263 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700264 "client/fastdeploy.cpp",
265 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800266 "client/incremental.cpp",
267 "client/incremental_server.cpp",
Songchun Fanc3eb3012020-03-13 13:11:43 -0700268 "client/incremental_utils.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800269 "shell_service_protocol.cpp",
270 ],
271
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700272 generated_headers: [
273 "bin2c_fastdeployagent",
274 "bin2c_fastdeployagentscript"
275 ],
276
Josh Gao27768452018-01-02 12:01:43 -0800277 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800278 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800279 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800280 "libadb_pairing_auth",
281 "libadb_pairing_connection",
282 "libadb_protos",
283 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700284 "libandroidfw",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800285 "libapp_processes_protos_full",
Josh Gao27768452018-01-02 12:01:43 -0800286 "libbase",
Josh Gao939fc192020-03-04 19:34:08 -0800287 "libbrotli",
Josh Gao27768452018-01-02 12:01:43 -0800288 "libcutils",
289 "libcrypto_utils",
290 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700291 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800292 "libdiagnose_usb",
293 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800294 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800295 "libmdnssd",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800296 "libprotobuf-cpp-full",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800297 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800298 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100299 "libutils",
300 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700301 "libziparchive",
302 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800303 ],
304
Josh Gao27768452018-01-02 12:01:43 -0800305 // Don't add anything here, we don't want additional shared dependencies
306 // on the host adb tool, and shared libraries that link against libc++
307 // will violate ODR
308 shared_libs: [],
309
Dan Willemsen3f439a72018-11-19 19:11:35 -0800310 // Archive adb, adb.exe.
311 dist: {
312 targets: [
313 "dist_files",
314 "sdk",
315 "win_sdk",
316 ],
317 },
318
Josh Gao27768452018-01-02 12:01:43 -0800319 target: {
320 darwin: {
321 cflags: [
322 "-Wno-sizeof-pointer-memaccess",
323 ],
324 },
325 windows: {
326 enabled: true,
327 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800328 shared_libs: ["AdbWinApi"],
329 required: [
330 "AdbWinUsbApi",
331 ],
332 },
333 },
334}
335
Tao Baoeca59ae2018-07-30 20:45:27 -0700336// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800337cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700338 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800339 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700340 recovery_available: true,
341
342 // libminadbd wants both, as it's used to build native tests.
343 compile_multilib: "both",
344
Josh Gaob43ad442019-07-11 13:47:44 -0700345 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700346 "daemon/auth.cpp",
347 "daemon/jdwp_service.cpp",
Josh Gao52d0b672020-02-26 16:39:20 -0800348 "daemon/logging.cpp",
Josh Gao6d949e82020-02-21 16:38:29 -0800349 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700350 ],
351
Dan Willemsenab971b52018-08-29 14:58:02 -0700352 generated_headers: ["platform_tools_version"],
353
Tao Baoeca59ae2018-07-30 20:45:27 -0700354 static_libs: [
355 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700356 ],
357
358 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700359 "libadbconnection_server",
Joshua Duongef28ca42019-12-19 16:36:30 -0800360 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800361 "libadb_pairing_connection",
362 "libadb_protos",
363 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700364 "libadbd_auth",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700365 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700366 "libasyncio",
367 "libbase",
368 "libcrypto",
369 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700370 "liblog",
371 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800372
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800373 proto: {
374 type: "lite",
375 static: true,
376 export_proto_headers: true,
377 },
378
Josh Gao776c2ec2019-01-22 19:36:15 -0800379 target: {
380 android: {
381 whole_static_libs: [
382 "libqemu_pipe",
383 ],
384 srcs: [
385 "daemon/transport_qemu.cpp",
386 "daemon/usb.cpp",
387 "daemon/usb_ffs.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800388 ]
Joshua Duong0f53d172020-02-26 15:43:44 -0800389 },
390 recovery: {
391 exclude_shared_libs: [
392 "libadb_pairing_auth",
393 "libadb_pairing_connection",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700394 "libapp_processes_protos_lite",
Joshua Duong0f53d172020-02-26 15:43:44 -0800395 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800396 }
397 },
Josh Gaob5673032020-03-16 12:48:18 -0700398
399 apex_available: [
400 "//apex_available:platform",
401 "com.android.adbd",
402 ],
403 visibility: [
404 "//bootable/recovery/minadbd",
405 "//system/core/adb",
406 ],
Tao Baoeca59ae2018-07-30 20:45:27 -0700407}
408
Josh Gao7f8a37c2020-03-09 15:20:55 -0700409cc_library {
Tao Baoeca59ae2018-07-30 20:45:27 -0700410 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800411 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700412 recovery_available: true,
413 compile_multilib: "both",
414
415 srcs: [
416 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700417 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700418 "daemon/shell_service.cpp",
419 "shell_service_protocol.cpp",
420 ],
421
422 cflags: [
423 "-D_GNU_SOURCE",
424 "-Wno-deprecated-declarations",
425 ],
426
427 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800428 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700429 "libadbd_core",
Josh Gao939fc192020-03-04 19:34:08 -0800430 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700431 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700432 ],
433
434 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800435 "libadb_crypto",
436 "libadb_pairing_connection",
437 "libadb_protos",
438 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700439 "libadbd_auth",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800440 "libadbd_fs",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700441 "libapp_processes_protos_lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700442 "libasyncio",
443 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700444 "libcrypto",
445 "libcrypto_utils",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700446 "libcutils_sockets",
Tao Baoeca59ae2018-07-30 20:45:27 -0700447 "liblog",
Josh Gaoc151a1b2020-03-16 11:30:09 -0700448 "libprotobuf-cpp-lite",
Tao Baoeca59ae2018-07-30 20:45:27 -0700449 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800450
451 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800452 android: {
453 srcs: [
454 "daemon/abb_service.cpp",
455 "daemon/framebuffer_service.cpp",
456 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800457 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800458 ],
459 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800460 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800461 "libselinux",
462 ],
463 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800464 recovery: {
465 exclude_srcs: [
466 "daemon/abb_service.cpp",
467 ],
Joshua Duong0f53d172020-02-26 15:43:44 -0800468 exclude_shared_libs: [
469 "libadb_pairing_auth",
470 "libadb_pairing_connection",
471 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800472 },
473 },
Josh Gaob5673032020-03-16 12:48:18 -0700474
475 apex_available: [
476 "//apex_available:platform",
477 "com.android.adbd",
478 ],
479 visibility: [
480 "//system/core/adb",
481 ],
482
Tao Baoeca59ae2018-07-30 20:45:27 -0700483}
484
485cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800486 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800487 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900488 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000489 apex_available: ["com.android.adbd"],
Josh Gao27768452018-01-02 12:01:43 -0800490
Josh Gaobb7fc922020-01-22 17:58:03 -0800491 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700492 use_version_lib: false,
493
494 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800495 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700496
Tao Baoeca59ae2018-07-30 20:45:27 -0700497 whole_static_libs: [
498 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800499 ],
500
Tao Baoeca59ae2018-07-30 20:45:27 -0700501 shared_libs: [
Josh Gaoc151a1b2020-03-16 11:30:09 -0700502 "libadbconnection_server",
503 "libapp_processes_protos_lite",
504 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800505 "libadb_crypto",
506 "libadb_pairing_connection",
507 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700508 "libadbd_auth",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800509 "libadbd_fs",
Josh Gao7f8a37c2020-03-09 15:20:55 -0700510 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800511 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800512 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700513 "libcrypto",
514 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700515 "liblog",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800516 "libselinux",
517 ],
518
Joshua Duong0f53d172020-02-26 15:43:44 -0800519 target: {
520 recovery: {
521 exclude_shared_libs: [
522 "libadb_pairing_auth",
523 "libadb_pairing_connection",
524 ],
525 }
526 },
527
Josh Gaoa9b62d52020-02-19 13:50:57 -0800528 static_libs: [
Josh Gao939fc192020-03-04 19:34:08 -0800529 "libbrotli",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800530 "libcutils_sockets",
531 "libdiagnose_usb",
Josh Gao6d949e82020-02-21 16:38:29 -0800532 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800533 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700534
Josh Gao08718242020-03-27 18:09:56 -0700535 visibility: [
536 "//bootable/recovery/minadbd",
537 "//system/core/adb",
Jerry Zhangb156c602018-05-07 15:14:47 -0700538 ],
Josh Gao27768452018-01-02 12:01:43 -0800539}
540
541cc_binary {
542 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800543 defaults: ["adbd_defaults", "host_adbd_supported"],
Josh Gao99522582020-02-03 23:08:05 -0800544 stl: "libc++_static",
Jiyong Parka0e75042018-05-24 14:11:00 +0900545 recovery_available: true,
Jiyong Park697134d2020-03-23 14:40:50 +0000546 apex_available: ["com.android.adbd"],
Josh Gao8db99f82018-03-06 12:57:27 -0800547
Josh Gao27768452018-01-02 12:01:43 -0800548 srcs: [
549 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800550 ],
551
552 cflags: [
553 "-D_GNU_SOURCE",
554 "-Wno-deprecated-declarations",
555 ],
556
557 strip: {
558 keep_symbols: true,
559 },
560
Josh Gao594f70f2019-08-15 14:05:12 -0700561 static_libs: [
Joshua Duong0f53d172020-02-26 15:43:44 -0800562 "libadb_crypto",
563 "libadb_tls_connection",
Josh Gaobb7fc922020-01-22 17:58:03 -0800564 "libadbconnection_server",
Josh Gao27768452018-01-02 12:01:43 -0800565 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700566 "libadbd_services",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800567 "libapp_processes_protos_lite",
Josh Gao594f70f2019-08-15 14:05:12 -0700568 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700569 "libbase",
Josh Gao939fc192020-03-04 19:34:08 -0800570 "libbrotli",
Tao Baoeca59ae2018-07-30 20:45:27 -0700571 "libcap",
Josh Gao594f70f2019-08-15 14:05:12 -0700572 "libcrypto_utils",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800573 "libcutils_sockets",
Josh Gao594f70f2019-08-15 14:05:12 -0700574 "libdiagnose_usb",
Josh Gao594f70f2019-08-15 14:05:12 -0700575 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800576 "libminijail",
Shukang Zhouf4ffae12020-02-13 17:01:39 -0800577 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800578 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800579 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700580
581 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800582 "libadb_pairing_connection",
583 "libadb_protos",
Josh Gao7f729452020-01-16 12:40:43 -0800584 "libadbd_auth",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800585 "libadbd_fs",
Josh Gao594f70f2019-08-15 14:05:12 -0700586 "libcrypto",
Jiyong Park95b6f452020-03-09 14:35:57 +0900587 "liblog",
Jiyong Park3ffdad02020-03-11 14:00:33 +0900588 "libselinux",
Josh Gao594f70f2019-08-15 14:05:12 -0700589 ],
Josh Gao99522582020-02-03 23:08:05 -0800590
Joshua Duong0f53d172020-02-26 15:43:44 -0800591 target: {
592 recovery: {
593 exclude_shared_libs: [
594 "libadb_pairing_auth",
595 "libadb_pairing_connection",
596 ],
597 }
598 },
599
Josh Gaoa9b62d52020-02-19 13:50:57 -0800600 required: [
601 "libadbd_auth",
602 "libadbd_fs",
603 ],
Josh Gao27768452018-01-02 12:01:43 -0800604}
605
Josh Gao7b7ee192019-10-23 13:27:17 -0700606phony {
607 name: "adbd_system_binaries",
608 required: [
609 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700610 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700611 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700612 ]
613}
614
615phony {
616 name: "adbd_system_binaries_recovery",
617 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700618 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700619 ],
620}
621
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800622cc_binary {
623 name: "abb",
624
Josh Gao776c2ec2019-01-22 19:36:15 -0800625 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800626 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800627 recovery_available: false,
628
629 srcs: [
630 "daemon/abb.cpp",
631 ],
632
633 cflags: [
634 "-D_GNU_SOURCE",
635 "-Wno-deprecated-declarations",
636 ],
637
638 strip: {
639 keep_symbols: true,
640 },
641
642 static_libs: [
643 "libadbd_core",
644 "libadbd_services",
645 "libcmd",
646 ],
647
648 shared_libs: [
649 "libbase",
650 "libbinder",
651 "liblog",
652 "libutils",
653 "libselinux",
654 ],
655}
656
Josh Gao27768452018-01-02 12:01:43 -0800657cc_test {
658 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800659
Josh Gao776c2ec2019-01-22 19:36:15 -0800660 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800661 stl: "libc++_static",
662
663 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800664 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700665 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800666 "daemon/shell_service.cpp",
667 "daemon/shell_service_test.cpp",
668 "shell_service_protocol.cpp",
669 "shell_service_protocol_test.cpp",
670 ],
671
672 static_libs: [
673 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700674 "libadbd_auth",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800675 "libadb_crypto_static",
676 "libadb_pairing_connection_static",
677 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800678 "libbase",
Josh Gao27768452018-01-02 12:01:43 -0800679 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700680 "libcrypto_static",
Josh Gaoa9b62d52020-02-19 13:50:57 -0800681 "libcutils_sockets",
Josh Gao27768452018-01-02 12:01:43 -0800682 "libdiagnose_usb",
683 "liblog",
684 "libusb",
685 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900686 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800687 ],
Josh Gao7e015872020-01-30 14:49:01 -0800688 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700689 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800690}
691
Julien Desprez75fea7e2018-08-08 12:08:50 -0700692python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800693 name: "adb_integration_test_adb",
694 main: "test_adb.py",
695 srcs: [
696 "test_adb.py",
697 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700698 test_config: "adb_integration_test_adb.xml",
699 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800700 version: {
701 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700702 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800703 },
704 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700705 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800706 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700707 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700708}
709
Julien Desprez618f0e12018-10-12 13:48:14 -0700710python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800711 name: "adb_integration_test_device",
712 main: "test_device.py",
713 srcs: [
714 "test_device.py",
715 ],
716 libs: [
717 "adb_py",
718 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700719 test_config: "adb_integration_test_device.xml",
720 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800721 version: {
722 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800723 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800724 },
725 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800726 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800727 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700728 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700729}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700730
731// Note: using pipe for xxd to control the variable name generated
732// the default name used by xxd is the path to the input file.
733java_genrule {
734 name: "bin2c_fastdeployagent",
735 out: ["deployagent.inc"],
736 srcs: [":deployagent"],
737 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
738}
739
740genrule {
741 name: "bin2c_fastdeployagentscript",
742 out: ["deployagentscript.inc"],
743 srcs: ["fastdeploy/deployagent/deployagent.sh"],
744 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
745}
746
747cc_library_host_static {
748 name: "libfastdeploy_host",
749 defaults: ["adb_defaults"],
750 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700751 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700752 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
753 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
754 "fastdeploy/proto/ApkEntry.proto",
755 ],
756 static_libs: [
757 "libadb_host",
758 "libandroidfw",
759 "libbase",
760 "libcutils",
761 "libcrypto_utils",
762 "libcrypto",
763 "libdiagnose_usb",
764 "liblog",
765 "libmdnssd",
766 "libusb",
767 "libutils",
768 "libziparchive",
769 "libz",
770 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700771 proto: {
772 type: "lite",
773 export_proto_headers: true,
774 },
775 target: {
776 windows: {
777 enabled: true,
778 shared_libs: ["AdbWinApi"],
779 },
780 },
781}
782
783cc_test_host {
784 name: "fastdeploy_test",
785 defaults: ["adb_defaults"],
786 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700787 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700788 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
789 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
790 ],
791 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800792 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700793 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800794 "libadb_pairing_auth_static",
795 "libadb_pairing_connection_static",
796 "libadb_protos_static",
797 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700798 "libandroidfw",
799 "libbase",
800 "libcutils",
801 "libcrypto_utils",
802 "libcrypto",
803 "libdiagnose_usb",
804 "libfastdeploy_host",
805 "liblog",
806 "libmdnssd",
807 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800808 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700809 "libusb",
810 "libutils",
811 "libziparchive",
812 "libz",
813 ],
814 target: {
815 windows: {
816 enabled: true,
817 shared_libs: ["AdbWinApi"],
818 },
819 },
820 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700821 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700822 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700823 "fastdeploy/testdata/sample.apk",
824 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700825 ],
826}