blob: 57872b0c91afb2a700fc4371bcdf24398b3ef4f7 [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",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -070030 "-DENABLE_FASTDEPLOY=1", // enable fast deploy
Josh Gao361148b2018-01-02 12:01:43 -080031 ],
Josh Gao3edf8072018-11-16 15:40:16 -080032 cpp_std: "experimental",
Josh Gao361148b2018-01-02 12:01:43 -080033
Josh Gao66766f82018-02-27 15:49:23 -080034 use_version_lib: true,
Josh Gao361148b2018-01-02 12:01:43 -080035 compile_multilib: "first",
Josh Gao361148b2018-01-02 12:01:43 -080036
37 target: {
Josh Gao361148b2018-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 Hughesc229a722018-12-03 09:02:18 -080058 // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
Josh Gao361148b2018-01-02 12:01:43 -080059 "-D_GNU_SOURCE",
Josh Gao96049b92018-03-23 13:03:28 -070060
61 // MinGW hides some things behind _POSIX_SOURCE.
62 "-D_POSIX_SOURCE",
Josh Gao0560feb2019-01-22 19:36:15 -080063
Josh Gaoc3b64032019-04-17 16:57:43 -070064 // libusb uses __stdcall on a variadic function, which gets ignored.
65 "-Wno-ignored-attributes",
66
Josh Gao0560feb2019-01-22 19:36:15 -080067 // Not supported yet.
68 "-Wno-thread-safety",
Josh Gao361148b2018-01-02 12:01:43 -080069 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -070070
71 host_ldlibs: [
72 "-lws2_32",
73 "-lgdi32",
74 "-luserenv",
75 ],
Josh Gao361148b2018-01-02 12:01:43 -080076 },
Josh Gao0560feb2019-01-22 19:36:15 -080077 },
78}
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070079
Josh Gao0560feb2019-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 Nainar7aa20232018-06-01 11:31:38 -070087 cflags: [
Bowgo Tsai35b817b2019-03-12 04:25:33 +080088 "-UALLOW_ADBD_ROOT",
89 "-DALLOW_ADBD_ROOT=1",
Josh Gao0560feb2019-01-22 19:36:15 -080090 "-DALLOW_ADBD_DISABLE_VERITY",
91 "-DALLOW_ADBD_NO_AUTH",
Pirama Arumuga Nainar7aa20232018-06-01 11:31:38 -070092 ],
93 },
Josh Gao361148b2018-01-02 12:01:43 -080094 },
95}
96
Josh Gao0560feb2019-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 Gao361148b2018-01-02 12:01:43 -0800118// libadb
119// =========================================================
120// These files are compiled for both the host and the device.
121libadb_srcs = [
122 "adb.cpp",
123 "adb_io.cpp",
124 "adb_listeners.cpp",
125 "adb_trace.cpp",
Josh Gao7d5762c2018-05-24 22:54:50 -0700126 "adb_unique_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800127 "adb_utils.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700128 "fdevent/fdevent.cpp",
Josh Gao9e4aa3a2019-07-08 15:23:17 -0700129 "fdevent/fdevent_poll.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800130 "services.cpp",
131 "sockets.cpp",
132 "socket_spec.cpp",
133 "sysdeps/errno.cpp",
134 "transport.cpp",
Josh Gao1e41fda2018-04-05 16:16:04 -0700135 "transport_fd.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800136 "transport_local.cpp",
137 "transport_usb.cpp",
138]
139
140libadb_posix_srcs = [
141 "sysdeps_unix.cpp",
142 "sysdeps/posix/network.cpp",
143]
144
Josh Gaodd716422019-07-11 13:47:44 -0700145libadb_linux_srcs = [
146 "fdevent/fdevent_epoll.cpp",
147]
148
Josh Gao361148b2018-01-02 12:01:43 -0800149libadb_test_srcs = [
150 "adb_io_test.cpp",
151 "adb_listeners_test.cpp",
152 "adb_utils_test.cpp",
Josh Gaob51193a2019-06-28 13:50:37 -0700153 "fdevent/fdevent_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800154 "socket_spec_test.cpp",
155 "socket_test.cpp",
156 "sysdeps_test.cpp",
157 "sysdeps/stat_test.cpp",
158 "transport_test.cpp",
Josh Gao9f155db2018-04-03 14:37:11 -0700159 "types_test.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800160]
161
162cc_library_host_static {
163 name: "libadb_host",
164 defaults: ["adb_defaults"],
165
166 srcs: libadb_srcs + [
167 "client/auth.cpp",
168 "client/usb_libusb.cpp",
169 "client/usb_dispatch.cpp",
170 "client/transport_mdns.cpp",
171 ],
172
Dan Willemsen18861892018-08-29 14:58:02 -0700173 generated_headers: ["platform_tools_version"],
174
Josh Gao361148b2018-01-02 12:01:43 -0800175 target: {
176 linux: {
Josh Gaodd716422019-07-11 13:47:44 -0700177 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao361148b2018-01-02 12:01:43 -0800178 },
179 darwin: {
180 srcs: ["client/usb_osx.cpp"],
181 },
Josh Gao361148b2018-01-02 12:01:43 -0800182 not_windows: {
183 srcs: libadb_posix_srcs,
184 },
185 windows: {
186 enabled: true,
187 srcs: [
188 "client/usb_windows.cpp",
189 "sysdeps_win32.cpp",
190 "sysdeps/win32/errno.cpp",
191 "sysdeps/win32/stat.cpp",
192 ],
193 shared_libs: ["AdbWinApi"],
194 },
195 },
196
197 static_libs: [
198 "libbase",
199 "libcrypto_utils",
200 "libcrypto",
201 "libdiagnose_usb",
202 "libmdnssd",
203 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100204 "libutils",
205 "liblog",
206 "libcutils",
Josh Gao361148b2018-01-02 12:01:43 -0800207 ],
208}
209
210cc_test_host {
211 name: "adb_test",
212 defaults: ["adb_defaults"],
213 srcs: libadb_test_srcs,
214 static_libs: [
215 "libadb_host",
216 "libbase",
217 "libcutils",
218 "libcrypto_utils",
219 "libcrypto",
220 "libmdnssd",
221 "libdiagnose_usb",
222 "libusb",
223 ],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700224
225 target: {
226 windows: {
227 enabled: true,
Josh Gao3e8bdab2019-07-16 15:08:42 -0700228 ldflags: ["-municode"],
Josh Gaoea7b95a2018-03-23 15:37:20 -0700229 shared_libs: ["AdbWinApi"],
230 },
231 },
Josh Gao361148b2018-01-02 12:01:43 -0800232}
233
Josh Gao11e41d62018-04-04 11:27:24 -0700234cc_benchmark {
235 name: "adb_benchmark",
236 defaults: ["adb_defaults"],
237
238 srcs: ["transport_benchmark.cpp"],
239 target: {
240 android: {
241 static_libs: [
242 "libadbd",
243 ],
244 },
245 host: {
246 static_libs: [
247 "libadb_host",
248 ],
249 },
250 },
251
252 static_libs: [
253 "libbase",
254 "libcutils",
255 "libcrypto_utils",
256 "libcrypto",
257 "libdiagnose_usb",
258 "liblog",
259 "libusb",
260 ],
261}
262
Josh Gao361148b2018-01-02 12:01:43 -0800263cc_binary_host {
264 name: "adb",
Josh Gao361148b2018-01-02 12:01:43 -0800265
266 defaults: ["adb_defaults"],
267
268 srcs: [
269 "client/adb_client.cpp",
270 "client/bugreport.cpp",
271 "client/commandline.cpp",
272 "client/file_sync_client.cpp",
273 "client/main.cpp",
274 "client/console.cpp",
Idries Hamadi1ecee442018-01-29 16:30:36 +0000275 "client/adb_install.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800276 "client/line_printer.cpp",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700277 "client/fastdeploy.cpp",
278 "client/fastdeploycallbacks.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800279 "shell_service_protocol.cpp",
280 ],
281
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700282 generated_headers: [
283 "bin2c_fastdeployagent",
284 "bin2c_fastdeployagentscript"
285 ],
286
Josh Gao361148b2018-01-02 12:01:43 -0800287 static_libs: [
288 "libadb_host",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700289 "libandroidfw",
Josh Gao361148b2018-01-02 12:01:43 -0800290 "libbase",
291 "libcutils",
292 "libcrypto_utils",
293 "libcrypto",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700294 "libfastdeploy_host",
Josh Gao361148b2018-01-02 12:01:43 -0800295 "libdiagnose_usb",
296 "liblog",
297 "libmdnssd",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700298 "libprotobuf-cpp-lite",
Josh Gao361148b2018-01-02 12:01:43 -0800299 "libusb",
Idries Hamadi78330f02018-09-13 18:00:25 +0100300 "libutils",
301 "liblog",
Joshua Gilpatrick0d384112019-07-19 09:42:12 -0700302 "libziparchive",
303 "libz",
Josh Gao361148b2018-01-02 12:01:43 -0800304 ],
305
306 stl: "libc++_static",
307
308 // Don't add anything here, we don't want additional shared dependencies
309 // on the host adb tool, and shared libraries that link against libc++
310 // will violate ODR
311 shared_libs: [],
312
Dan Willemsen7024da42018-11-19 19:11:35 -0800313 // Archive adb, adb.exe.
314 dist: {
315 targets: [
316 "dist_files",
317 "sdk",
318 "win_sdk",
319 ],
320 },
321
Josh Gao361148b2018-01-02 12:01:43 -0800322 target: {
323 darwin: {
324 cflags: [
325 "-Wno-sizeof-pointer-memaccess",
326 ],
327 },
328 windows: {
329 enabled: true,
330 ldflags: ["-municode"],
Josh Gao361148b2018-01-02 12:01:43 -0800331 shared_libs: ["AdbWinApi"],
332 required: [
333 "AdbWinUsbApi",
334 ],
335 },
336 },
337}
338
Tao Bao49042e32018-07-30 20:45:27 -0700339// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao361148b2018-01-02 12:01:43 -0800340cc_library_static {
Tao Bao49042e32018-07-30 20:45:27 -0700341 name: "libadbd_core",
Josh Gao0560feb2019-01-22 19:36:15 -0800342 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700343 recovery_available: true,
344
345 // libminadbd wants both, as it's used to build native tests.
346 compile_multilib: "both",
347
Josh Gaodd716422019-07-11 13:47:44 -0700348 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Bao49042e32018-07-30 20:45:27 -0700349 "daemon/auth.cpp",
350 "daemon/jdwp_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700351 ],
352
353 local_include_dirs: [
354 "daemon/include",
355 ],
356
Dan Willemsen18861892018-08-29 14:58:02 -0700357 generated_headers: ["platform_tools_version"],
358
Tao Bao49042e32018-07-30 20:45:27 -0700359 static_libs: [
Josh Gaoeb5e6052019-06-19 14:14:57 -0700360 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700361 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700362 ],
363
364 shared_libs: [
365 "libasyncio",
366 "libbase",
367 "libcrypto",
368 "libcrypto_utils",
369 "libcutils",
370 "liblog",
371 ],
Josh Gao0560feb2019-01-22 19:36:15 -0800372
373 target: {
374 android: {
375 whole_static_libs: [
376 "libqemu_pipe",
377 ],
378 srcs: [
379 "daemon/transport_qemu.cpp",
380 "daemon/usb.cpp",
381 "daemon/usb_ffs.cpp",
382 "daemon/usb_legacy.cpp",
383 ]
384 },
385 linux_glibc: {
386 srcs: [
387 "daemon/usb_dummy.cpp",
388 ]
389 }
390 },
Tao Bao49042e32018-07-30 20:45:27 -0700391}
392
393cc_library {
394 name: "libadbd_services",
Josh Gao0560feb2019-01-22 19:36:15 -0800395 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Bao49042e32018-07-30 20:45:27 -0700396 recovery_available: true,
397 compile_multilib: "both",
398
399 srcs: [
400 "daemon/file_sync_service.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700401 "daemon/services.cpp",
Tao Bao49042e32018-07-30 20:45:27 -0700402 "daemon/shell_service.cpp",
403 "shell_service_protocol.cpp",
404 ],
405
406 cflags: [
407 "-D_GNU_SOURCE",
408 "-Wno-deprecated-declarations",
409 ],
410
411 static_libs: [
Josh Gaoeb5e6052019-06-19 14:14:57 -0700412 "libadbconnection_server",
Tao Bao49042e32018-07-30 20:45:27 -0700413 "libadbd_core",
Tao Bao49042e32018-07-30 20:45:27 -0700414 "libdiagnose_usb",
Tao Bao49042e32018-07-30 20:45:27 -0700415 ],
416
417 shared_libs: [
418 "libasyncio",
419 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700420 "libcrypto",
421 "libcrypto_utils",
422 "libcutils",
Tao Bao49042e32018-07-30 20:45:27 -0700423 "liblog",
Tao Bao49042e32018-07-30 20:45:27 -0700424 ],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800425
Mark Salyzyn81bcf582019-02-15 07:45:26 -0800426 product_variables: {
427 debuggable: {
428 required: [
429 "remount",
430 ],
431 },
432 },
433
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800434 target: {
Josh Gao0560feb2019-01-22 19:36:15 -0800435 android: {
436 srcs: [
437 "daemon/abb_service.cpp",
438 "daemon/framebuffer_service.cpp",
439 "daemon/mdns.cpp",
440 "daemon/reboot_service.cpp",
441 "daemon/remount_service.cpp",
442 "daemon/restart_service.cpp",
443 "daemon/set_verity_enable_state_service.cpp",
444 ],
445 static_libs: [
446 "libavb_user",
447 ],
448 shared_libs: [
449 "libbootloader_message",
450 "libmdnssd",
Josh Gao0560feb2019-01-22 19:36:15 -0800451 "libfec",
452 "libfs_mgr",
453 "libselinux",
454 ],
455 },
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800456 recovery: {
457 exclude_srcs: [
458 "daemon/abb_service.cpp",
459 ],
460 },
461 },
Tao Bao49042e32018-07-30 20:45:27 -0700462}
463
464cc_library {
Josh Gao361148b2018-01-02 12:01:43 -0800465 name: "libadbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800466 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900467 recovery_available: true,
Josh Gao361148b2018-01-02 12:01:43 -0800468
Tao Bao49042e32018-07-30 20:45:27 -0700469 // Avoid getting duplicate symbol of android::build::GetBuildNumber().
470 use_version_lib: false,
471
472 // libminadbd wants both, as it's used to build native tests.
Josh Gao361148b2018-01-02 12:01:43 -0800473 compile_multilib: "both",
Tao Bao49042e32018-07-30 20:45:27 -0700474
475 // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
476 whole_static_libs: [
477 "libadbd_core",
Josh Gao361148b2018-01-02 12:01:43 -0800478 ],
479
Tao Bao49042e32018-07-30 20:45:27 -0700480 shared_libs: [
481 "libadbd_services",
Josh Gao361148b2018-01-02 12:01:43 -0800482 "libasyncio",
Josh Gao361148b2018-01-02 12:01:43 -0800483 "libbase",
Tao Bao49042e32018-07-30 20:45:27 -0700484 "libcrypto",
485 "libcrypto_utils",
486 "libcutils",
487 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800488 ],
Jerry Zhangd4fe8b62018-05-07 15:14:47 -0700489
490 export_include_dirs: [
491 "daemon/include",
492 ],
Josh Gao361148b2018-01-02 12:01:43 -0800493}
494
495cc_binary {
496 name: "adbd",
Josh Gao0560feb2019-01-22 19:36:15 -0800497 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parkeb590392018-05-24 14:11:00 +0900498 recovery_available: true,
Josh Gao3e0540a2018-03-06 12:57:27 -0800499
Josh Gao361148b2018-01-02 12:01:43 -0800500 srcs: [
501 "daemon/main.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800502 ],
503
504 cflags: [
505 "-D_GNU_SOURCE",
506 "-Wno-deprecated-declarations",
507 ],
508
509 strip: {
510 keep_symbols: true,
511 },
512
Tao Bao49042e32018-07-30 20:45:27 -0700513 shared_libs: [
Josh Gao361148b2018-01-02 12:01:43 -0800514 "libadbd",
Tao Bao49042e32018-07-30 20:45:27 -0700515 "libadbd_services",
516 "libbase",
517 "libcap",
Josh Gao361148b2018-01-02 12:01:43 -0800518 "libcrypto",
Tao Bao49042e32018-07-30 20:45:27 -0700519 "libcutils",
Josh Gao361148b2018-01-02 12:01:43 -0800520 "liblog",
Josh Gao361148b2018-01-02 12:01:43 -0800521 "libminijail",
522 "libselinux",
Josh Gao361148b2018-01-02 12:01:43 -0800523 ],
524}
525
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800526cc_binary {
Josh Gao5836b3a2019-05-01 18:25:14 -0700527 name: "static_adbd",
528 defaults: ["adbd_defaults", "host_adbd_supported"],
529
530 recovery_available: false,
531 static_executable: true,
532 host_supported: false,
533
534 srcs: [
535 "daemon/main.cpp",
536 ],
537
538 cflags: [
539 "-D_GNU_SOURCE",
540 "-Wno-deprecated-declarations",
541 ],
542
543 strip: {
544 keep_symbols: true,
545 },
546
547 static_libs: [
Josh Gaoeb5e6052019-06-19 14:14:57 -0700548 "libadbconnection_server",
Josh Gao5836b3a2019-05-01 18:25:14 -0700549 "libadbd",
550 "libadbd_services",
551 "libasyncio",
552 "libavb_user",
553 "libbase",
554 "libbootloader_message",
555 "libcap",
556 "libcrypto",
557 "libcrypto_utils",
558 "libcutils",
559 "libdiagnose_usb",
560 "libext4_utils",
561 "libfec",
562 "libfec_rs",
563 "libfs_mgr",
564 "liblog",
565 "liblp",
566 "libmdnssd",
567 "libminijail",
568 "libselinux",
569 "libsquashfs_utils",
570 ],
571}
572
573cc_binary {
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800574 name: "abb",
575
Josh Gao0560feb2019-01-22 19:36:15 -0800576 defaults: ["adbd_defaults"],
Alex Buynytskyyef34f012018-12-12 10:48:50 -0800577 recovery_available: false,
578
579 srcs: [
580 "daemon/abb.cpp",
581 ],
582
583 cflags: [
584 "-D_GNU_SOURCE",
585 "-Wno-deprecated-declarations",
586 ],
587
588 strip: {
589 keep_symbols: true,
590 },
591
592 static_libs: [
593 "libadbd_core",
594 "libadbd_services",
595 "libcmd",
596 ],
597
598 shared_libs: [
599 "libbase",
600 "libbinder",
601 "liblog",
602 "libutils",
603 "libselinux",
604 ],
605}
606
Josh Gao361148b2018-01-02 12:01:43 -0800607cc_test {
608 name: "adbd_test",
Josh Gao0560feb2019-01-22 19:36:15 -0800609 defaults: ["adbd_defaults"],
Josh Gao361148b2018-01-02 12:01:43 -0800610 srcs: libadb_test_srcs + [
Josh Gao5607e922018-07-25 18:15:52 -0700611 "daemon/services.cpp",
Josh Gao361148b2018-01-02 12:01:43 -0800612 "daemon/shell_service.cpp",
613 "daemon/shell_service_test.cpp",
614 "shell_service_protocol.cpp",
615 "shell_service_protocol_test.cpp",
616 ],
617
618 static_libs: [
619 "libadbd",
620 "libbase",
Josh Gao5607e922018-07-25 18:15:52 -0700621 "libbootloader_message",
Josh Gao361148b2018-01-02 12:01:43 -0800622 "libcutils",
623 "libcrypto_utils",
624 "libcrypto",
625 "libdiagnose_usb",
626 "liblog",
627 "libusb",
628 "libmdnssd",
Jiyong Park19c39fa2018-05-29 16:41:30 +0900629 "libselinux",
Josh Gao361148b2018-01-02 12:01:43 -0800630 ],
Elliott Hughesce226c92018-04-27 16:12:06 -0700631 test_suites: ["device-tests"],
Josh Gao361148b2018-01-02 12:01:43 -0800632}
633
Julien Desprezae94f512018-08-08 12:08:50 -0700634python_test_host {
Elliott Hughes307e7672018-02-16 17:58:14 -0800635 name: "adb_integration_test_adb",
636 main: "test_adb.py",
637 srcs: [
638 "test_adb.py",
639 ],
Julien Desprezae94f512018-08-08 12:08:50 -0700640 test_config: "adb_integration_test_adb.xml",
641 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800642 version: {
643 py2: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700644 enabled: false,
Elliott Hughes307e7672018-02-16 17:58:14 -0800645 },
646 py3: {
Josh Gaob1df00e2018-08-07 14:31:17 -0700647 enabled: true,
Elliott Hughes307e7672018-02-16 17:58:14 -0800648 },
GuangHui Liu35994392017-05-10 14:37:17 -0700649 },
GuangHui Liu35994392017-05-10 14:37:17 -0700650}
651
Julien Desprezcd11d0d2018-10-12 13:48:14 -0700652python_test_host {
Elliott Hughes307e7672018-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 Desprezcd11d0d2018-10-12 13:48:14 -0700661 test_config: "adb_integration_test_device.xml",
662 test_suites: ["general-tests"],
Elliott Hughes307e7672018-02-16 17:58:14 -0800663 version: {
664 py2: {
665 enabled: true,
666 },
667 py3: {
668 enabled: false,
669 },
GuangHui Liu35994392017-05-10 14:37:17 -0700670 },
GuangHui Liu35994392017-05-10 14:37:17 -0700671}
Joshua Gilpatrick0d384112019-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: [
693 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
694 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
695 "fastdeploy/proto/ApkEntry.proto",
696 ],
697 static_libs: [
698 "libadb_host",
699 "libandroidfw",
700 "libbase",
701 "libcutils",
702 "libcrypto_utils",
703 "libcrypto",
704 "libdiagnose_usb",
705 "liblog",
706 "libmdnssd",
707 "libusb",
708 "libutils",
709 "libziparchive",
710 "libz",
711 ],
712 stl: "libc++_static",
713 proto: {
714 type: "lite",
715 export_proto_headers: true,
716 },
717 target: {
718 windows: {
719 enabled: true,
720 shared_libs: ["AdbWinApi"],
721 },
722 },
723}
724
725cc_test_host {
726 name: "fastdeploy_test",
727 defaults: ["adb_defaults"],
728 srcs: [
729 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
730 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
731 ],
732 static_libs: [
733 "libadb_host",
734 "libandroidfw",
735 "libbase",
736 "libcutils",
737 "libcrypto_utils",
738 "libcrypto",
739 "libdiagnose_usb",
740 "libfastdeploy_host",
741 "liblog",
742 "libmdnssd",
743 "libprotobuf-cpp-lite",
744 "libusb",
745 "libutils",
746 "libziparchive",
747 "libz",
748 ],
749 target: {
750 windows: {
751 enabled: true,
752 shared_libs: ["AdbWinApi"],
753 },
754 },
755 data: [
756 "fastdeploy/testdata/rotating_cube-release.apk",
757 ],
758}