blob: 7c5e3ea69d2c2f7bce6a638c915bd944a983988a [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
163 stubs: {
164 symbol_file: "adbconnection/libadbconnection_client.map.txt",
165 versions: ["1"],
166 },
167
168 host_supported: true,
169 compile_multilib: "both",
170}
171
Josh Gao27768452018-01-02 12:01:43 -0800172// libadb
173// =========================================================
174// These files are compiled for both the host and the device.
175libadb_srcs = [
176 "adb.cpp",
177 "adb_io.cpp",
178 "adb_listeners.cpp",
179 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700180 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800181 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700182 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700183 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800184 "services.cpp",
185 "sockets.cpp",
186 "socket_spec.cpp",
187 "sysdeps/errno.cpp",
188 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700189 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800190 "transport_local.cpp",
191 "transport_usb.cpp",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700192 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800193]
194
195libadb_posix_srcs = [
196 "sysdeps_unix.cpp",
197 "sysdeps/posix/network.cpp",
198]
199
Josh Gaob43ad442019-07-11 13:47:44 -0700200libadb_linux_srcs = [
201 "fdevent/fdevent_epoll.cpp",
202]
203
Josh Gao27768452018-01-02 12:01:43 -0800204libadb_test_srcs = [
205 "adb_io_test.cpp",
206 "adb_listeners_test.cpp",
207 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700208 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800209 "socket_spec_test.cpp",
210 "socket_test.cpp",
211 "sysdeps_test.cpp",
212 "sysdeps/stat_test.cpp",
213 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700214 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800215]
216
217cc_library_host_static {
218 name: "libadb_host",
219 defaults: ["adb_defaults"],
220
221 srcs: libadb_srcs + [
222 "client/auth.cpp",
223 "client/usb_libusb.cpp",
224 "client/usb_dispatch.cpp",
225 "client/transport_mdns.cpp",
226 ],
227
Dan Willemsenab971b52018-08-29 14:58:02 -0700228 generated_headers: ["platform_tools_version"],
229
Josh Gao27768452018-01-02 12:01:43 -0800230 target: {
231 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700232 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800233 },
234 darwin: {
235 srcs: ["client/usb_osx.cpp"],
236 },
Josh Gao27768452018-01-02 12:01:43 -0800237 not_windows: {
238 srcs: libadb_posix_srcs,
239 },
240 windows: {
241 enabled: true,
242 srcs: [
243 "client/usb_windows.cpp",
244 "sysdeps_win32.cpp",
245 "sysdeps/win32/errno.cpp",
246 "sysdeps/win32/stat.cpp",
247 ],
248 shared_libs: ["AdbWinApi"],
249 },
250 },
251
252 static_libs: [
253 "libbase",
254 "libcrypto_utils",
255 "libcrypto",
256 "libdiagnose_usb",
257 "libmdnssd",
258 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100259 "libutils",
260 "liblog",
261 "libcutils",
Josh Gao27768452018-01-02 12:01:43 -0800262 ],
263}
264
265cc_test_host {
266 name: "adb_test",
267 defaults: ["adb_defaults"],
268 srcs: libadb_test_srcs,
269 static_libs: [
270 "libadb_host",
271 "libbase",
272 "libcutils",
273 "libcrypto_utils",
274 "libcrypto",
Tom Cherry99216302020-01-08 13:41:56 -0800275 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800276 "libmdnssd",
277 "libdiagnose_usb",
278 "libusb",
279 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700280
281 target: {
282 windows: {
283 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700284 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700285 shared_libs: ["AdbWinApi"],
286 },
287 },
Josh Gao27768452018-01-02 12:01:43 -0800288}
289
Josh Gao9c596492018-04-04 11:27:24 -0700290cc_benchmark {
291 name: "adb_benchmark",
292 defaults: ["adb_defaults"],
293
294 srcs: ["transport_benchmark.cpp"],
295 target: {
296 android: {
297 static_libs: [
298 "libadbd",
299 ],
300 },
301 host: {
302 static_libs: [
303 "libadb_host",
304 ],
305 },
306 },
307
308 static_libs: [
309 "libbase",
310 "libcutils",
311 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700312 "libcrypto_static",
Josh Gao9c596492018-04-04 11:27:24 -0700313 "libdiagnose_usb",
314 "liblog",
315 "libusb",
316 ],
317}
318
Josh Gao27768452018-01-02 12:01:43 -0800319cc_binary_host {
320 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800321
322 defaults: ["adb_defaults"],
323
324 srcs: [
325 "client/adb_client.cpp",
326 "client/bugreport.cpp",
327 "client/commandline.cpp",
328 "client/file_sync_client.cpp",
329 "client/main.cpp",
330 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000331 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800332 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700333 "client/fastdeploy.cpp",
334 "client/fastdeploycallbacks.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800335 "shell_service_protocol.cpp",
336 ],
337
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700338 generated_headers: [
339 "bin2c_fastdeployagent",
340 "bin2c_fastdeployagentscript"
341 ],
342
Josh Gao27768452018-01-02 12:01:43 -0800343 static_libs: [
344 "libadb_host",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700345 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800346 "libbase",
347 "libcutils",
348 "libcrypto_utils",
349 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700350 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800351 "libdiagnose_usb",
352 "liblog",
353 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700354 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800355 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100356 "libutils",
357 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700358 "libziparchive",
359 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800360 ],
361
362 stl: "libc++_static",
363
364 // Don't add anything here, we don't want additional shared dependencies
365 // on the host adb tool, and shared libraries that link against libc++
366 // will violate ODR
367 shared_libs: [],
368
Dan Willemsen3f439a72018-11-19 19:11:35 -0800369 // Archive adb, adb.exe.
370 dist: {
371 targets: [
372 "dist_files",
373 "sdk",
374 "win_sdk",
375 ],
376 },
377
Josh Gao27768452018-01-02 12:01:43 -0800378 target: {
379 darwin: {
380 cflags: [
381 "-Wno-sizeof-pointer-memaccess",
382 ],
383 },
384 windows: {
385 enabled: true,
386 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800387 shared_libs: ["AdbWinApi"],
388 required: [
389 "AdbWinUsbApi",
390 ],
391 },
392 },
393}
394
Tao Baoeca59ae2018-07-30 20:45:27 -0700395// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800396cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700397 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800398 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700399 recovery_available: true,
400
401 // libminadbd wants both, as it's used to build native tests.
402 compile_multilib: "both",
403
Josh Gaob43ad442019-07-11 13:47:44 -0700404 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700405 "daemon/auth.cpp",
406 "daemon/jdwp_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700407 ],
408
409 local_include_dirs: [
410 "daemon/include",
411 ],
412
Dan Willemsenab971b52018-08-29 14:58:02 -0700413 generated_headers: ["platform_tools_version"],
414
Tao Baoeca59ae2018-07-30 20:45:27 -0700415 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800416 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700417 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700418 ],
419
420 shared_libs: [
Josh Gao27523262019-10-22 12:30:39 -0700421 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700422 "libasyncio",
423 "libbase",
424 "libcrypto",
425 "libcrypto_utils",
426 "libcutils",
427 "liblog",
428 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800429
430 target: {
431 android: {
432 whole_static_libs: [
433 "libqemu_pipe",
434 ],
435 srcs: [
436 "daemon/transport_qemu.cpp",
437 "daemon/usb.cpp",
438 "daemon/usb_ffs.cpp",
439 "daemon/usb_legacy.cpp",
440 ]
441 },
442 linux_glibc: {
443 srcs: [
444 "daemon/usb_dummy.cpp",
445 ]
446 }
447 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700448}
449
450cc_library {
451 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",
Tao Baoeca59ae2018-07-30 20:45:27 -0700471 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700472 ],
473
474 shared_libs: [
Josh Gao27523262019-10-22 12:30:39 -0700475 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700476 "libasyncio",
477 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700478 "libcrypto",
479 "libcrypto_utils",
480 "libcutils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700481 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700482 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800483
484 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800485 android: {
486 srcs: [
487 "daemon/abb_service.cpp",
488 "daemon/framebuffer_service.cpp",
489 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800490 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800491 ],
492 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800493 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800494 "libselinux",
495 ],
496 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800497 recovery: {
498 exclude_srcs: [
499 "daemon/abb_service.cpp",
500 ],
501 },
502 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700503}
504
505cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800506 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800507 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900508 recovery_available: true,
Josh Gao27768452018-01-02 12:01:43 -0800509
Josh Gaobb7fc922020-01-22 17:58:03 -0800510 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Baoeca59ae2018-07-30 20:45:27 -0700511 use_version_lib: false,
512
513 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800514 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700515
516 // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
517 whole_static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800518 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700519 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800520 ],
521
Tao Baoeca59ae2018-07-30 20:45:27 -0700522 shared_libs: [
Josh Gao27523262019-10-22 12:30:39 -0700523 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700524 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800525 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800526 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700527 "libcrypto",
528 "libcrypto_utils",
529 "libcutils",
530 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800531 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700532
533 export_include_dirs: [
534 "daemon/include",
535 ],
Josh Gao27768452018-01-02 12:01:43 -0800536}
537
538cc_binary {
539 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800540 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900541 recovery_available: true,
Josh Gao8db99f82018-03-06 12:57:27 -0800542
Josh Gao27768452018-01-02 12:01:43 -0800543 srcs: [
544 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800545 ],
546
547 cflags: [
548 "-D_GNU_SOURCE",
549 "-Wno-deprecated-declarations",
550 ],
551
552 strip: {
553 keep_symbols: true,
554 },
555
Josh Gao594f70f2019-08-15 14:05:12 -0700556 stl: "libc++_static",
557 static_libs: [
Josh Gaobb7fc922020-01-22 17:58:03 -0800558 "libadbconnection_server",
Josh Gao27768452018-01-02 12:01:43 -0800559 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700560 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700561 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700562 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700563 "libbase",
564 "libcap",
Josh Gao594f70f2019-08-15 14:05:12 -0700565 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700566 "libcutils",
Josh Gao594f70f2019-08-15 14:05:12 -0700567 "libdiagnose_usb",
Josh Gao27768452018-01-02 12:01:43 -0800568 "liblog",
Josh Gao594f70f2019-08-15 14:05:12 -0700569 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800570 "libminijail",
571 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800572 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700573
574 shared_libs: [
Josh Gao594f70f2019-08-15 14:05:12 -0700575 "libcrypto",
576 ],
Josh Gao27768452018-01-02 12:01:43 -0800577}
578
Josh Gao7b7ee192019-10-23 13:27:17 -0700579phony {
580 name: "adbd_system_binaries",
581 required: [
582 "abb",
Josh Gao27523262019-10-22 12:30:39 -0700583 "libadbd_auth",
Josh Gao2c356bb2019-10-22 12:30:36 -0700584 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700585 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700586 ]
587}
588
589phony {
590 name: "adbd_system_binaries_recovery",
591 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700592 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700593 ],
594}
595
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800596cc_binary {
597 name: "abb",
598
Josh Gao776c2ec2019-01-22 19:36:15 -0800599 defaults: ["adbd_defaults"],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800600 recovery_available: false,
601
602 srcs: [
603 "daemon/abb.cpp",
604 ],
605
606 cflags: [
607 "-D_GNU_SOURCE",
608 "-Wno-deprecated-declarations",
609 ],
610
611 strip: {
612 keep_symbols: true,
613 },
614
615 static_libs: [
616 "libadbd_core",
617 "libadbd_services",
618 "libcmd",
619 ],
620
621 shared_libs: [
622 "libbase",
623 "libbinder",
624 "liblog",
625 "libutils",
626 "libselinux",
627 ],
628}
629
Josh Gao27768452018-01-02 12:01:43 -0800630cc_test {
631 name: "adbd_test",
Josh Gao776c2ec2019-01-22 19:36:15 -0800632 defaults: ["adbd_defaults"],
Josh Gao27768452018-01-02 12:01:43 -0800633 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700634 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800635 "daemon/shell_service.cpp",
636 "daemon/shell_service_test.cpp",
637 "shell_service_protocol.cpp",
638 "shell_service_protocol_test.cpp",
639 ],
640
641 static_libs: [
642 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700643 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800644 "libbase",
645 "libcutils",
646 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700647 "libcrypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800648 "libdiagnose_usb",
649 "liblog",
650 "libusb",
651 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900652 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800653 ],
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700654 test_suites: ["device-tests"],
Dan Shid1360f42019-09-24 09:04:05 -0700655 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800656}
657
Julien Desprez75fea7e2018-08-08 12:08:50 -0700658python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800659 name: "adb_integration_test_adb",
660 main: "test_adb.py",
661 srcs: [
662 "test_adb.py",
663 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700664 test_config: "adb_integration_test_adb.xml",
665 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800666 version: {
667 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700668 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800669 },
670 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700671 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800672 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700673 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700674}
675
Julien Desprez618f0e12018-10-12 13:48:14 -0700676python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800677 name: "adb_integration_test_device",
678 main: "test_device.py",
679 srcs: [
680 "test_device.py",
681 ],
682 libs: [
683 "adb_py",
684 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700685 test_config: "adb_integration_test_device.xml",
686 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800687 version: {
688 py2: {
689 enabled: true,
690 },
691 py3: {
692 enabled: false,
693 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700694 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700695}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700696
697// Note: using pipe for xxd to control the variable name generated
698// the default name used by xxd is the path to the input file.
699java_genrule {
700 name: "bin2c_fastdeployagent",
701 out: ["deployagent.inc"],
702 srcs: [":deployagent"],
703 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
704}
705
706genrule {
707 name: "bin2c_fastdeployagentscript",
708 out: ["deployagentscript.inc"],
709 srcs: ["fastdeploy/deployagent/deployagent.sh"],
710 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
711}
712
713cc_library_host_static {
714 name: "libfastdeploy_host",
715 defaults: ["adb_defaults"],
716 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700717 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700718 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
719 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
720 "fastdeploy/proto/ApkEntry.proto",
721 ],
722 static_libs: [
723 "libadb_host",
724 "libandroidfw",
725 "libbase",
726 "libcutils",
727 "libcrypto_utils",
728 "libcrypto",
729 "libdiagnose_usb",
730 "liblog",
731 "libmdnssd",
732 "libusb",
733 "libutils",
734 "libziparchive",
735 "libz",
736 ],
737 stl: "libc++_static",
738 proto: {
739 type: "lite",
740 export_proto_headers: true,
741 },
742 target: {
743 windows: {
744 enabled: true,
745 shared_libs: ["AdbWinApi"],
746 },
747 },
748}
749
750cc_test_host {
751 name: "fastdeploy_test",
752 defaults: ["adb_defaults"],
753 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700754 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700755 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
756 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
757 ],
758 static_libs: [
759 "libadb_host",
760 "libandroidfw",
761 "libbase",
762 "libcutils",
763 "libcrypto_utils",
764 "libcrypto",
765 "libdiagnose_usb",
766 "libfastdeploy_host",
767 "liblog",
768 "libmdnssd",
769 "libprotobuf-cpp-lite",
770 "libusb",
771 "libutils",
772 "libziparchive",
773 "libz",
774 ],
775 target: {
776 windows: {
777 enabled: true,
778 shared_libs: ["AdbWinApi"],
779 },
780 },
781 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700782 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700783 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700784 "fastdeploy/testdata/sample.apk",
785 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700786 ],
787}