blob: 3e8da8ad6cc4e11ef56c5de556507b26bf7dad7a [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",
Tom Cherry99216302020-01-08 13:41:56 -0800220 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800221 "libmdnssd",
222 "libdiagnose_usb",
223 "libusb",
224 ],
Josh Gaof8a97c12018-03-23 15:37:20 -0700225
226 target: {
227 windows: {
228 enabled: true,
Josh Gaoefd8ae22019-07-16 15:08:42 -0700229 ldflags: ["-municode"],
Josh Gaof8a97c12018-03-23 15:37:20 -0700230 shared_libs: ["AdbWinApi"],
231 },
232 },
Josh Gao27768452018-01-02 12:01:43 -0800233}
234
Josh Gao9c596492018-04-04 11:27:24 -0700235cc_benchmark {
236 name: "adb_benchmark",
237 defaults: ["adb_defaults"],
238
239 srcs: ["transport_benchmark.cpp"],
240 target: {
241 android: {
242 static_libs: [
243 "libadbd",
244 ],
245 },
246 host: {
247 static_libs: [
248 "libadb_host",
249 ],
250 },
251 },
252
253 static_libs: [
254 "libbase",
255 "libcutils",
256 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700257 "libcrypto_static",
Josh Gao9c596492018-04-04 11:27:24 -0700258 "libdiagnose_usb",
259 "liblog",
260 "libusb",
261 ],
262}
263
Josh Gao27768452018-01-02 12:01:43 -0800264cc_binary_host {
265 name: "adb",
Josh Gao27768452018-01-02 12:01:43 -0800266
267 defaults: ["adb_defaults"],
268
269 srcs: [
270 "client/adb_client.cpp",
271 "client/bugreport.cpp",
272 "client/commandline.cpp",
273 "client/file_sync_client.cpp",
274 "client/main.cpp",
275 "client/console.cpp",
Idries Hamadied409ea2018-01-29 16:30:36 +0000276 "client/adb_install.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800277 "client/line_printer.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700278 "client/fastdeploy.cpp",
279 "client/fastdeploycallbacks.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800280 "shell_service_protocol.cpp",
281 ],
282
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700283 generated_headers: [
284 "bin2c_fastdeployagent",
285 "bin2c_fastdeployagentscript"
286 ],
287
Josh Gao27768452018-01-02 12:01:43 -0800288 static_libs: [
289 "libadb_host",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700290 "libandroidfw",
Josh Gao27768452018-01-02 12:01:43 -0800291 "libbase",
292 "libcutils",
293 "libcrypto_utils",
294 "libcrypto",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700295 "libfastdeploy_host",
Josh Gao27768452018-01-02 12:01:43 -0800296 "libdiagnose_usb",
297 "liblog",
298 "libmdnssd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700299 "libprotobuf-cpp-lite",
Josh Gao27768452018-01-02 12:01:43 -0800300 "libusb",
Idries Hamadi269a4b42018-09-13 18:00:25 +0100301 "libutils",
302 "liblog",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700303 "libziparchive",
304 "libz",
Josh Gao27768452018-01-02 12:01:43 -0800305 ],
306
307 stl: "libc++_static",
308
309 // Don't add anything here, we don't want additional shared dependencies
310 // on the host adb tool, and shared libraries that link against libc++
311 // will violate ODR
312 shared_libs: [],
313
Dan Willemsen3f439a72018-11-19 19:11:35 -0800314 // Archive adb, adb.exe.
315 dist: {
316 targets: [
317 "dist_files",
318 "sdk",
319 "win_sdk",
320 ],
321 },
322
Josh Gao27768452018-01-02 12:01:43 -0800323 target: {
324 darwin: {
325 cflags: [
326 "-Wno-sizeof-pointer-memaccess",
327 ],
328 },
329 windows: {
330 enabled: true,
331 ldflags: ["-municode"],
Josh Gao27768452018-01-02 12:01:43 -0800332 shared_libs: ["AdbWinApi"],
333 required: [
334 "AdbWinUsbApi",
335 ],
336 },
337 },
338}
339
Tao Baoeca59ae2018-07-30 20:45:27 -0700340// libadbd_core contains the common sources to build libadbd and libadbd_services.
Josh Gao27768452018-01-02 12:01:43 -0800341cc_library_static {
Tao Baoeca59ae2018-07-30 20:45:27 -0700342 name: "libadbd_core",
Josh Gao776c2ec2019-01-22 19:36:15 -0800343 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700344 recovery_available: true,
345
346 // libminadbd wants both, as it's used to build native tests.
347 compile_multilib: "both",
348
Josh Gaob43ad442019-07-11 13:47:44 -0700349 srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
Tao Baoeca59ae2018-07-30 20:45:27 -0700350 "daemon/auth.cpp",
351 "daemon/jdwp_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700352 ],
353
354 local_include_dirs: [
355 "daemon/include",
356 ],
357
Dan Willemsenab971b52018-08-29 14:58:02 -0700358 generated_headers: ["platform_tools_version"],
359
Tao Baoeca59ae2018-07-30 20:45:27 -0700360 static_libs: [
361 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700362 ],
363
364 shared_libs: [
Josh Gao594f70f2019-08-15 14:05:12 -0700365 "libadbconnection_server",
Josh Gao27523262019-10-22 12:30:39 -0700366 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700367 "libasyncio",
368 "libbase",
369 "libcrypto",
370 "libcrypto_utils",
371 "libcutils",
372 "liblog",
373 ],
Josh Gao776c2ec2019-01-22 19:36:15 -0800374
375 target: {
376 android: {
377 whole_static_libs: [
378 "libqemu_pipe",
379 ],
380 srcs: [
381 "daemon/transport_qemu.cpp",
382 "daemon/usb.cpp",
383 "daemon/usb_ffs.cpp",
384 "daemon/usb_legacy.cpp",
385 ]
386 },
387 linux_glibc: {
388 srcs: [
389 "daemon/usb_dummy.cpp",
390 ]
391 }
392 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700393}
394
395cc_library {
396 name: "libadbd_services",
Josh Gao776c2ec2019-01-22 19:36:15 -0800397 defaults: ["adbd_defaults", "host_adbd_supported"],
Tao Baoeca59ae2018-07-30 20:45:27 -0700398 recovery_available: true,
399 compile_multilib: "both",
400
401 srcs: [
402 "daemon/file_sync_service.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700403 "daemon/services.cpp",
Tao Baoeca59ae2018-07-30 20:45:27 -0700404 "daemon/shell_service.cpp",
405 "shell_service_protocol.cpp",
406 ],
407
408 cflags: [
409 "-D_GNU_SOURCE",
410 "-Wno-deprecated-declarations",
411 ],
412
413 static_libs: [
414 "libadbd_core",
Tao Baoeca59ae2018-07-30 20:45:27 -0700415 "libdiagnose_usb",
Tao Baoeca59ae2018-07-30 20:45:27 -0700416 ],
417
418 shared_libs: [
Josh Gao594f70f2019-08-15 14:05:12 -0700419 "libadbconnection_server",
Josh Gao27523262019-10-22 12:30:39 -0700420 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700421 "libasyncio",
422 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700423 "libcrypto",
424 "libcrypto_utils",
425 "libcutils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700426 "liblog",
Tao Baoeca59ae2018-07-30 20:45:27 -0700427 ],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800428
429 target: {
Josh Gao776c2ec2019-01-22 19:36:15 -0800430 android: {
431 srcs: [
432 "daemon/abb_service.cpp",
433 "daemon/framebuffer_service.cpp",
434 "daemon/mdns.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800435 "daemon/restart_service.cpp",
Josh Gao776c2ec2019-01-22 19:36:15 -0800436 ],
437 shared_libs: [
Josh Gao776c2ec2019-01-22 19:36:15 -0800438 "libmdnssd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800439 "libselinux",
440 ],
441 },
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800442 recovery: {
443 exclude_srcs: [
444 "daemon/abb_service.cpp",
445 ],
446 },
447 },
Tao Baoeca59ae2018-07-30 20:45:27 -0700448}
449
450cc_library {
Josh Gao27768452018-01-02 12:01:43 -0800451 name: "libadbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800452 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900453 recovery_available: true,
Josh Gao27768452018-01-02 12:01:43 -0800454
Tao Baoeca59ae2018-07-30 20:45:27 -0700455 // Avoid getting duplicate symbol of android::build::GetBuildNumber().
456 use_version_lib: false,
457
458 // libminadbd wants both, as it's used to build native tests.
Josh Gao27768452018-01-02 12:01:43 -0800459 compile_multilib: "both",
Tao Baoeca59ae2018-07-30 20:45:27 -0700460
461 // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library.
462 whole_static_libs: [
463 "libadbd_core",
Josh Gao27768452018-01-02 12:01:43 -0800464 ],
465
Tao Baoeca59ae2018-07-30 20:45:27 -0700466 shared_libs: [
Josh Gao594f70f2019-08-15 14:05:12 -0700467 "libadbconnection_server",
Josh Gao27523262019-10-22 12:30:39 -0700468 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700469 "libadbd_services",
Josh Gao27768452018-01-02 12:01:43 -0800470 "libasyncio",
Josh Gao27768452018-01-02 12:01:43 -0800471 "libbase",
Tao Baoeca59ae2018-07-30 20:45:27 -0700472 "libcrypto",
473 "libcrypto_utils",
474 "libcutils",
475 "liblog",
Josh Gao27768452018-01-02 12:01:43 -0800476 ],
Jerry Zhangb156c602018-05-07 15:14:47 -0700477
478 export_include_dirs: [
479 "daemon/include",
480 ],
Josh Gao27768452018-01-02 12:01:43 -0800481}
482
483cc_binary {
484 name: "adbd",
Josh Gao776c2ec2019-01-22 19:36:15 -0800485 defaults: ["adbd_defaults", "host_adbd_supported"],
Jiyong Parka0e75042018-05-24 14:11:00 +0900486 recovery_available: true,
Josh Gao8db99f82018-03-06 12:57:27 -0800487
Josh Gao27768452018-01-02 12:01:43 -0800488 srcs: [
489 "daemon/main.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800490 ],
491
492 cflags: [
493 "-D_GNU_SOURCE",
494 "-Wno-deprecated-declarations",
495 ],
496
497 strip: {
498 keep_symbols: true,
499 },
500
Josh Gao594f70f2019-08-15 14:05:12 -0700501 stl: "libc++_static",
502 static_libs: [
Josh Gao27768452018-01-02 12:01:43 -0800503 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700504 "libadbd_auth",
Tao Baoeca59ae2018-07-30 20:45:27 -0700505 "libadbd_services",
Josh Gao594f70f2019-08-15 14:05:12 -0700506 "libasyncio",
Tao Baoeca59ae2018-07-30 20:45:27 -0700507 "libbase",
508 "libcap",
Josh Gao594f70f2019-08-15 14:05:12 -0700509 "libcrypto_utils",
Tao Baoeca59ae2018-07-30 20:45:27 -0700510 "libcutils",
Josh Gao594f70f2019-08-15 14:05:12 -0700511 "libdiagnose_usb",
Josh Gao27768452018-01-02 12:01:43 -0800512 "liblog",
Josh Gao594f70f2019-08-15 14:05:12 -0700513 "libmdnssd",
Josh Gao27768452018-01-02 12:01:43 -0800514 "libminijail",
515 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800516 ],
Josh Gao594f70f2019-08-15 14:05:12 -0700517
518 shared_libs: [
519 "libadbconnection_server",
520 "libcrypto",
521 ],
Josh Gao27768452018-01-02 12:01:43 -0800522}
523
Josh Gao7b7ee192019-10-23 13:27:17 -0700524phony {
525 name: "adbd_system_binaries",
526 required: [
527 "abb",
Josh Gao27523262019-10-22 12:30:39 -0700528 "libadbd_auth",
Josh Gao2c356bb2019-10-22 12:30:36 -0700529 "reboot",
Josh Gaof61f4142019-10-22 12:30:30 -0700530 "set-verity-state",
Josh Gao7b7ee192019-10-23 13:27:17 -0700531 ]
532}
533
534phony {
535 name: "adbd_system_binaries_recovery",
536 required: [
Josh Gao2c356bb2019-10-22 12:30:36 -0700537 "reboot.recovery",
Josh Gao7b7ee192019-10-23 13:27:17 -0700538 ],
539}
540
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800541cc_binary {
542 name: "abb",
543
Josh Gao776c2ec2019-01-22 19:36:15 -0800544 defaults: ["adbd_defaults"],
Alex Buynytskyy640407d2018-12-12 10:48:50 -0800545 recovery_available: false,
546
547 srcs: [
548 "daemon/abb.cpp",
549 ],
550
551 cflags: [
552 "-D_GNU_SOURCE",
553 "-Wno-deprecated-declarations",
554 ],
555
556 strip: {
557 keep_symbols: true,
558 },
559
560 static_libs: [
561 "libadbd_core",
562 "libadbd_services",
563 "libcmd",
564 ],
565
566 shared_libs: [
567 "libbase",
568 "libbinder",
569 "liblog",
570 "libutils",
571 "libselinux",
572 ],
573}
574
Josh Gao27768452018-01-02 12:01:43 -0800575cc_test {
576 name: "adbd_test",
Josh Gao776c2ec2019-01-22 19:36:15 -0800577 defaults: ["adbd_defaults"],
Josh Gao27768452018-01-02 12:01:43 -0800578 srcs: libadb_test_srcs + [
Josh Gao997cfac2018-07-25 18:15:52 -0700579 "daemon/services.cpp",
Josh Gao27768452018-01-02 12:01:43 -0800580 "daemon/shell_service.cpp",
581 "daemon/shell_service_test.cpp",
582 "shell_service_protocol.cpp",
583 "shell_service_protocol_test.cpp",
584 ],
585
586 static_libs: [
587 "libadbd",
Josh Gao27523262019-10-22 12:30:39 -0700588 "libadbd_auth",
Josh Gao27768452018-01-02 12:01:43 -0800589 "libbase",
590 "libcutils",
591 "libcrypto_utils",
Colin Crossf117f342019-09-18 11:04:35 -0700592 "libcrypto_static",
Josh Gao27768452018-01-02 12:01:43 -0800593 "libdiagnose_usb",
594 "liblog",
595 "libusb",
596 "libmdnssd",
Jiyong Park011ee122018-05-29 16:41:30 +0900597 "libselinux",
Josh Gao27768452018-01-02 12:01:43 -0800598 ],
Elliott Hughes40fdf3f2018-04-27 16:12:06 -0700599 test_suites: ["device-tests"],
Dan Shid1360f42019-09-24 09:04:05 -0700600 require_root: true,
Josh Gao27768452018-01-02 12:01:43 -0800601}
602
Julien Desprez75fea7e2018-08-08 12:08:50 -0700603python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800604 name: "adb_integration_test_adb",
605 main: "test_adb.py",
606 srcs: [
607 "test_adb.py",
608 ],
Julien Desprez75fea7e2018-08-08 12:08:50 -0700609 test_config: "adb_integration_test_adb.xml",
610 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800611 version: {
612 py2: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700613 enabled: false,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800614 },
615 py3: {
Josh Gao9b6522b2018-08-07 14:31:17 -0700616 enabled: true,
Elliott Hughesdc699a22018-02-16 17:58:14 -0800617 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700618 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700619}
620
Julien Desprez618f0e12018-10-12 13:48:14 -0700621python_test_host {
Elliott Hughesdc699a22018-02-16 17:58:14 -0800622 name: "adb_integration_test_device",
623 main: "test_device.py",
624 srcs: [
625 "test_device.py",
626 ],
627 libs: [
628 "adb_py",
629 ],
Julien Desprez618f0e12018-10-12 13:48:14 -0700630 test_config: "adb_integration_test_device.xml",
631 test_suites: ["general-tests"],
Elliott Hughesdc699a22018-02-16 17:58:14 -0800632 version: {
633 py2: {
634 enabled: true,
635 },
636 py3: {
637 enabled: false,
638 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700639 },
GuangHui Liu41bda342017-05-10 14:37:17 -0700640}
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700641
642// Note: using pipe for xxd to control the variable name generated
643// the default name used by xxd is the path to the input file.
644java_genrule {
645 name: "bin2c_fastdeployagent",
646 out: ["deployagent.inc"],
647 srcs: [":deployagent"],
648 cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
649}
650
651genrule {
652 name: "bin2c_fastdeployagentscript",
653 out: ["deployagentscript.inc"],
654 srcs: ["fastdeploy/deployagent/deployagent.sh"],
655 cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
656}
657
658cc_library_host_static {
659 name: "libfastdeploy_host",
660 defaults: ["adb_defaults"],
661 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700662 "fastdeploy/deploypatchgenerator/apk_archive.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700663 "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
664 "fastdeploy/deploypatchgenerator/patch_utils.cpp",
665 "fastdeploy/proto/ApkEntry.proto",
666 ],
667 static_libs: [
668 "libadb_host",
669 "libandroidfw",
670 "libbase",
671 "libcutils",
672 "libcrypto_utils",
673 "libcrypto",
674 "libdiagnose_usb",
675 "liblog",
676 "libmdnssd",
677 "libusb",
678 "libutils",
679 "libziparchive",
680 "libz",
681 ],
682 stl: "libc++_static",
683 proto: {
684 type: "lite",
685 export_proto_headers: true,
686 },
687 target: {
688 windows: {
689 enabled: true,
690 shared_libs: ["AdbWinApi"],
691 },
692 },
693}
694
695cc_test_host {
696 name: "fastdeploy_test",
697 defaults: ["adb_defaults"],
698 srcs: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700699 "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700700 "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
701 "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
702 ],
703 static_libs: [
704 "libadb_host",
705 "libandroidfw",
706 "libbase",
707 "libcutils",
708 "libcrypto_utils",
709 "libcrypto",
710 "libdiagnose_usb",
711 "libfastdeploy_host",
712 "liblog",
713 "libmdnssd",
714 "libprotobuf-cpp-lite",
715 "libusb",
716 "libutils",
717 "libziparchive",
718 "libz",
719 ],
720 target: {
721 windows: {
722 enabled: true,
723 shared_libs: ["AdbWinApi"],
724 },
725 },
726 data: [
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700727 "fastdeploy/testdata/rotating_cube-metadata-release.data",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700728 "fastdeploy/testdata/rotating_cube-release.apk",
Alex Buynytskyy665f3ff2019-09-16 12:10:54 -0700729 "fastdeploy/testdata/sample.apk",
730 "fastdeploy/testdata/sample.cd",
Joshua Gilpatrickaf3ce082019-07-19 09:42:12 -0700731 ],
732}
Josh Gao594f70f2019-08-15 14:05:12 -0700733
734prebuilt_etc {
735 name: "com.android.adbd.ld.config.txt",
736 src: "apex/ld.config.txt",
737 filename: "ld.config.txt",
738 installable: false,
739}
740
741apex {
742 name: "com.android.adbd",
743 manifest: "apex/apex_manifest.json",
744
745 binaries: ["adbd"],
746 prebuilts: ["com.android.adbd.init.rc", "com.android.adbd.ld.config.txt"],
747
748 key: "com.android.adbd.key",
749 certificate: ":com.android.adbd.certificate",
750}
751
752apex_key {
753 name: "com.android.adbd.key",
754 public_key: "apex/com.android.adbd.avbpubkey",
755 private_key: "apex/com.android.adbd.pem",
756}
757
758android_app_certificate {
759 name: "com.android.adbd.certificate",
760 certificate: "apex/com.android.adbd",
761}
762
763prebuilt_etc {
764 name: "com.android.adbd.init.rc",
765 src: "apex/adbd.rc",
766 filename: "init.rc",
767 installable: false,
768}