blob: 560e5682ed649f43353539a0b2cc746eb7128130 [file] [log] [blame]
GuangHui Liu35994392017-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 Gao361148b2018-01-02 12:01:43 -080015cc_defaults {
16 name: "adb_defaults",
17
18 cflags: [
19 "-Wall",
20 "-Wextra",
21 "-Werror",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070022 "-Wexit-time-destructors",
Josh Gao361148b2018-01-02 12:01:43 -080023 "-Wno-unused-parameter",
24 "-Wno-missing-field-initializers",
Josh Gao0560feb2019-01-22 19:36:15 -080025 "-Wthread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080026 "-Wvla",
Bowgo Tsai35b817b2019-03-12 04:25:33 +080027 "-DADB_HOST=1", // overridden by adbd_defaults
28 "-DALLOW_ADBD_ROOT=0", // overridden by adbd_defaults
Josh Gao90228a62019-04-25 14:04:57 -070029 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao361148b2018-01-02 12:01:43 -080030 ],
Josh Gao3edf8072018-11-16 15:40:16 -080031 cpp_std: "experimental",
Josh Gao361148b2018-01-02 12:01:43 -080032
Josh Gao66766f82018-02-27 15:49:23 -080033 use_version_lib: true,
Josh Gao361148b2018-01-02 12:01:43 -080034 compile_multilib: "first",
Josh Gao361148b2018-01-02 12:01:43 -080035
36 target: {
Josh Gao361148b2018-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 Hughesc229a722018-12-03 09:02:18 -080057 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao361148b2018-01-02 12:01:43 -080058 "-D_GNU_SOURCE",
Josh Gao96049b92018-03-23 13:03:28 -070059
60 // MinGW hides some things behind _POSIX_SOURCE.
61 "-D_POSIX_SOURCE",
Josh Gao0560feb2019-01-22 19:36:15 -080062
Josh Gaoc3b64032019-04-17 16:57:43 -070063 // libusb uses __stdcall on a variadic function, which gets ignored.
64 "-Wno-ignored-attributes",
65
Josh Gao0560feb2019-01-22 19:36:15 -080066 // Not supported yet.
67 "-Wno-thread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080068 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -070069
70 host_ldlibs: [
71 "-lws2_32",
72 "-lgdi32",
73 "-luserenv",
74 ],
Josh Gao361148b2018-01-02 12:01:43 -080075 },
Josh Gao0560feb2019-01-22 19:36:15 -080076 },
77}
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070078
Josh Gao0560feb2019-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 Nainar7aa20232018-06-01 11:31:38 -070086 cflags: [
Bowgo Tsai35b817b2019-03-12 04:25:33 +080087 "-UALLOW_ADBD_ROOT",
88 "-DALLOW_ADBD_ROOT=1",
Josh Gao0560feb2019-01-22 19:36:15 -080089 "-DALLOW_ADBD_DISABLE_VERITY",
90 "-DALLOW_ADBD_NO_AUTH",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070091 ],
92 },
Josh Gao361148b2018-01-02 12:01:43 -080093 },
94}
95
Josh Gao0560feb2019-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 Gaobf5a9362020-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 Willemsen24d5b5c2020-02-03 10:02:41 -0800163 target: {
164 linux: {
165 version_script: "adbconnection/libadbconnection_client.map.txt",
166 },
167 },
Josh Gaobf5a9362020-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 Gao361148b2018-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 Gao7d5762c2018-05-24 22:54:50 -0700185 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800186 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700187 "fdevent/fdevent.cpp",
Josh Gao9e4aa3a2019-07-08 15:23:17 -0700188 "fdevent/fdevent_poll.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800189 "services.cpp",
190 "sockets.cpp",
191 "socket_spec.cpp",
192 "sysdeps/errno.cpp",
193 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700194 "transport_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800195 "transport_local.cpp",
196 "transport_usb.cpp",
Yurii Zubrytskyie5e6b0d2019-07-12 14:11:54 -0700197 "types.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800198]
199
200libadb_posix_srcs = [
201 "sysdeps_unix.cpp",
202 "sysdeps/posix/network.cpp",
203]
204
Josh Gaodd716422019-07-11 13:47:44 -0700205libadb_linux_srcs = [
206 "fdevent/fdevent_epoll.cpp",
207]
208
Josh Gao361148b2018-01-02 12:01:43 -0800209libadb_test_srcs = [
210 "adb_io_test.cpp",
211 "adb_listeners_test.cpp",
212 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700213 "fdevent/fdevent_test.cpp",
Josh Gao361148b2018-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 Gao9f155db2018-04-03 14:37:11 -0700219 "types_test.cpp",
Josh Gao361148b2018-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",
228 "client/usb_libusb.cpp",
229 "client/usb_dispatch.cpp",
230 "client/transport_mdns.cpp",
231 ],
232
Dan Willemsen18861892018-08-29 14:58:02 -0700233 generated_headers: ["platform_tools_version"],
234
Josh Gao361148b2018-01-02 12:01:43 -0800235 target: {
236 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700237 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800238 },
239 darwin: {
240 srcs: ["client/usb_osx.cpp"],
241 },
Josh Gao361148b2018-01-02 12:01:43 -0800242 not_windows: {
243 srcs: libadb_posix_srcs,
244 },
245 windows: {
246 enabled: true,
247 srcs: [
248 "client/usb_windows.cpp",
249 "sysdeps_win32.cpp",
250 "sysdeps/win32/errno.cpp",
251 "sysdeps/win32/stat.cpp",
252 ],
253 shared_libs: ["AdbWinApi"],
254 },
255 },
256
257 static_libs: [
258 "libbase",
259 "libcrypto_utils",
260 "libcrypto",
261 "libdiagnose_usb",
262 "libmdnssd",
263 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100264 "libutils",
265 "liblog",
266 "libcutils",
Josh Gao361148b2018-01-02 12:01:43 -0800267 ],
268}
269
270cc_test_host {
271 name: "adb_test",
272 defaults: ["adb_defaults"],
273 srcs: libadb_test_srcs,
274 static_libs: [
275 "libadb_host",
276 "libbase",
277 "libcutils",
278 "libcrypto_utils",
279 "libcrypto",
Tom Cherry49b96ec2020-01-08 13:41:56 -0800280 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800281 "libmdnssd",
282 "libdiagnose_usb",
283 "libusb",
284 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700285
286 target: {
287 windows: {
288 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700289 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700290 shared_libs: ["AdbWinApi"],
291 },
292 },
Josh Gao361148b2018-01-02 12:01:43 -0800293}
294
Josh Gao11e41d62018-04-04 11:27:24 -0700295cc_benchmark {
296 name: "adb_benchmark",
297 defaults: ["adb_defaults"],
298
299 srcs: ["transport_benchmark.cpp"],
300 target: {
301 android: {
302 static_libs: [
303 "libadbd",
304 ],
305 },
306 host: {
307 static_libs: [
308 "libadb_host",
309 ],
310 },
311 },
312
313 static_libs: [
314 "libbase",
315 "libcutils",
316 "libcrypto_utils",
Colin Crosse1cc1ec2019-09-18 11:04:35 -0700317 "libcrypto_static",
Josh Gao11e41d62018-04-04 11:27:24 -0700318 "libdiagnose_usb",
319 "liblog",
320 "libusb",
321 ],
322}
323
Josh Gao361148b2018-01-02 12:01:43 -0800324cc_binary_host {
325 name: "adb",
Josh Gao361148b2018-01-02 12:01:43 -0800326
Josh Gao06af61e2020-02-03 23:08:05 -0800327 stl: "libc++_static",
Josh Gao361148b2018-01-02 12:01:43 -0800328 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 Hamadi1ecee442018-01-29 16:30:36 +0000337 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800338 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700339 "client/fastdeploy.cpp",
340 "client/fastdeploycallbacks.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800341 "shell_service_protocol.cpp",
342 ],
343
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700344 generated_headers: [
345 "bin2c_fastdeployagent",
346 "bin2c_fastdeployagentscript"
347 ],
348
Josh Gao361148b2018-01-02 12:01:43 -0800349 static_libs: [
350 "libadb_host",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700351 "libandroidfw",
Josh Gao361148b2018-01-02 12:01:43 -0800352 "libbase",
353 "libcutils",
354 "libcrypto_utils",
355 "libcrypto",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700356 "libfastdeploy_host",
Josh Gao361148b2018-01-02 12:01:43 -0800357 "libdiagnose_usb",
358 "liblog",
359 "libmdnssd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700360 "libprotobuf-cpp-lite",
Josh Gao361148b2018-01-02 12:01:43 -0800361 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100362 "libutils",
363 "liblog",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700364 "libziparchive",
365 "libz",
Josh Gao361148b2018-01-02 12:01:43 -0800366 ],
367
Josh Gao361148b2018-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 Willemsen7024da42018-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 Gao361148b2018-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 Gao361148b2018-01-02 12:01:43 -0800391 shared_libs: ["AdbWinApi"],
392 required: [
393 "AdbWinUsbApi",
394 ],
395 },
396 },
397}
398
Tao Bao49042e32018-07-30 20:45:27 -0700399// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800400cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700401 name: "libadbd_core",
Josh Gao0560feb2019-01-22 19:36:15 -0800402 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-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 Gaodd716422019-07-11 13:47:44 -0700408 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Bao49042e32018-07-30 20:45:27 -0700409 "daemon/auth.cpp",
410 "daemon/jdwp_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700411 ],
412
413 local_include_dirs: [
414 "daemon/include",
415 ],
416
Dan Willemsen18861892018-08-29 14:58:02 -0700417 generated_headers: ["platform_tools_version"],
418
Tao Bao49042e32018-07-30 20:45:27 -0700419 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800420 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700421 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700422 ],
423
424 shared_libs: [
Josh Gao7cac88a2019-10-22 12:30:39 -0700425 "libadbd_auth",
Tao Bao49042e32018-07-30 20:45:27 -0700426 "libasyncio",
427 "libbase",
428 "libcrypto",
429 "libcrypto_utils",
430 "libcutils",
431 "liblog",
432 ],
Josh Gao0560feb2019-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 Bao49042e32018-07-30 20:45:27 -0700452}
453
454cc_library {
455 name: "libadbd_services",
Josh Gao0560feb2019-01-22 19:36:15 -0800456 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700457 recovery_available: true,
458 compile_multilib: "both",
459
460 srcs: [
461 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700462 "daemon/services.cpp",
Tao Bao49042e32018-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 Gaobf5a9362020-01-22 17:58:03 -0800473 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700474 "libadbd_core",
Tao Bao49042e32018-07-30 20:45:27 -0700475 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700476 ],
477
478 shared_libs: [
Josh Gao7cac88a2019-10-22 12:30:39 -0700479 "libadbd_auth",
Tao Bao49042e32018-07-30 20:45:27 -0700480 "libasyncio",
481 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700482 "libcrypto",
483 "libcrypto_utils",
484 "libcutils",
Tao Bao49042e32018-07-30 20:45:27 -0700485 "liblog",
Tao Bao49042e32018-07-30 20:45:27 -0700486 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800487
488 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800489 android: {
490 srcs: [
491 "daemon/abb_service.cpp",
492 "daemon/framebuffer_service.cpp",
493 "daemon/mdns.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800494 "daemon/restart_service.cpp",
Josh Gao0560feb2019-01-22 19:36:15 -0800495 ],
496 shared_libs: [
Josh Gao0560feb2019-01-22 19:36:15 -0800497 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800498 "libselinux",
499 ],
500 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800501 recovery: {
502 exclude_srcs: [
503 "daemon/abb_service.cpp",
504 ],
505 },
506 },
Tao Bao49042e32018-07-30 20:45:27 -0700507}
508
509cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800510 name: "libadbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800511 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900512 recovery_available: true,
Josh Gao361148b2018-01-02 12:01:43 -0800513
Josh Gaobf5a9362020-01-22 17:58:03 -0800514 // avoid getting duplicate symbol of android::build::getbuildnumber().
Tao Bao49042e32018-07-30 20:45:27 -0700515 use_version_lib: false,
516
517 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800518 compile_multilib: "both",
Tao Bao49042e32018-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 Gaobf5a9362020-01-22 17:58:03 -0800522 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700523 "libadbd_core",
Josh Gao361148b2018-01-02 12:01:43 -0800524 ],
525
Tao Bao49042e32018-07-30 20:45:27 -0700526 shared_libs: [
Josh Gao7cac88a2019-10-22 12:30:39 -0700527 "libadbd_auth",
Tao Bao49042e32018-07-30 20:45:27 -0700528 "libadbd_services",
Josh Gao361148b2018-01-02 12:01:43 -0800529 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800530 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700531 "libcrypto",
532 "libcrypto_utils",
533 "libcutils",
534 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800535 ],
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700536
537 export_include_dirs: [
538 "daemon/include",
539 ],
Josh Gao361148b2018-01-02 12:01:43 -0800540}
541
542cc_binary {
543 name: "adbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800544 defaults: ["adbd_defaults", "host_adbd_supported"],
Josh Gao06af61e2020-02-03 23:08:05 -0800545 stl: "libc++_static",
Jiyong Parkeb590392018-05-24 14:11:00 +0900546 recovery_available: true,
Josh Gao3e0540a2018-03-06 12:57:27 -0800547
Josh Gao361148b2018-01-02 12:01:43 -0800548 srcs: [
549 "daemon/main.cpp",
Josh Gao361148b2018-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 Gao2bfc85e2019-08-15 14:05:12 -0700561 static_libs: [
Josh Gaobf5a9362020-01-22 17:58:03 -0800562 "libadbconnection_server",
Josh Gao361148b2018-01-02 12:01:43 -0800563 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700564 "libadbd_services",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700565 "libasyncio",
Tao Bao49042e32018-07-30 20:45:27 -0700566 "libbase",
567 "libcap",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700568 "libcrypto_utils",
Tao Bao49042e32018-07-30 20:45:27 -0700569 "libcutils",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700570 "libdiagnose_usb",
Josh Gao361148b2018-01-02 12:01:43 -0800571 "liblog",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700572 "libmdnssd",
Josh Gao361148b2018-01-02 12:01:43 -0800573 "libminijail",
574 "libselinux",
Josh Gao361148b2018-01-02 12:01:43 -0800575 ],
Josh Gao2bfc85e2019-08-15 14:05:12 -0700576
577 shared_libs: [
Josh Gao090712a2020-01-16 12:40:43 -0800578 "libadbd_auth",
Josh Gao2bfc85e2019-08-15 14:05:12 -0700579 "libcrypto",
580 ],
Josh Gao06af61e2020-02-03 23:08:05 -0800581
582 required: ["libadbd_auth"],
Josh Gao361148b2018-01-02 12:01:43 -0800583}
584
Josh Gao06e45932019-10-23 13:27:17 -0700585phony {
586 name: "adbd_system_binaries",
587 required: [
588 "abb",
Josh Gao83ce3e22019-10-22 12:30:36 -0700589 "reboot",
Josh Gaob554f4b2019-10-22 12:30:30 -0700590 "set-verity-state",
Josh Gao06e45932019-10-23 13:27:17 -0700591 ]
592}
593
594phony {
595 name: "adbd_system_binaries_recovery",
596 required: [
Josh Gao83ce3e22019-10-22 12:30:36 -0700597 "reboot.recovery",
Josh Gao06e45932019-10-23 13:27:17 -0700598 ],
599}
600
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800601cc_binary {
602 name: "abb",
603
Josh Gao0560feb2019-01-22 19:36:15 -0800604 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800605 stl: "libc++",
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800606 recovery_available: false,
607
608 srcs: [
609 "daemon/abb.cpp",
610 ],
611
612 cflags: [
613 "-D_GNU_SOURCE",
614 "-Wno-deprecated-declarations",
615 ],
616
617 strip: {
618 keep_symbols: true,
619 },
620
621 static_libs: [
622 "libadbd_core",
623 "libadbd_services",
624 "libcmd",
625 ],
626
627 shared_libs: [
628 "libbase",
629 "libbinder",
630 "liblog",
631 "libutils",
632 "libselinux",
633 ],
634}
635
Josh Gao361148b2018-01-02 12:01:43 -0800636cc_test {
637 name: "adbd_test",
Josh Gao06af61e2020-02-03 23:08:05 -0800638
Josh Gao0560feb2019-01-22 19:36:15 -0800639 defaults: ["adbd_defaults"],
Josh Gao06af61e2020-02-03 23:08:05 -0800640 stl: "libc++_static",
641
642 recovery_available: false,
Josh Gao361148b2018-01-02 12:01:43 -0800643 srcs: libadb_test_srcs + [
Josh Gao5607e922018-07-25 18:15:52 -0700644 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800645 "daemon/shell_service.cpp",
646 "daemon/shell_service_test.cpp",
647 "shell_service_protocol.cpp",
648 "shell_service_protocol_test.cpp",
649 ],
650
651 static_libs: [
652 "libadbd",
Josh Gao7cac88a2019-10-22 12:30:39 -0700653 "libadbd_auth",
Josh Gao361148b2018-01-02 12:01:43 -0800654 "libbase",
655 "libcutils",
656 "libcrypto_utils",
Colin Crosse1cc1ec2019-09-18 11:04:35 -0700657 "libcrypto_static",
Josh Gao361148b2018-01-02 12:01:43 -0800658 "libdiagnose_usb",
659 "liblog",
660 "libusb",
661 "libmdnssd",
Jiyong Park19c39fa2018-05-29 16:41:30 +0900662 "libselinux",
Josh Gao361148b2018-01-02 12:01:43 -0800663 ],
Elliott Hughesce226c92018-04-27 16:12:06 -0700664 test_suites: ["device-tests"],
Dan Shi22e091b2019-09-24 09:04:05 -0700665 require_root: true,
Josh Gao361148b2018-01-02 12:01:43 -0800666}
667
Julien Desprezae94f512018-08-08 12:08:50 -0700668python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800669 name: "adb_integration_test_adb",
670 main: "test_adb.py",
671 srcs: [
672 "test_adb.py",
673 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700674 test_config: "adb_integration_test_adb.xml",
675 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800676 version: {
677 py2: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700678 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800679 },
680 py3: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700681 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800682 },
GuangHui Liu35994392017-05-10 14:37:17 -0700683 },
GuangHui Liu35994392017-05-10 14:37:17 -0700684}
685
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700686python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800687 name: "adb_integration_test_device",
688 main: "test_device.py",
689 srcs: [
690 "test_device.py",
691 ],
692 libs: [
693 "adb_py",
694 ],
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700695 test_config: "adb_integration_test_device.xml",
696 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800697 version: {
698 py2: {
699 enabled: true,
700 },
701 py3: {
702 enabled: false,
703 },
GuangHui Liu35994392017-05-10 14:37:17 -0700704 },
GuangHui Liu35994392017-05-10 14:37:17 -0700705}
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700706
707// Note: using pipe for xxd to control the variable name generated
708// the default name used by xxd is the path to the input file.
709java_genrule {
710 name: "bin2c_fastdeployagent",
711 out: ["deployagent.inc"],
712 srcs: [":deployagent"],
713 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
714}
715
716genrule {
717 name: "bin2c_fastdeployagentscript",
718 out: ["deployagentscript.inc"],
719 srcs: ["fastdeploy/deployagent/deployagent.sh"],
720 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
721}
722
723cc_library_host_static {
724 name: "libfastdeploy_host",
725 defaults: ["adb_defaults"],
726 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700727 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700728 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
729 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
730 "fastdeploy/proto/ApkEntry.proto",
731 ],
732 static_libs: [
733 "libadb_host",
734 "libandroidfw",
735 "libbase",
736 "libcutils",
737 "libcrypto_utils",
738 "libcrypto",
739 "libdiagnose_usb",
740 "liblog",
741 "libmdnssd",
742 "libusb",
743 "libutils",
744 "libziparchive",
745 "libz",
746 ],
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700747 proto: {
748 type: "lite",
749 export_proto_headers: true,
750 },
751 target: {
752 windows: {
753 enabled: true,
754 shared_libs: ["AdbWinApi"],
755 },
756 },
757}
758
759cc_test_host {
760 name: "fastdeploy_test",
761 defaults: ["adb_defaults"],
762 srcs: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700763 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700764 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
765 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
766 ],
767 static_libs: [
768 "libadb_host",
769 "libandroidfw",
770 "libbase",
771 "libcutils",
772 "libcrypto_utils",
773 "libcrypto",
774 "libdiagnose_usb",
775 "libfastdeploy_host",
776 "liblog",
777 "libmdnssd",
778 "libprotobuf-cpp-lite",
779 "libusb",
780 "libutils",
781 "libziparchive",
782 "libz",
783 ],
784 target: {
785 windows: {
786 enabled: true,
787 shared_libs: ["AdbWinApi"],
788 },
789 },
790 data: [
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700791 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700792 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy1af550e2019-09-16 12:10:54 -0700793 "fastdeploy/testdata/sample.apk",
794 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700795 ],
796}