blob: bd1f124147320ab295e1cf1c9a1eb6020e1aed39 [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",
Yurii Zubrytskyi5dda7f62019-07-12 14:11:54 -0700137 "types.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800138]
139
140libadb_posix_srcs = [
141 "sysdeps_unix.cpp",
142 "sysdeps/posix/network.cpp",
143]
144
Josh Gaob43ad442019-07-11 13:47:44 -0700145libadb_linux_srcs = [
146 "fdevent/fdevent_epoll.cpp",
147]
148
Josh Gao27768452018-01-02 12:01:43 -0800149libadb_test_srcs = [
150 "adb_io_test.cpp",
151 "adb_listeners_test.cpp",
152 "adb_utils_test.cpp",
Josh Gao57e09b12019-06-28 13:50:37 -0700153 "fdevent/fdevent_test.cpp",
Josh Gao27768452018-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 Gao7c738cd2018-04-03 14:37:11 -0700159 "types_test.cpp",
Josh Gao27768452018-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 Willemsenab971b52018-08-29 14:58:02 -0700173 generated_headers: ["platform_tools_version"],
174
Josh Gao27768452018-01-02 12:01:43 -0800175 target: {
176 linux: {
Josh Gaob43ad442019-07-11 13:47:44 -0700177 srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
Josh Gao27768452018-01-02 12:01:43 -0800178 },
179 darwin: {
180 srcs: ["client/usb_osx.cpp"],
181 },
Josh Gao27768452018-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 Hamadi269a4b42018-09-13 18:00:25 +0100204 "libutils",
205 "liblog",
206 "libcutils",
Josh Gao27768452018-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 Gaof8a97c12018-03-23 15:37:20 -0700224
225 target: {
226 windows: {
227 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700228 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700229 shared_libs: ["AdbWinApi"],
230 },
231 },
Josh Gao27768452018-01-02 12:01:43 -0800232}
233
Josh Gao9c596492018-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",
Colin Crossf117f342019-09-18 11:04:35 -0700256 "libcrypto_static",
Josh Gao9c596492018-04-04 11:27:24 -0700257 "libdiagnose_usb",
258 "liblog",
259 "libusb",
260 ],
261}
262
Josh Gao27768452018-01-02 12:01:43 -0800263cc_binary_host {
264 name: "adb",
Josh Gao27768452018-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 Hamadied409ea2018-01-29 16:30:36 +0000275 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800276 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700277 "client/fastdeploy.cpp",
278 "client/fastdeploycallbacks.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800279 "shell_service_protocol.cpp",
280 ],
281
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700282 generated_headers: [
283 "bin2c_fastdeployagent",
284 "bin2c_fastdeployagentscript"
285 ],
286
Josh Gao27768452018-01-02 12:01:43 -0800287 static_libs: [
288 "libadb_host",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700289 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800290 "libbase",
291 "libcutils",
292 "libcrypto_utils",
293 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700294 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800295 "libdiagnose_usb",
296 "liblog",
297 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700298 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800299 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100300 "libutils",
301 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700302 "libziparchive",
303 "libz",
Josh Gao27768452018-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 Willemsen3f439a72018-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 Gao27768452018-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 Gao27768452018-01-02 12:01:43 -0800331 shared_libs: ["AdbWinApi"],
332 required: [
333 "AdbWinUsbApi",
334 ],
335 },
336 },
337}
338
Tao Baoeca59ae2018-07-30 20:45:27 -0700339// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800340cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700341 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800342 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-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 Gaob43ad442019-07-11 13:47:44 -0700348 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700349 "daemon/auth.cpp",
350 "daemon/jdwp_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700351 ],
352
353 local_include_dirs: [
354 "daemon/include",
355 ],
356
Dan Willemsenab971b52018-08-29 14:58:02 -0700357 generated_headers: ["platform_tools_version"],
358
Tao Baoeca59ae2018-07-30 20:45:27 -0700359 static_libs: [
360 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700361 ],
362
363 shared_libs: [
Josh Gao594f70f2019-08-15 14:05:12 -0700364 "libadbconnection_server",
Josh Gao27523262019-10-22 12:30:39 -0700365 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700366 "libasyncio",
367 "libbase",
368 "libcrypto",
369 "libcrypto_utils",
370 "libcutils",
371 "liblog",
372 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800373
374 target: {
375 android: {
376 whole_static_libs: [
377 "libqemu_pipe",
378 ],
379 srcs: [
380 "daemon/transport_qemu.cpp",
381 "daemon/usb.cpp",
382 "daemon/usb_ffs.cpp",
383 "daemon/usb_legacy.cpp",
384 ]
385 },
386 linux_glibc: {
387 srcs: [
388 "daemon/usb_dummy.cpp",
389 ]
390 }
391 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700392}
393
394cc_library {
395 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800396 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700397 recovery_available: true,
398 compile_multilib: "both",
399
400 srcs: [
401 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700402 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700403 "daemon/shell_service.cpp",
404 "shell_service_protocol.cpp",
405 ],
406
407 cflags: [
408 "-D_GNU_SOURCE",
409 "-Wno-deprecated-declarations",
410 ],
411
412 static_libs: [
413 "libadbd_core",
Tao Baoeca59ae2018-07-30 20:45:27 -0700414 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700415 ],
416
417 shared_libs: [
Josh Gao594f70f2019-08-15 14:05:12 -0700418 "libadbconnection_server",
Josh Gao27523262019-10-22 12:30:39 -0700419 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700420 "libasyncio",
421 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700422 "libcrypto",
423 "libcrypto_utils",
424 "libcutils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700425 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700426 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800427
428 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800429 android: {
430 srcs: [
431 "daemon/abb_service.cpp",
432 "daemon/framebuffer_service.cpp",
433 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800434 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800435 ],
436 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800437 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800438 "libselinux",
439 ],
440 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800441 recovery: {
442 exclude_srcs: [
443 "daemon/abb_service.cpp",
444 ],
445 },
446 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700447}
448
449cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800450 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800451 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900452 recovery_available: true,
Josh Gao27768452018-01-02 12:01:43 -0800453
Tao Baoeca59ae2018-07-30 20:45:27 -0700454 // Avoid getting duplicate symbol of android::build::GetBuildNumber().
455 use_version_lib: false,
456
457 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800458 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700459
460 // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
461 whole_static_libs: [
462 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800463 ],
464
Tao Baoeca59ae2018-07-30 20:45:27 -0700465 shared_libs: [
Josh Gao594f70f2019-08-15 14:05:12 -0700466 "libadbconnection_server",
Josh Gao27523262019-10-22 12:30:39 -0700467 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700468 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800469 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800470 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700471 "libcrypto",
472 "libcrypto_utils",
473 "libcutils",
474 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800475 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700476
477 export_include_dirs: [
478 "daemon/include",
479 ],
Josh Gao27768452018-01-02 12:01:43 -0800480}
481
482cc_binary {
483 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800484 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900485 recovery_available: true,
Josh Gao8db99f82018-03-06 12:57:27 -0800486
Josh Gao27768452018-01-02 12:01:43 -0800487 srcs: [
488 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800489 ],
490
491 cflags: [
492 "-D_GNU_SOURCE",
493 "-Wno-deprecated-declarations",
494 ],
495
496 strip: {
497 keep_symbols: true,
498 },
499
Josh Gao594f70f2019-08-15 14:05:12 -0700500 stl: "libc++_static",
501 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800502 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700503 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700504 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700505 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700506 "libbase",
507 "libcap",
Josh Gao594f70f2019-08-15 14:05:12 -0700508 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700509 "libcutils",
Josh Gao594f70f2019-08-15 14:05:12 -0700510 "libdiagnose_usb",
Josh Gao27768452018-01-02 12:01:43 -0800511 "liblog",
Josh Gao594f70f2019-08-15 14:05:12 -0700512 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800513 "libminijail",
514 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800515 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700516
517 shared_libs: [
518 "libadbconnection_server",
519 "libcrypto",
520 ],
Josh Gao27768452018-01-02 12:01:43 -0800521}
522
Josh Gao7b7ee192019-10-23 13:27:17 -0700523phony {
524 name: "adbd_system_binaries",
525 required: [
526 "abb",
Josh Gao27523262019-10-22 12:30:39 -0700527 "libadbd_auth",
Josh Gao2c356bb2019-10-22 12:30:36 -0700528 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700529 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700530 ]
531}
532
533phony {
534 name: "adbd_system_binaries_recovery",
535 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700536 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700537 ],
538}
539
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800540cc_binary {
541 name: "abb",
542
Josh Gao776c2ec2019-01-22 19:36:15 -0800543 defaults: ["adbd_defaults"],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800544 recovery_available: false,
545
546 srcs: [
547 "daemon/abb.cpp",
548 ],
549
550 cflags: [
551 "-D_GNU_SOURCE",
552 "-Wno-deprecated-declarations",
553 ],
554
555 strip: {
556 keep_symbols: true,
557 },
558
559 static_libs: [
560 "libadbd_core",
561 "libadbd_services",
562 "libcmd",
563 ],
564
565 shared_libs: [
566 "libbase",
567 "libbinder",
568 "liblog",
569 "libutils",
570 "libselinux",
571 ],
572}
573
Josh Gao27768452018-01-02 12:01:43 -0800574cc_test {
575 name: "adbd_test",
Josh Gao776c2ec2019-01-22 19:36:15 -0800576 defaults: ["adbd_defaults"],
Josh Gao27768452018-01-02 12:01:43 -0800577 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700578 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800579 "daemon/shell_service.cpp",
580 "daemon/shell_service_test.cpp",
581 "shell_service_protocol.cpp",
582 "shell_service_protocol_test.cpp",
583 ],
584
585 static_libs: [
586 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700587 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800588 "libbase",
589 "libcutils",
590 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700591 "libcrypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800592 "libdiagnose_usb",
593 "liblog",
594 "libusb",
595 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900596 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800597 ],
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700598 test_suites: ["device-tests"],
Dan Shid1360f42019-09-24 09:04:05 -0700599 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800600}
601
Julien Desprez75fea7e2018-08-08 12:08:50 -0700602python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800603 name: "adb_integration_test_adb",
604 main: "test_adb.py",
605 srcs: [
606 "test_adb.py",
607 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700608 test_config: "adb_integration_test_adb.xml",
609 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800610 version: {
611 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700612 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800613 },
614 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700615 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800616 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700617 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700618}
619
Julien Desprez618f0e12018-10-12 13:48:14 -0700620python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800621 name: "adb_integration_test_device",
622 main: "test_device.py",
623 srcs: [
624 "test_device.py",
625 ],
626 libs: [
627 "adb_py",
628 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700629 test_config: "adb_integration_test_device.xml",
630 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800631 version: {
632 py2: {
633 enabled: true,
634 },
635 py3: {
636 enabled: false,
637 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700638 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700639}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700640
641// Note: using pipe for xxd to control the variable name generated
642// the default name used by xxd is the path to the input file.
643java_genrule {
644 name: "bin2c_fastdeployagent",
645 out: ["deployagent.inc"],
646 srcs: [":deployagent"],
647 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
648}
649
650genrule {
651 name: "bin2c_fastdeployagentscript",
652 out: ["deployagentscript.inc"],
653 srcs: ["fastdeploy/deployagent/deployagent.sh"],
654 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
655}
656
657cc_library_host_static {
658 name: "libfastdeploy_host",
659 defaults: ["adb_defaults"],
660 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700661 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700662 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
663 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
664 "fastdeploy/proto/ApkEntry.proto",
665 ],
666 static_libs: [
667 "libadb_host",
668 "libandroidfw",
669 "libbase",
670 "libcutils",
671 "libcrypto_utils",
672 "libcrypto",
673 "libdiagnose_usb",
674 "liblog",
675 "libmdnssd",
676 "libusb",
677 "libutils",
678 "libziparchive",
679 "libz",
680 ],
681 stl: "libc++_static",
682 proto: {
683 type: "lite",
684 export_proto_headers: true,
685 },
686 target: {
687 windows: {
688 enabled: true,
689 shared_libs: ["AdbWinApi"],
690 },
691 },
692}
693
694cc_test_host {
695 name: "fastdeploy_test",
696 defaults: ["adb_defaults"],
697 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700698 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700699 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
700 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
701 ],
702 static_libs: [
703 "libadb_host",
704 "libandroidfw",
705 "libbase",
706 "libcutils",
707 "libcrypto_utils",
708 "libcrypto",
709 "libdiagnose_usb",
710 "libfastdeploy_host",
711 "liblog",
712 "libmdnssd",
713 "libprotobuf-cpp-lite",
714 "libusb",
715 "libutils",
716 "libziparchive",
717 "libz",
718 ],
719 target: {
720 windows: {
721 enabled: true,
722 shared_libs: ["AdbWinApi"],
723 },
724 },
725 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700726 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700727 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700728 "fastdeploy/testdata/sample.apk",
729 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700730 ],
731}
Josh Gao594f70f2019-08-15 14:05:12 -0700732
733prebuilt_etc {
734 name: "com.android.adbd.ld.config.txt",
735 src: "apex/ld.config.txt",
736 filename: "ld.config.txt",
737 installable: false,
738}
739
740apex {
741 name: "com.android.adbd",
742 manifest: "apex/apex_manifest.json",
743
744 binaries: ["adbd"],
745 prebuilts: ["com.android.adbd.init.rc", "com.android.adbd.ld.config.txt"],
746
747 key: "com.android.adbd.key",
748 certificate: ":com.android.adbd.certificate",
749}
750
751apex_key {
752 name: "com.android.adbd.key",
753 public_key: "apex/com.android.adbd.avbpubkey",
754 private_key: "apex/com.android.adbd.pem",
755}
756
757android_app_certificate {
758 name: "com.android.adbd.certificate",
759 certificate: "apex/com.android.adbd",
760}
761
762prebuilt_etc {
763 name: "com.android.adbd.init.rc",
764 src: "apex/adbd.rc",
765 filename: "init.rc",
766 installable: false,
767}