blob: 2f9c8fcfbb697720d74bb8d322818001babc9025 [file] [log] [blame]
GuangHui Liu41bda342017-05-10 14:37:17 -07001// Copyright (C) 2017 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Josh Gao27768452018-01-02 12:01:43 -080015cc_defaults {
16 name: "adb_defaults",
17
18 cflags: [
19 "-Wall",
20 "-Wextra",
21 "-Werror",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070022 "-Wexit-time-destructors",
Josh Gao27768452018-01-02 12:01:43 -080023 "-Wno-unused-parameter",
24 "-Wno-missing-field-initializers",
Josh Gao776c2ec2019-01-22 19:36:15 -080025 "-Wthread-safety",
Josh Gao27768452018-01-02 12:01:43 -080026 "-Wvla",
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080027 "-DADB_HOST=1", // overridden by adbd_defaults
28 "-DALLOW_ADBD_ROOT=0", // overridden by adbd_defaults
Josh Gao27241a72019-04-25 14:04:57 -070029 "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
Josh Gao27768452018-01-02 12:01:43 -080030 ],
Josh Gao6eb78822018-11-16 15:40:16 -080031 cpp_std: "experimental",
Josh Gao27768452018-01-02 12:01:43 -080032
Josh Gaoc7567fa2018-02-27 15:49:23 -080033 use_version_lib: true,
Josh Gao27768452018-01-02 12:01:43 -080034 compile_multilib: "first",
Josh Gao27768452018-01-02 12:01:43 -080035
36 target: {
Josh Gao27768452018-01-02 12:01:43 -080037 darwin: {
38 host_ldlibs: [
39 "-lpthread",
40 "-framework CoreFoundation",
41 "-framework IOKit",
42 "-lobjc",
43 ],
44 },
45
46 windows: {
47 cflags: [
48 // Define windows.h and tchar.h Unicode preprocessor symbols so that
49 // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
50 // build if you accidentally pass char*. Fix by calling like:
51 // std::wstring path_wide;
52 // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
53 // CreateFileW(path_wide.c_str());
54 "-DUNICODE=1",
55 "-D_UNICODE=1",
56
Elliott Hughes3c59cb82018-12-03 09:02:18 -080057 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao27768452018-01-02 12:01:43 -080058 "-D_GNU_SOURCE",
Josh Gao2e1e7892018-03-23 13:03:28 -070059
60 // MinGW hides some things behind _POSIX_SOURCE.
61 "-D_POSIX_SOURCE",
Josh Gao776c2ec2019-01-22 19:36:15 -080062
Josh Gao4710e532019-04-17 16:57:43 -070063 // libusb uses __stdcall on a variadic function, which gets ignored.
64 "-Wno-ignored-attributes",
65
Josh Gao776c2ec2019-01-22 19:36:15 -080066 // Not supported yet.
67 "-Wno-thread-safety",
Josh Gao27768452018-01-02 12:01:43 -080068 ],
Josh Gaof8a97c12018-03-23 15:37:20 -070069
70 host_ldlibs: [
71 "-lws2_32",
72 "-lgdi32",
73 "-luserenv",
74 ],
Josh Gao27768452018-01-02 12:01:43 -080075 },
Josh Gao776c2ec2019-01-22 19:36:15 -080076 },
77}
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070078
Josh Gao776c2ec2019-01-22 19:36:15 -080079cc_defaults {
80 name: "adbd_defaults",
81 defaults: ["adb_defaults"],
82
83 cflags: ["-UADB_HOST", "-DADB_HOST=0"],
84 product_variables: {
85 debuggable: {
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070086 cflags: [
Bowgo Tsai9b30c0a2019-03-12 04:25:33 +080087 "-UALLOW_ADBD_ROOT",
88 "-DALLOW_ADBD_ROOT=1",
Josh Gao776c2ec2019-01-22 19:36:15 -080089 "-DALLOW_ADBD_DISABLE_VERITY",
90 "-DALLOW_ADBD_NO_AUTH",
Pirama Arumuga Nainar79821782018-06-01 11:31:38 -070091 ],
92 },
Josh Gao27768452018-01-02 12:01:43 -080093 },
94}
95
Josh Gao776c2ec2019-01-22 19:36:15 -080096cc_defaults {
97 name: "host_adbd_supported",
98
99 host_supported: true,
100 target: {
101 linux: {
102 enabled: true,
103 host_ldlibs: [
104 "-lresolv", // b64_pton
105 "-lutil", // forkpty
106 ],
107 },
108 darwin: {
109 enabled: false,
110 },
111 windows: {
112 enabled: false,
113 },
114 },
115}
116
Josh Gao27768452018-01-02 12:01:43 -0800117// libadb
118// =========================================================
119// These files are compiled for both the host and the device.
120libadb_srcs = [
121 "adb.cpp",
122 "adb_io.cpp",
123 "adb_listeners.cpp",
124 "adb_trace.cpp",
Josh Gao6e1246c2018-05-24 22:54:50 -0700125 "adb_unique_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800126 "adb_utils.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700127 "fdevent/fdevent.cpp",
Josh Gao95068bb2019-07-08 15:23:17 -0700128 "fdevent/fdevent_poll.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800129 "services.cpp",
130 "sockets.cpp",
131 "socket_spec.cpp",
132 "sysdeps/errno.cpp",
133 "transport.cpp",
Josh Gao6082e7d2018-04-05 16:16:04 -0700134 "transport_fd.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800135 "transport_local.cpp",
136 "transport_usb.cpp",
137]
138
139libadb_posix_srcs = [
140 "sysdeps_unix.cpp",
141 "sysdeps/posix/network.cpp",
142]
143
Josh Gaob43ad442019-07-11 13:47:44 -0700144libadb_linux_srcs = [
145 "fdevent/fdevent_epoll.cpp",
146]
147
Josh Gao27768452018-01-02 12:01:43 -0800148libadb_test_srcs = [
149 "adb_io_test.cpp",
150 "adb_listeners_test.cpp",
151 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700152 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800153 "socket_spec_test.cpp",
154 "socket_test.cpp",
155 "sysdeps_test.cpp",
156 "sysdeps/stat_test.cpp",
157 "transport_test.cpp",
Josh Gao7c738cd2018-04-03 14:37:11 -0700158 "types_test.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800159]
160
161cc_library_host_static {
162 name: "libadb_host",
163 defaults: ["adb_defaults"],
164
165 srcs: libadb_srcs + [
166 "client/auth.cpp",
167 "client/usb_libusb.cpp",
168 "client/usb_dispatch.cpp",
169 "client/transport_mdns.cpp",
170 ],
171
Dan Willemsenab971b52018-08-29 14:58:02 -0700172 generated_headers: ["platform_tools_version"],
173
Josh Gao27768452018-01-02 12:01:43 -0800174 target: {
175 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700176 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800177 },
178 darwin: {
179 srcs: ["client/usb_osx.cpp"],
180 },
Josh Gao27768452018-01-02 12:01:43 -0800181 not_windows: {
182 srcs: libadb_posix_srcs,
183 },
184 windows: {
185 enabled: true,
186 srcs: [
187 "client/usb_windows.cpp",
188 "sysdeps_win32.cpp",
189 "sysdeps/win32/errno.cpp",
190 "sysdeps/win32/stat.cpp",
191 ],
192 shared_libs: ["AdbWinApi"],
193 },
194 },
195
196 static_libs: [
197 "libbase",
198 "libcrypto_utils",
199 "libcrypto",
200 "libdiagnose_usb",
201 "libmdnssd",
202 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100203 "libutils",
204 "liblog",
205 "libcutils",
Josh Gao27768452018-01-02 12:01:43 -0800206 ],
207}
208
209cc_test_host {
210 name: "adb_test",
211 defaults: ["adb_defaults"],
212 srcs: libadb_test_srcs,
213 static_libs: [
214 "libadb_host",
215 "libbase",
216 "libcutils",
217 "libcrypto_utils",
218 "libcrypto",
219 "libmdnssd",
220 "libdiagnose_usb",
221 "libusb",
222 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700223
224 target: {
225 windows: {
226 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700227 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700228 shared_libs: ["AdbWinApi"],
229 },
230 },
Josh Gao27768452018-01-02 12:01:43 -0800231}
232
Josh Gao9c596492018-04-04 11:27:24 -0700233cc_benchmark {
234 name: "adb_benchmark",
235 defaults: ["adb_defaults"],
236
237 srcs: ["transport_benchmark.cpp"],
238 target: {
239 android: {
240 static_libs: [
241 "libadbd",
242 ],
243 },
244 host: {
245 static_libs: [
246 "libadb_host",
247 ],
248 },
249 },
250
251 static_libs: [
252 "libbase",
253 "libcutils",
254 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700255 "libcrypto_static",
Josh Gao9c596492018-04-04 11:27:24 -0700256 "libdiagnose_usb",
257 "liblog",
258 "libusb",
259 ],
260}
261
Josh Gao27768452018-01-02 12:01:43 -0800262cc_binary_host {
263 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800264
265 defaults: ["adb_defaults"],
266
267 srcs: [
268 "client/adb_client.cpp",
269 "client/bugreport.cpp",
270 "client/commandline.cpp",
271 "client/file_sync_client.cpp",
272 "client/main.cpp",
273 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000274 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800275 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700276 "client/fastdeploy.cpp",
277 "client/fastdeploycallbacks.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800278 "shell_service_protocol.cpp",
279 ],
280
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700281 generated_headers: [
282 "bin2c_fastdeployagent",
283 "bin2c_fastdeployagentscript"
284 ],
285
Josh Gao27768452018-01-02 12:01:43 -0800286 static_libs: [
287 "libadb_host",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700288 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800289 "libbase",
290 "libcutils",
291 "libcrypto_utils",
292 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700293 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800294 "libdiagnose_usb",
295 "liblog",
296 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700297 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800298 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100299 "libutils",
300 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700301 "libziparchive",
302 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800303 ],
304
305 stl: "libc++_static",
306
307 // Don't add anything here, we don't want additional shared dependencies
308 // on the host adb tool, and shared libraries that link against libc++
309 // will violate ODR
310 shared_libs: [],
311
Dan Willemsen3f439a72018-11-19 19:11:35 -0800312 // Archive adb, adb.exe.
313 dist: {
314 targets: [
315 "dist_files",
316 "sdk",
317 "win_sdk",
318 ],
319 },
320
Josh Gao27768452018-01-02 12:01:43 -0800321 target: {
322 darwin: {
323 cflags: [
324 "-Wno-sizeof-pointer-memaccess",
325 ],
326 },
327 windows: {
328 enabled: true,
329 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800330 shared_libs: ["AdbWinApi"],
331 required: [
332 "AdbWinUsbApi",
333 ],
334 },
335 },
336}
337
Tao Baoeca59ae2018-07-30 20:45:27 -0700338// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800339cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700340 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800341 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700342 recovery_available: true,
343
344 // libminadbd wants both, as it's used to build native tests.
345 compile_multilib: "both",
346
Josh Gaob43ad442019-07-11 13:47:44 -0700347 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700348 "daemon/auth.cpp",
349 "daemon/jdwp_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700350 ],
351
352 local_include_dirs: [
353 "daemon/include",
354 ],
355
Dan Willemsenab971b52018-08-29 14:58:02 -0700356 generated_headers: ["platform_tools_version"],
357
Tao Baoeca59ae2018-07-30 20:45:27 -0700358 static_libs: [
Josh Gao5f2c5bb2019-06-19 14:14:57 -0700359 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700360 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700361 ],
362
363 shared_libs: [
364 "libasyncio",
365 "libbase",
366 "libcrypto",
367 "libcrypto_utils",
368 "libcutils",
369 "liblog",
370 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800371
372 target: {
373 android: {
374 whole_static_libs: [
375 "libqemu_pipe",
376 ],
377 srcs: [
378 "daemon/transport_qemu.cpp",
379 "daemon/usb.cpp",
380 "daemon/usb_ffs.cpp",
381 "daemon/usb_legacy.cpp",
382 ]
383 },
384 linux_glibc: {
385 srcs: [
386 "daemon/usb_dummy.cpp",
387 ]
388 }
389 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700390}
391
392cc_library {
393 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800394 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700395 recovery_available: true,
396 compile_multilib: "both",
397
398 srcs: [
399 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700400 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700401 "daemon/shell_service.cpp",
402 "shell_service_protocol.cpp",
403 ],
404
405 cflags: [
406 "-D_GNU_SOURCE",
407 "-Wno-deprecated-declarations",
408 ],
409
410 static_libs: [
Josh Gao5f2c5bb2019-06-19 14:14:57 -0700411 "libadbconnection_server",
Tao Baoeca59ae2018-07-30 20:45:27 -0700412 "libadbd_core",
Tao Baoeca59ae2018-07-30 20:45:27 -0700413 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700414 ],
415
416 shared_libs: [
417 "libasyncio",
418 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700419 "libcrypto",
420 "libcrypto_utils",
421 "libcutils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700422 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700423 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800424
Mark Salyzyn2f6c1802019-02-15 07:45:26 -0800425 product_variables: {
426 debuggable: {
427 required: [
428 "remount",
429 ],
430 },
431 },
432
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800433 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800434 android: {
435 srcs: [
436 "daemon/abb_service.cpp",
437 "daemon/framebuffer_service.cpp",
438 "daemon/mdns.cpp",
439 "daemon/reboot_service.cpp",
440 "daemon/remount_service.cpp",
441 "daemon/restart_service.cpp",
442 "daemon/set_verity_enable_state_service.cpp",
443 ],
444 static_libs: [
445 "libavb_user",
446 ],
447 shared_libs: [
448 "libbootloader_message",
449 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800450 "libfec",
451 "libfs_mgr",
452 "libselinux",
453 ],
454 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800455 recovery: {
456 exclude_srcs: [
457 "daemon/abb_service.cpp",
458 ],
459 },
460 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700461}
462
463cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800464 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800465 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900466 recovery_available: true,
Josh Gao27768452018-01-02 12:01:43 -0800467
Tao Baoeca59ae2018-07-30 20:45:27 -0700468 // Avoid getting duplicate symbol of android::build::GetBuildNumber().
469 use_version_lib: false,
470
471 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800472 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700473
474 // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
475 whole_static_libs: [
476 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800477 ],
478
Tao Baoeca59ae2018-07-30 20:45:27 -0700479 shared_libs: [
480 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800481 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800482 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700483 "libcrypto",
484 "libcrypto_utils",
485 "libcutils",
486 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800487 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700488
489 export_include_dirs: [
490 "daemon/include",
491 ],
Josh Gao27768452018-01-02 12:01:43 -0800492}
493
494cc_binary {
495 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800496 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900497 recovery_available: true,
Josh Gao8db99f82018-03-06 12:57:27 -0800498
Josh Gao27768452018-01-02 12:01:43 -0800499 srcs: [
500 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800501 ],
502
503 cflags: [
504 "-D_GNU_SOURCE",
505 "-Wno-deprecated-declarations",
506 ],
507
508 strip: {
509 keep_symbols: true,
510 },
511
Tao Baoeca59ae2018-07-30 20:45:27 -0700512 shared_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800513 "libadbd",
Tao Baoeca59ae2018-07-30 20:45:27 -0700514 "libadbd_services",
515 "libbase",
516 "libcap",
Josh Gao27768452018-01-02 12:01:43 -0800517 "libcrypto",
Tao Baoeca59ae2018-07-30 20:45:27 -0700518 "libcutils",
Josh Gao27768452018-01-02 12:01:43 -0800519 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800520 "libminijail",
521 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800522 ],
523}
524
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800525cc_binary {
Josh Gaobde8c842019-05-01 18:25:14 -0700526 name: "static_adbd",
527 defaults: ["adbd_defaults", "host_adbd_supported"],
528
529 recovery_available: false,
530 static_executable: true,
531 host_supported: false,
532
533 srcs: [
534 "daemon/main.cpp",
535 ],
536
537 cflags: [
538 "-D_GNU_SOURCE",
539 "-Wno-deprecated-declarations",
540 ],
541
542 strip: {
543 keep_symbols: true,
544 },
545
546 static_libs: [
Josh Gao5f2c5bb2019-06-19 14:14:57 -0700547 "libadbconnection_server",
Josh Gaobde8c842019-05-01 18:25:14 -0700548 "libadbd",
549 "libadbd_services",
550 "libasyncio",
551 "libavb_user",
552 "libbase",
553 "libbootloader_message",
554 "libcap",
Colin Crossf117f342019-09-18 11:04:35 -0700555 "libcrypto_static",
Josh Gaobde8c842019-05-01 18:25:14 -0700556 "libcrypto_utils",
557 "libcutils",
558 "libdiagnose_usb",
559 "libext4_utils",
560 "libfec",
561 "libfec_rs",
562 "libfs_mgr",
563 "liblog",
564 "liblp",
565 "libmdnssd",
566 "libminijail",
567 "libselinux",
568 "libsquashfs_utils",
569 ],
570}
571
572cc_binary {
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800573 name: "abb",
574
Josh Gao776c2ec2019-01-22 19:36:15 -0800575 defaults: ["adbd_defaults"],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800576 recovery_available: false,
577
578 srcs: [
579 "daemon/abb.cpp",
580 ],
581
582 cflags: [
583 "-D_GNU_SOURCE",
584 "-Wno-deprecated-declarations",
585 ],
586
587 strip: {
588 keep_symbols: true,
589 },
590
591 static_libs: [
592 "libadbd_core",
593 "libadbd_services",
594 "libcmd",
595 ],
596
597 shared_libs: [
598 "libbase",
599 "libbinder",
600 "liblog",
601 "libutils",
602 "libselinux",
603 ],
604}
605
Josh Gao27768452018-01-02 12:01:43 -0800606cc_test {
607 name: "adbd_test",
Josh Gao776c2ec2019-01-22 19:36:15 -0800608 defaults: ["adbd_defaults"],
Josh Gao27768452018-01-02 12:01:43 -0800609 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700610 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800611 "daemon/shell_service.cpp",
612 "daemon/shell_service_test.cpp",
613 "shell_service_protocol.cpp",
614 "shell_service_protocol_test.cpp",
615 ],
616
617 static_libs: [
618 "libadbd",
619 "libbase",
Josh Gao997cfac2018-07-25 18:15:52 -0700620 "libbootloader_message",
Josh Gao27768452018-01-02 12:01:43 -0800621 "libcutils",
622 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700623 "libcrypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800624 "libdiagnose_usb",
625 "liblog",
626 "libusb",
627 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900628 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800629 ],
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700630 test_suites: ["device-tests"],
Dan Shid1360f42019-09-24 09:04:05 -0700631 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800632}
633
Julien Desprez75fea7e2018-08-08 12:08:50 -0700634python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800635 name: "adb_integration_test_adb",
636 main: "test_adb.py",
637 srcs: [
638 "test_adb.py",
639 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700640 test_config: "adb_integration_test_adb.xml",
641 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800642 version: {
643 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700644 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800645 },
646 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700647 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800648 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700649 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700650}
651
Julien Desprez618f0e12018-10-12 13:48:14 -0700652python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800653 name: "adb_integration_test_device",
654 main: "test_device.py",
655 srcs: [
656 "test_device.py",
657 ],
658 libs: [
659 "adb_py",
660 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700661 test_config: "adb_integration_test_device.xml",
662 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800663 version: {
664 py2: {
665 enabled: true,
666 },
667 py3: {
668 enabled: false,
669 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700670 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700671}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700672
673// Note: using pipe for xxd to control the variable name generated
674// the default name used by xxd is the path to the input file.
675java_genrule {
676 name: "bin2c_fastdeployagent",
677 out: ["deployagent.inc"],
678 srcs: [":deployagent"],
679 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
680}
681
682genrule {
683 name: "bin2c_fastdeployagentscript",
684 out: ["deployagentscript.inc"],
685 srcs: ["fastdeploy/deployagent/deployagent.sh"],
686 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
687}
688
689cc_library_host_static {
690 name: "libfastdeploy_host",
691 defaults: ["adb_defaults"],
692 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700693 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700694 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
695 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
696 "fastdeploy/proto/ApkEntry.proto",
697 ],
698 static_libs: [
699 "libadb_host",
700 "libandroidfw",
701 "libbase",
702 "libcutils",
703 "libcrypto_utils",
704 "libcrypto",
705 "libdiagnose_usb",
706 "liblog",
707 "libmdnssd",
708 "libusb",
709 "libutils",
710 "libziparchive",
711 "libz",
712 ],
713 stl: "libc++_static",
714 proto: {
715 type: "lite",
716 export_proto_headers: true,
717 },
718 target: {
719 windows: {
720 enabled: true,
721 shared_libs: ["AdbWinApi"],
722 },
723 },
724}
725
726cc_test_host {
727 name: "fastdeploy_test",
728 defaults: ["adb_defaults"],
729 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700730 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700731 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
732 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
733 ],
734 static_libs: [
735 "libadb_host",
736 "libandroidfw",
737 "libbase",
738 "libcutils",
739 "libcrypto_utils",
740 "libcrypto",
741 "libdiagnose_usb",
742 "libfastdeploy_host",
743 "liblog",
744 "libmdnssd",
745 "libprotobuf-cpp-lite",
746 "libusb",
747 "libutils",
748 "libziparchive",
749 "libz",
750 ],
751 target: {
752 windows: {
753 enabled: true,
754 shared_libs: ["AdbWinApi"],
755 },
756 },
757 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700758 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700759 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700760 "fastdeploy/testdata/sample.apk",
761 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700762 ],
763}