blob: 1004483ac95a51ea7c25933a62d9f4ff82354fe0 [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 Gaobb7fc922020-01-22 17:58:03 -0800117// libadbconnection
118// =========================================================
119// libadbconnection_client/server implement the socket handling for jdwp
120// forwarding and the track-jdwp service.
121cc_library {
122 name: "libadbconnection_server",
123 srcs: ["adbconnection/adbconnection_server.cpp"],
124
125 export_include_dirs: ["adbconnection/include"],
126
127 stl: "libc++_static",
128 shared_libs: ["liblog"],
129 static_libs: ["libbase"],
130
131 defaults: ["adbd_defaults", "host_adbd_supported"],
132
133 // Avoid getting duplicate symbol of android::build::getbuildnumber().
134 use_version_lib: false,
135
136 recovery_available: true,
137 compile_multilib: "both",
138}
139
140cc_library {
141 name: "libadbconnection_client",
142 srcs: ["adbconnection/adbconnection_client.cpp"],
143
144 export_include_dirs: ["adbconnection/include"],
145
146 stl: "libc++_static",
147 shared_libs: ["liblog"],
148 static_libs: ["libbase"],
149
150 defaults: ["adbd_defaults"],
151 visibility: [
152 "//art:__subpackages__",
153 "//system/core/adb/apex:__subpackages__",
154 ],
155 apex_available: [
156 "com.android.adbd",
157 "test_com.android.adbd",
158 ],
159
160 // libadbconnection_client doesn't need an embedded build number.
161 use_version_lib: false,
162
Dan Willemsena536b422020-02-03 10:02:41 -0800163 target: {
164 linux: {
165 version_script: "adbconnection/libadbconnection_client.map.txt",
166 },
167 },
Josh Gaobb7fc922020-01-22 17:58:03 -0800168 stubs: {
169 symbol_file: "adbconnection/libadbconnection_client.map.txt",
170 versions: ["1"],
171 },
172
173 host_supported: true,
174 compile_multilib: "both",
175}
176
Josh Gao27768452018-01-02 12:01:43 -0800177// libadb
178// =========================================================
179// These files are compiled for both the host and the device.
180libadb_srcs = [
181 "adb.cpp",
182 "adb_io.cpp",
183 "adb_listeners.cpp",
184 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700185 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800186 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700187 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700188 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800189 "services.cpp",
190 "sockets.cpp",
191 "socket_spec.cpp",
192 "sysdeps/errno.cpp",
193 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700194 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800195 "transport_local.cpp",
196 "transport_usb.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700197 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800198]
199
200libadb_posix_srcs = [
201 "sysdeps_unix.cpp",
202 "sysdeps/posix/network.cpp",
203]
204
Josh Gaob43ad442019-07-11 13:47:44 -0700205libadb_linux_srcs = [
206 "fdevent/fdevent_epoll.cpp",
207]
208
Josh Gao27768452018-01-02 12:01:43 -0800209libadb_test_srcs = [
210 "adb_io_test.cpp",
211 "adb_listeners_test.cpp",
212 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700213 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800214 "socket_spec_test.cpp",
215 "socket_test.cpp",
216 "sysdeps_test.cpp",
217 "sysdeps/stat_test.cpp",
218 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700219 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800220]
221
222cc_library_host_static {
223 name: "libadb_host",
224 defaults: ["adb_defaults"],
225
226 srcs: libadb_srcs + [
227 "client/auth.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800228 "client/adb_wifi.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800229 "client/usb_libusb.cpp",
230 "client/usb_dispatch.cpp",
231 "client/transport_mdns.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800232 "client/pairing/pairing_client.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800233 ],
234
Dan Willemsenab971b52018-08-29 14:58:02 -0700235 generated_headers: ["platform_tools_version"],
236
Josh Gao27768452018-01-02 12:01:43 -0800237 target: {
238 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700239 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800240 },
241 darwin: {
242 srcs: ["client/usb_osx.cpp"],
243 },
Josh Gao27768452018-01-02 12:01:43 -0800244 not_windows: {
245 srcs: libadb_posix_srcs,
246 },
247 windows: {
248 enabled: true,
249 srcs: [
250 "client/usb_windows.cpp",
251 "sysdeps_win32.cpp",
252 "sysdeps/win32/errno.cpp",
253 "sysdeps/win32/stat.cpp",
254 ],
255 shared_libs: ["AdbWinApi"],
256 },
257 },
258
259 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800260 "libadb_crypto",
261 "libadb_protos",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800262 "libadb_pairing_connection",
263 "libadb_tls_connection",
Josh Gao27768452018-01-02 12:01:43 -0800264 "libbase",
265 "libcrypto_utils",
266 "libcrypto",
267 "libdiagnose_usb",
268 "libmdnssd",
269 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100270 "libutils",
271 "liblog",
272 "libcutils",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800273 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800274 ],
275}
276
277cc_test_host {
278 name: "adb_test",
279 defaults: ["adb_defaults"],
280 srcs: libadb_test_srcs,
281 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800282 "libadb_crypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800283 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800284 "libadb_pairing_auth_static",
285 "libadb_pairing_connection_static",
286 "libadb_protos_static",
287 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800288 "libbase",
289 "libcutils",
290 "libcrypto_utils",
291 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800292 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800293 "libmdnssd",
294 "libdiagnose_usb",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800295 "libprotobuf-cpp-lite",
296 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800297 "libusb",
298 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700299
300 target: {
301 windows: {
302 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700303 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700304 shared_libs: ["AdbWinApi"],
305 },
306 },
Josh Gao27768452018-01-02 12:01:43 -0800307}
308
Josh Gao9c596492018-04-04 11:27:24 -0700309cc_benchmark {
310 name: "adb_benchmark",
311 defaults: ["adb_defaults"],
312
313 srcs: ["transport_benchmark.cpp"],
314 target: {
315 android: {
316 static_libs: [
317 "libadbd",
318 ],
319 },
320 host: {
321 static_libs: [
322 "libadb_host",
323 ],
324 },
325 },
326
327 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800328 "libadb_crypto_static",
329 "libadb_tls_connection_static",
330 "libadbd_auth",
Josh Gao9c596492018-04-04 11:27:24 -0700331 "libbase",
332 "libcutils",
333 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700334 "libcrypto_static",
Josh Gao9c596492018-04-04 11:27:24 -0700335 "libdiagnose_usb",
336 "liblog",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800337 "libssl",
Josh Gao9c596492018-04-04 11:27:24 -0700338 "libusb",
339 ],
340}
341
Josh Gao27768452018-01-02 12:01:43 -0800342cc_binary_host {
343 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800344
Josh Gao99522582020-02-03 23:08:05 -0800345 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -0800346 defaults: ["adb_defaults"],
347
348 srcs: [
349 "client/adb_client.cpp",
350 "client/bugreport.cpp",
351 "client/commandline.cpp",
352 "client/file_sync_client.cpp",
353 "client/main.cpp",
354 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000355 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800356 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700357 "client/fastdeploy.cpp",
358 "client/fastdeploycallbacks.cpp",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800359 "client/incremental.cpp",
360 "client/incremental_server.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800361 "shell_service_protocol.cpp",
362 ],
363
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700364 generated_headers: [
365 "bin2c_fastdeployagent",
366 "bin2c_fastdeployagentscript"
367 ],
368
Josh Gao27768452018-01-02 12:01:43 -0800369 static_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800370 "libadb_crypto",
Josh Gao27768452018-01-02 12:01:43 -0800371 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800372 "libadb_pairing_auth",
373 "libadb_pairing_connection",
374 "libadb_protos",
375 "libadb_tls_connection",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700376 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800377 "libbase",
378 "libcutils",
379 "libcrypto_utils",
380 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700381 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800382 "libdiagnose_usb",
383 "liblog",
Alex Buynytskyy96ff54b2020-02-13 06:52:04 -0800384 "liblz4",
Josh Gao27768452018-01-02 12:01:43 -0800385 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700386 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800387 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800388 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100389 "libutils",
390 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700391 "libziparchive",
392 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800393 ],
394
Josh Gao27768452018-01-02 12:01:43 -0800395 // Don't add anything here, we don't want additional shared dependencies
396 // on the host adb tool, and shared libraries that link against libc++
397 // will violate ODR
398 shared_libs: [],
399
Dan Willemsen3f439a72018-11-19 19:11:35 -0800400 // Archive adb, adb.exe.
401 dist: {
402 targets: [
403 "dist_files",
404 "sdk",
405 "win_sdk",
406 ],
407 },
408
Josh Gao27768452018-01-02 12:01:43 -0800409 target: {
410 darwin: {
411 cflags: [
412 "-Wno-sizeof-pointer-memaccess",
413 ],
414 },
415 windows: {
416 enabled: true,
417 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800418 shared_libs: ["AdbWinApi"],
419 required: [
420 "AdbWinUsbApi",
421 ],
422 },
423 },
424}
425
Tao Baoeca59ae2018-07-30 20:45:27 -0700426// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800427cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700428 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800429 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700430 recovery_available: true,
431
432 // libminadbd wants both, as it's used to build native tests.
433 compile_multilib: "both",
434
Josh Gaob43ad442019-07-11 13:47:44 -0700435 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700436 "daemon/auth.cpp",
437 "daemon/jdwp_service.cpp",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800438 "daemon/adb_wifi.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700439 ],
440
441 local_include_dirs: [
442 "daemon/include",
443 ],
444
Dan Willemsenab971b52018-08-29 14:58:02 -0700445 generated_headers: ["platform_tools_version"],
446
Tao Baoeca59ae2018-07-30 20:45:27 -0700447 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800448 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700449 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700450 ],
451
452 shared_libs: [
Joshua Duongef28ca42019-12-19 16:36:30 -0800453 "libadb_crypto",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800454 "libadb_pairing_connection",
455 "libadb_protos",
456 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700457 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700458 "libasyncio",
459 "libbase",
460 "libcrypto",
461 "libcrypto_utils",
462 "libcutils",
463 "liblog",
464 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800465
466 target: {
467 android: {
468 whole_static_libs: [
469 "libqemu_pipe",
470 ],
471 srcs: [
472 "daemon/transport_qemu.cpp",
473 "daemon/usb.cpp",
474 "daemon/usb_ffs.cpp",
475 "daemon/usb_legacy.cpp",
476 ]
477 },
478 linux_glibc: {
479 srcs: [
480 "daemon/usb_dummy.cpp",
481 ]
482 }
483 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700484}
485
486cc_library {
487 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800488 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700489 recovery_available: true,
490 compile_multilib: "both",
491
492 srcs: [
493 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700494 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700495 "daemon/shell_service.cpp",
496 "shell_service_protocol.cpp",
497 ],
498
499 cflags: [
500 "-D_GNU_SOURCE",
501 "-Wno-deprecated-declarations",
502 ],
503
504 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800505 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700506 "libadbd_core",
Tao Baoeca59ae2018-07-30 20:45:27 -0700507 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700508 ],
509
510 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800511 "libadb_crypto",
512 "libadb_pairing_connection",
513 "libadb_protos",
514 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700515 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700516 "libasyncio",
517 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700518 "libcrypto",
519 "libcrypto_utils",
520 "libcutils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700521 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700522 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800523
524 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800525 android: {
526 srcs: [
527 "daemon/abb_service.cpp",
528 "daemon/framebuffer_service.cpp",
529 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800530 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800531 ],
532 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800533 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800534 "libselinux",
535 ],
536 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800537 recovery: {
538 exclude_srcs: [
539 "daemon/abb_service.cpp",
540 ],
541 },
542 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700543}
544
545cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800546 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800547 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900548 recovery_available: true,
Josh Gao27768452018-01-02 12:01:43 -0800549
Josh Gaobb7fc922020-01-22 17:58:03 -0800550 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700551 use_version_lib: false,
552
553 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800554 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700555
556 // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
557 whole_static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800558 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700559 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800560 ],
561
Tao Baoeca59ae2018-07-30 20:45:27 -0700562 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800563 "libadb_crypto",
564 "libadb_pairing_connection",
565 "libadb_tls_connection",
Josh Gao27523262019-10-22 12:30:39 -0700566 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700567 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800568 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800569 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700570 "libcrypto",
571 "libcrypto_utils",
572 "libcutils",
573 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800574 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700575
576 export_include_dirs: [
577 "daemon/include",
578 ],
Josh Gao27768452018-01-02 12:01:43 -0800579}
580
581cc_binary {
582 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800583 defaults: ["adbd_defaults", "host_adbd_supported"],
Josh Gao99522582020-02-03 23:08:05 -0800584 stl: "libc++_static",
Jiyong Parka0e75042018-05-24 14:11:00 +0900585 recovery_available: true,
Josh Gao8db99f82018-03-06 12:57:27 -0800586
Josh Gao27768452018-01-02 12:01:43 -0800587 srcs: [
588 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800589 ],
590
591 cflags: [
592 "-D_GNU_SOURCE",
593 "-Wno-deprecated-declarations",
594 ],
595
596 strip: {
597 keep_symbols: true,
598 },
599
Josh Gao594f70f2019-08-15 14:05:12 -0700600 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800601 "libadbconnection_server",
Josh Gao27768452018-01-02 12:01:43 -0800602 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700603 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700604 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700605 "libbase",
606 "libcap",
Josh Gao594f70f2019-08-15 14:05:12 -0700607 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700608 "libcutils",
Josh Gao594f70f2019-08-15 14:05:12 -0700609 "libdiagnose_usb",
Josh Gao27768452018-01-02 12:01:43 -0800610 "liblog",
Josh Gao594f70f2019-08-15 14:05:12 -0700611 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800612 "libminijail",
613 "libselinux",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800614 "libssl",
Josh Gao27768452018-01-02 12:01:43 -0800615 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700616
617 shared_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800618 "libadb_crypto",
619 "libadb_pairing_connection",
620 "libadb_protos",
621 "libadb_tls_connection",
Josh Gao7f729452020-01-16 12:40:43 -0800622 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700623 "libcrypto",
624 ],
Josh Gao99522582020-02-03 23:08:05 -0800625
626 required: ["libadbd_auth"],
Josh Gao27768452018-01-02 12:01:43 -0800627}
628
Josh Gao7b7ee192019-10-23 13:27:17 -0700629phony {
630 name: "adbd_system_binaries",
631 required: [
632 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700633 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700634 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700635 ]
636}
637
638phony {
639 name: "adbd_system_binaries_recovery",
640 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700641 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700642 ],
643}
644
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800645cc_binary {
646 name: "abb",
647
Josh Gao776c2ec2019-01-22 19:36:15 -0800648 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800649 stl: "libc++",
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800650 recovery_available: false,
651
652 srcs: [
653 "daemon/abb.cpp",
654 ],
655
656 cflags: [
657 "-D_GNU_SOURCE",
658 "-Wno-deprecated-declarations",
659 ],
660
661 strip: {
662 keep_symbols: true,
663 },
664
665 static_libs: [
666 "libadbd_core",
667 "libadbd_services",
668 "libcmd",
669 ],
670
671 shared_libs: [
672 "libbase",
673 "libbinder",
674 "liblog",
675 "libutils",
676 "libselinux",
677 ],
678}
679
Josh Gao27768452018-01-02 12:01:43 -0800680cc_test {
681 name: "adbd_test",
Josh Gao99522582020-02-03 23:08:05 -0800682
Josh Gao776c2ec2019-01-22 19:36:15 -0800683 defaults: ["adbd_defaults"],
Josh Gao99522582020-02-03 23:08:05 -0800684 stl: "libc++_static",
685
686 recovery_available: false,
Josh Gao27768452018-01-02 12:01:43 -0800687 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700688 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800689 "daemon/shell_service.cpp",
690 "daemon/shell_service_test.cpp",
691 "shell_service_protocol.cpp",
692 "shell_service_protocol_test.cpp",
693 ],
694
695 static_libs: [
696 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700697 "libadbd_auth",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800698 "libadb_crypto_static",
699 "libadb_pairing_connection_static",
700 "libadb_tls_connection_static",
Josh Gao27768452018-01-02 12:01:43 -0800701 "libbase",
702 "libcutils",
703 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700704 "libcrypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800705 "libdiagnose_usb",
706 "liblog",
707 "libusb",
708 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900709 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800710 ],
Josh Gao7e015872020-01-30 14:49:01 -0800711 test_suites: ["device-tests", "mts"],
Dan Shid1360f42019-09-24 09:04:05 -0700712 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800713}
714
Julien Desprez75fea7e2018-08-08 12:08:50 -0700715python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800716 name: "adb_integration_test_adb",
717 main: "test_adb.py",
718 srcs: [
719 "test_adb.py",
720 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700721 test_config: "adb_integration_test_adb.xml",
722 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800723 version: {
724 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700725 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800726 },
727 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700728 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800729 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700730 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700731}
732
Julien Desprez618f0e12018-10-12 13:48:14 -0700733python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800734 name: "adb_integration_test_device",
735 main: "test_device.py",
736 srcs: [
737 "test_device.py",
738 ],
739 libs: [
740 "adb_py",
741 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700742 test_config: "adb_integration_test_device.xml",
743 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800744 version: {
745 py2: {
Josh Gao93dee962020-02-06 17:52:38 -0800746 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800747 },
748 py3: {
Josh Gao93dee962020-02-06 17:52:38 -0800749 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800750 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700751 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700752}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700753
754// Note: using pipe for xxd to control the variable name generated
755// the default name used by xxd is the path to the input file.
756java_genrule {
757 name: "bin2c_fastdeployagent",
758 out: ["deployagent.inc"],
759 srcs: [":deployagent"],
760 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
761}
762
763genrule {
764 name: "bin2c_fastdeployagentscript",
765 out: ["deployagentscript.inc"],
766 srcs: ["fastdeploy/deployagent/deployagent.sh"],
767 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
768}
769
770cc_library_host_static {
771 name: "libfastdeploy_host",
772 defaults: ["adb_defaults"],
773 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700774 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700775 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
776 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
777 "fastdeploy/proto/ApkEntry.proto",
778 ],
779 static_libs: [
780 "libadb_host",
781 "libandroidfw",
782 "libbase",
783 "libcutils",
784 "libcrypto_utils",
785 "libcrypto",
786 "libdiagnose_usb",
787 "liblog",
788 "libmdnssd",
789 "libusb",
790 "libutils",
791 "libziparchive",
792 "libz",
793 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700794 proto: {
795 type: "lite",
796 export_proto_headers: true,
797 },
798 target: {
799 windows: {
800 enabled: true,
801 shared_libs: ["AdbWinApi"],
802 },
803 },
804}
805
806cc_test_host {
807 name: "fastdeploy_test",
808 defaults: ["adb_defaults"],
809 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700810 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700811 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
812 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
813 ],
814 static_libs: [
Joshua Duongd85f5c02019-11-20 14:18:43 -0800815 "libadb_crypto_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700816 "libadb_host",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800817 "libadb_pairing_auth_static",
818 "libadb_pairing_connection_static",
819 "libadb_protos_static",
820 "libadb_tls_connection_static",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700821 "libandroidfw",
822 "libbase",
823 "libcutils",
824 "libcrypto_utils",
825 "libcrypto",
826 "libdiagnose_usb",
827 "libfastdeploy_host",
828 "liblog",
829 "libmdnssd",
830 "libprotobuf-cpp-lite",
Joshua Duongd85f5c02019-11-20 14:18:43 -0800831 "libssl",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700832 "libusb",
833 "libutils",
834 "libziparchive",
835 "libz",
836 ],
837 target: {
838 windows: {
839 enabled: true,
840 shared_libs: ["AdbWinApi"],
841 },
842 },
843 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700844 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700845 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700846 "fastdeploy/testdata/sample.apk",
847 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700848 ],
849}