blob: f6a4f39b43226aa2668052936499e1c5a8fd5e21 [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 Gao7f729452020-01-16 12:40:43 -080032 stl: "libc++_static",
Josh Gao27768452018-01-02 12:01:43 -080033
Josh Gaoc7567fa2018-02-27 15:49:23 -080034 use_version_lib: true,
Josh Gao27768452018-01-02 12:01:43 -080035 compile_multilib: "first",
Josh Gao27768452018-01-02 12:01:43 -080036
37 target: {
Josh Gao27768452018-01-02 12:01:43 -080038 darwin: {
39 host_ldlibs: [
40 "-lpthread",
41 "-framework CoreFoundation",
42 "-framework IOKit",
43 "-lobjc",
44 ],
45 },
46
47 windows: {
48 cflags: [
49 // Define windows.h and tchar.h Unicode preprocessor symbols so that
50 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
51 // build if you accidentally pass char*. Fix by calling like:
52 // std::wstring path_wide;
53 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
54 // CreateFileW(path_wide.c_str());
55 "-DUNICODE=1",
56 "-D_UNICODE=1",
57
Elliott Hughes3c59cb82018-12-03 09:02:18 -080058 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao27768452018-01-02 12:01:43 -080059 "-D_GNU_SOURCE",
Josh Gao2e1e7892018-03-23 13:03:28 -070060
61 // MinGW hides some things behind _POSIX_SOURCE.
62 "-D_POSIX_SOURCE",
Josh Gao776c2ec2019-01-22 19:36:15 -080063
Josh Gao4710e532019-04-17 16:57:43 -070064 // libusb uses __stdcall on a variadic function, which gets ignored.
65 "-Wno-ignored-attributes",
66
Josh Gao776c2ec2019-01-22 19:36:15 -080067 // Not supported yet.
68 "-Wno-thread-safety",
Josh Gao27768452018-01-02 12:01:43 -080069 ],
Josh Gaof8a97c12018-03-23 15:37:20 -070070
71 host_ldlibs: [
72 "-lws2_32",
73 "-lgdi32",
74 "-luserenv",
75 ],
Josh Gao27768452018-01-02 12:01:43 -080076 },
Josh Gao776c2ec2019-01-22 19:36:15 -080077 },
78}
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070079
Josh Gao776c2ec2019-01-22 19:36:15 -080080cc_defaults {
81 name: "adbd_defaults",
82 defaults: ["adb_defaults"],
83
84 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
85 product_variables: {
86 debuggable: {
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070087 cflags: [
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080088 "-UALLOW_ADBD_ROOT",
89 "-DALLOW_ADBD_ROOT=1",
Josh Gao776c2ec2019-01-22 19:36:15 -080090 "-DALLOW_ADBD_DISABLE_VERITY",
91 "-DALLOW_ADBD_NO_AUTH",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070092 ],
93 },
Josh Gao27768452018-01-02 12:01:43 -080094 },
95}
96
Josh Gao776c2ec2019-01-22 19:36:15 -080097cc_defaults {
98 name: "host_adbd_supported",
99
100 host_supported: true,
101 target: {
102 linux: {
103 enabled: true,
104 host_ldlibs: [
105 "-lresolv", // b64_pton
106 "-lutil", // forkpty
107 ],
108 },
109 darwin: {
110 enabled: false,
111 },
112 windows: {
113 enabled: false,
114 },
115 },
116}
117
Josh Gaobb7fc922020-01-22 17:58:03 -0800118// libadbconnection
119// =========================================================
120// libadbconnection_client/server implement the socket handling for jdwp
121// forwarding and the track-jdwp service.
122cc_library {
123 name: "libadbconnection_server",
124 srcs: ["adbconnection/adbconnection_server.cpp"],
125
126 export_include_dirs: ["adbconnection/include"],
127
128 stl: "libc++_static",
129 shared_libs: ["liblog"],
130 static_libs: ["libbase"],
131
132 defaults: ["adbd_defaults", "host_adbd_supported"],
133
134 // Avoid getting duplicate symbol of android::build::getbuildnumber().
135 use_version_lib: false,
136
137 recovery_available: true,
138 compile_multilib: "both",
139}
140
141cc_library {
142 name: "libadbconnection_client",
143 srcs: ["adbconnection/adbconnection_client.cpp"],
144
145 export_include_dirs: ["adbconnection/include"],
146
147 stl: "libc++_static",
148 shared_libs: ["liblog"],
149 static_libs: ["libbase"],
150
151 defaults: ["adbd_defaults"],
152 visibility: [
153 "//art:__subpackages__",
154 "//system/core/adb/apex:__subpackages__",
155 ],
156 apex_available: [
157 "com.android.adbd",
158 "test_com.android.adbd",
159 ],
160
161 // libadbconnection_client doesn't need an embedded build number.
162 use_version_lib: false,
163
Dan Willemsena536b422020-02-03 10:02:41 -0800164 target: {
165 linux: {
166 version_script: "adbconnection/libadbconnection_client.map.txt",
167 },
168 },
Josh Gaobb7fc922020-01-22 17:58:03 -0800169 stubs: {
170 symbol_file: "adbconnection/libadbconnection_client.map.txt",
171 versions: ["1"],
172 },
173
174 host_supported: true,
175 compile_multilib: "both",
176}
177
Josh Gao27768452018-01-02 12:01:43 -0800178// libadb
179// =========================================================
180// These files are compiled for both the host and the device.
181libadb_srcs = [
182 "adb.cpp",
183 "adb_io.cpp",
184 "adb_listeners.cpp",
185 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700186 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800187 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700188 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700189 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800190 "services.cpp",
191 "sockets.cpp",
192 "socket_spec.cpp",
193 "sysdeps/errno.cpp",
194 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700195 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800196 "transport_local.cpp",
197 "transport_usb.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700198 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800199]
200
201libadb_posix_srcs = [
202 "sysdeps_unix.cpp",
203 "sysdeps/posix/network.cpp",
204]
205
Josh Gaob43ad442019-07-11 13:47:44 -0700206libadb_linux_srcs = [
207 "fdevent/fdevent_epoll.cpp",
208]
209
Josh Gao27768452018-01-02 12:01:43 -0800210libadb_test_srcs = [
211 "adb_io_test.cpp",
212 "adb_listeners_test.cpp",
213 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700214 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800215 "socket_spec_test.cpp",
216 "socket_test.cpp",
217 "sysdeps_test.cpp",
218 "sysdeps/stat_test.cpp",
219 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700220 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800221]
222
223cc_library_host_static {
224 name: "libadb_host",
225 defaults: ["adb_defaults"],
226
227 srcs: libadb_srcs + [
228 "client/auth.cpp",
229 "client/usb_libusb.cpp",
230 "client/usb_dispatch.cpp",
231 "client/transport_mdns.cpp",
232 ],
233
Dan Willemsenab971b52018-08-29 14:58:02 -0700234 generated_headers: ["platform_tools_version"],
235
Josh Gao27768452018-01-02 12:01:43 -0800236 target: {
237 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700238 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800239 },
240 darwin: {
241 srcs: ["client/usb_osx.cpp"],
242 },
Josh Gao27768452018-01-02 12:01:43 -0800243 not_windows: {
244 srcs: libadb_posix_srcs,
245 },
246 windows: {
247 enabled: true,
248 srcs: [
249 "client/usb_windows.cpp",
250 "sysdeps_win32.cpp",
251 "sysdeps/win32/errno.cpp",
252 "sysdeps/win32/stat.cpp",
253 ],
254 shared_libs: ["AdbWinApi"],
255 },
256 },
257
258 static_libs: [
259 "libbase",
260 "libcrypto_utils",
261 "libcrypto",
262 "libdiagnose_usb",
263 "libmdnssd",
264 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100265 "libutils",
266 "liblog",
267 "libcutils",
Josh Gao27768452018-01-02 12:01:43 -0800268 ],
269}
270
271cc_test_host {
272 name: "adb_test",
273 defaults: ["adb_defaults"],
274 srcs: libadb_test_srcs,
275 static_libs: [
276 "libadb_host",
277 "libbase",
278 "libcutils",
279 "libcrypto_utils",
280 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800281 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800282 "libmdnssd",
283 "libdiagnose_usb",
284 "libusb",
285 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700286
287 target: {
288 windows: {
289 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700290 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700291 shared_libs: ["AdbWinApi"],
292 },
293 },
Josh Gao27768452018-01-02 12:01:43 -0800294}
295
Josh Gao9c596492018-04-04 11:27:24 -0700296cc_benchmark {
297 name: "adb_benchmark",
298 defaults: ["adb_defaults"],
299
300 srcs: ["transport_benchmark.cpp"],
301 target: {
302 android: {
303 static_libs: [
304 "libadbd",
305 ],
306 },
307 host: {
308 static_libs: [
309 "libadb_host",
310 ],
311 },
312 },
313
314 static_libs: [
315 "libbase",
316 "libcutils",
317 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700318 "libcrypto_static",
Josh Gao9c596492018-04-04 11:27:24 -0700319 "libdiagnose_usb",
320 "liblog",
321 "libusb",
322 ],
323}
324
Josh Gao27768452018-01-02 12:01:43 -0800325cc_binary_host {
326 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800327
328 defaults: ["adb_defaults"],
329
330 srcs: [
331 "client/adb_client.cpp",
332 "client/bugreport.cpp",
333 "client/commandline.cpp",
334 "client/file_sync_client.cpp",
335 "client/main.cpp",
336 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000337 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800338 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700339 "client/fastdeploy.cpp",
340 "client/fastdeploycallbacks.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800341 "shell_service_protocol.cpp",
342 ],
343
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700344 generated_headers: [
345 "bin2c_fastdeployagent",
346 "bin2c_fastdeployagentscript"
347 ],
348
Josh Gao27768452018-01-02 12:01:43 -0800349 static_libs: [
350 "libadb_host",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700351 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800352 "libbase",
353 "libcutils",
354 "libcrypto_utils",
355 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700356 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800357 "libdiagnose_usb",
358 "liblog",
359 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700360 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800361 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100362 "libutils",
363 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700364 "libziparchive",
365 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800366 ],
367
Josh Gao27768452018-01-02 12:01:43 -0800368 // Don't add anything here, we don't want additional shared dependencies
369 // on the host adb tool, and shared libraries that link against libc++
370 // will violate ODR
371 shared_libs: [],
372
Dan Willemsen3f439a72018-11-19 19:11:35 -0800373 // Archive adb, adb.exe.
374 dist: {
375 targets: [
376 "dist_files",
377 "sdk",
378 "win_sdk",
379 ],
380 },
381
Josh Gao27768452018-01-02 12:01:43 -0800382 target: {
383 darwin: {
384 cflags: [
385 "-Wno-sizeof-pointer-memaccess",
386 ],
387 },
388 windows: {
389 enabled: true,
390 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800391 shared_libs: ["AdbWinApi"],
392 required: [
393 "AdbWinUsbApi",
394 ],
395 },
396 },
397}
398
Tao Baoeca59ae2018-07-30 20:45:27 -0700399// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800400cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700401 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800402 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700403 recovery_available: true,
404
405 // libminadbd wants both, as it's used to build native tests.
406 compile_multilib: "both",
407
Josh Gaob43ad442019-07-11 13:47:44 -0700408 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700409 "daemon/auth.cpp",
410 "daemon/jdwp_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700411 ],
412
413 local_include_dirs: [
414 "daemon/include",
415 ],
416
Dan Willemsenab971b52018-08-29 14:58:02 -0700417 generated_headers: ["platform_tools_version"],
418
Tao Baoeca59ae2018-07-30 20:45:27 -0700419 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800420 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700421 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700422 ],
423
424 shared_libs: [
Josh Gao27523262019-10-22 12:30:39 -0700425 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700426 "libasyncio",
427 "libbase",
428 "libcrypto",
429 "libcrypto_utils",
430 "libcutils",
431 "liblog",
432 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800433
434 target: {
435 android: {
436 whole_static_libs: [
437 "libqemu_pipe",
438 ],
439 srcs: [
440 "daemon/transport_qemu.cpp",
441 "daemon/usb.cpp",
442 "daemon/usb_ffs.cpp",
443 "daemon/usb_legacy.cpp",
444 ]
445 },
446 linux_glibc: {
447 srcs: [
448 "daemon/usb_dummy.cpp",
449 ]
450 }
451 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700452}
453
454cc_library {
455 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800456 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700457 recovery_available: true,
458 compile_multilib: "both",
459
460 srcs: [
461 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700462 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700463 "daemon/shell_service.cpp",
464 "shell_service_protocol.cpp",
465 ],
466
467 cflags: [
468 "-D_GNU_SOURCE",
469 "-Wno-deprecated-declarations",
470 ],
471
472 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800473 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700474 "libadbd_core",
Tao Baoeca59ae2018-07-30 20:45:27 -0700475 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700476 ],
477
478 shared_libs: [
Josh Gao27523262019-10-22 12:30:39 -0700479 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700480 "libasyncio",
481 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700482 "libcrypto",
483 "libcrypto_utils",
484 "libcutils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700485 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700486 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800487
488 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800489 android: {
490 srcs: [
491 "daemon/abb_service.cpp",
492 "daemon/framebuffer_service.cpp",
493 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800494 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800495 ],
496 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800497 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800498 "libselinux",
499 ],
500 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800501 recovery: {
502 exclude_srcs: [
503 "daemon/abb_service.cpp",
504 ],
505 },
506 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700507}
508
509cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800510 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800511 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900512 recovery_available: true,
Josh Gao27768452018-01-02 12:01:43 -0800513
Josh Gaobb7fc922020-01-22 17:58:03 -0800514 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700515 use_version_lib: false,
516
517 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800518 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700519
520 // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
521 whole_static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800522 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700523 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800524 ],
525
Tao Baoeca59ae2018-07-30 20:45:27 -0700526 shared_libs: [
Josh Gao27523262019-10-22 12:30:39 -0700527 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700528 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800529 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800530 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700531 "libcrypto",
532 "libcrypto_utils",
533 "libcutils",
534 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800535 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700536
537 export_include_dirs: [
538 "daemon/include",
539 ],
Josh Gao27768452018-01-02 12:01:43 -0800540}
541
542cc_binary {
543 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800544 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900545 recovery_available: true,
Josh Gao8db99f82018-03-06 12:57:27 -0800546
Josh Gao27768452018-01-02 12:01:43 -0800547 srcs: [
548 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800549 ],
550
551 cflags: [
552 "-D_GNU_SOURCE",
553 "-Wno-deprecated-declarations",
554 ],
555
556 strip: {
557 keep_symbols: true,
558 },
559
Josh Gao594f70f2019-08-15 14:05:12 -0700560 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800561 "libadbconnection_server",
Josh Gao27768452018-01-02 12:01:43 -0800562 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700563 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700564 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700565 "libbase",
566 "libcap",
Josh Gao594f70f2019-08-15 14:05:12 -0700567 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700568 "libcutils",
Josh Gao594f70f2019-08-15 14:05:12 -0700569 "libdiagnose_usb",
Josh Gao27768452018-01-02 12:01:43 -0800570 "liblog",
Josh Gao594f70f2019-08-15 14:05:12 -0700571 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800572 "libminijail",
573 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800574 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700575
576 shared_libs: [
Josh Gao7f729452020-01-16 12:40:43 -0800577 "libadbd_auth",
Josh Gao594f70f2019-08-15 14:05:12 -0700578 "libcrypto",
579 ],
Josh Gao27768452018-01-02 12:01:43 -0800580}
581
Josh Gao7b7ee192019-10-23 13:27:17 -0700582phony {
583 name: "adbd_system_binaries",
584 required: [
585 "abb",
Josh Gao2c356bb2019-10-22 12:30:36 -0700586 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700587 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700588 ]
589}
590
591phony {
592 name: "adbd_system_binaries_recovery",
593 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700594 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700595 ],
596}
597
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800598cc_binary {
599 name: "abb",
600
Josh Gao776c2ec2019-01-22 19:36:15 -0800601 defaults: ["adbd_defaults"],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800602 recovery_available: false,
603
604 srcs: [
605 "daemon/abb.cpp",
606 ],
607
608 cflags: [
609 "-D_GNU_SOURCE",
610 "-Wno-deprecated-declarations",
611 ],
612
613 strip: {
614 keep_symbols: true,
615 },
616
617 static_libs: [
618 "libadbd_core",
619 "libadbd_services",
620 "libcmd",
621 ],
622
623 shared_libs: [
624 "libbase",
625 "libbinder",
626 "liblog",
627 "libutils",
628 "libselinux",
629 ],
630}
631
Josh Gao27768452018-01-02 12:01:43 -0800632cc_test {
633 name: "adbd_test",
Josh Gao776c2ec2019-01-22 19:36:15 -0800634 defaults: ["adbd_defaults"],
Josh Gao27768452018-01-02 12:01:43 -0800635 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700636 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800637 "daemon/shell_service.cpp",
638 "daemon/shell_service_test.cpp",
639 "shell_service_protocol.cpp",
640 "shell_service_protocol_test.cpp",
641 ],
642
643 static_libs: [
644 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700645 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800646 "libbase",
647 "libcutils",
648 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700649 "libcrypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800650 "libdiagnose_usb",
651 "liblog",
652 "libusb",
653 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900654 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800655 ],
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700656 test_suites: ["device-tests"],
Dan Shid1360f42019-09-24 09:04:05 -0700657 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800658}
659
Julien Desprez75fea7e2018-08-08 12:08:50 -0700660python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800661 name: "adb_integration_test_adb",
662 main: "test_adb.py",
663 srcs: [
664 "test_adb.py",
665 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700666 test_config: "adb_integration_test_adb.xml",
667 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800668 version: {
669 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700670 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800671 },
672 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700673 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800674 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700675 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700676}
677
Julien Desprez618f0e12018-10-12 13:48:14 -0700678python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800679 name: "adb_integration_test_device",
680 main: "test_device.py",
681 srcs: [
682 "test_device.py",
683 ],
684 libs: [
685 "adb_py",
686 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700687 test_config: "adb_integration_test_device.xml",
688 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800689 version: {
690 py2: {
691 enabled: true,
692 },
693 py3: {
694 enabled: false,
695 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700696 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700697}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700698
699// Note: using pipe for xxd to control the variable name generated
700// the default name used by xxd is the path to the input file.
701java_genrule {
702 name: "bin2c_fastdeployagent",
703 out: ["deployagent.inc"],
704 srcs: [":deployagent"],
705 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
706}
707
708genrule {
709 name: "bin2c_fastdeployagentscript",
710 out: ["deployagentscript.inc"],
711 srcs: ["fastdeploy/deployagent/deployagent.sh"],
712 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
713}
714
715cc_library_host_static {
716 name: "libfastdeploy_host",
717 defaults: ["adb_defaults"],
718 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700719 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700720 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
721 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
722 "fastdeploy/proto/ApkEntry.proto",
723 ],
724 static_libs: [
725 "libadb_host",
726 "libandroidfw",
727 "libbase",
728 "libcutils",
729 "libcrypto_utils",
730 "libcrypto",
731 "libdiagnose_usb",
732 "liblog",
733 "libmdnssd",
734 "libusb",
735 "libutils",
736 "libziparchive",
737 "libz",
738 ],
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700739 proto: {
740 type: "lite",
741 export_proto_headers: true,
742 },
743 target: {
744 windows: {
745 enabled: true,
746 shared_libs: ["AdbWinApi"],
747 },
748 },
749}
750
751cc_test_host {
752 name: "fastdeploy_test",
753 defaults: ["adb_defaults"],
754 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700755 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700756 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
757 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
758 ],
759 static_libs: [
760 "libadb_host",
761 "libandroidfw",
762 "libbase",
763 "libcutils",
764 "libcrypto_utils",
765 "libcrypto",
766 "libdiagnose_usb",
767 "libfastdeploy_host",
768 "liblog",
769 "libmdnssd",
770 "libprotobuf-cpp-lite",
771 "libusb",
772 "libutils",
773 "libziparchive",
774 "libz",
775 ],
776 target: {
777 windows: {
778 enabled: true,
779 shared_libs: ["AdbWinApi"],
780 },
781 },
782 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700783 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700784 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700785 "fastdeploy/testdata/sample.apk",
786 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700787 ],
788}