1// 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
15package {
16    default_team: "trendy_team_native_tools_libraries",
17    default_applicable_licenses: ["packages_modules_adb_license"],
18}
19
20// Added automatically by a large-scale-change
21// See: http://go/android-license-faq
22license {
23    name: "packages_modules_adb_license",
24    visibility: [":__subpackages__"],
25    license_kinds: [
26        "SPDX-license-identifier-Apache-2.0",
27    ],
28    license_text: [
29        "NOTICE",
30    ],
31}
32
33tidy_errors = [
34    "-*",
35    "bugprone-inaccurate-erase",
36    "bugprone-use-after-move",
37]
38
39cc_defaults {
40    name: "adb_defaults",
41
42    cflags: [
43        "-Wall",
44        "-Wextra",
45        "-Werror",
46        "-Wexit-time-destructors",
47        "-Wno-non-virtual-dtor",
48        "-Wno-unused-parameter",
49        "-Wno-missing-field-initializers",
50        "-Wthread-safety",
51        "-Wvla",
52        "-DADB_HOST=1", // overridden by adbd_defaults
53        "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1",
54    ],
55    cpp_std: "experimental",
56
57    use_version_lib: true,
58    compile_multilib: "first",
59
60    target: {
61        darwin: {
62            host_ldlibs: [
63                "-lpthread",
64                "-framework CoreFoundation",
65                "-framework IOKit",
66                "-framework Security",
67                "-lobjc",
68            ],
69            cflags: [
70                // Required, to use the new IPv6 Sockets options introduced by RFC 3542.
71                "-D__APPLE_USE_RFC_3542",
72            ],
73        },
74
75        windows: {
76            cflags: [
77                // Define windows.h and tchar.h Unicode preprocessor symbols so that
78                // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the
79                // build if you accidentally pass char*. Fix by calling like:
80                //   std::wstring path_wide;
81                //   if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ }
82                //   CreateFileW(path_wide.c_str());
83                "-DUNICODE=1",
84                "-D_UNICODE=1",
85
86                // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows.
87                "-D_GNU_SOURCE",
88
89                // MinGW hides some things behind _POSIX_SOURCE.
90                "-D_POSIX_SOURCE",
91
92                // libusb uses __stdcall on a variadic function, which gets ignored.
93                "-Wno-ignored-attributes",
94
95                // Not supported yet.
96                "-Wno-thread-safety",
97            ],
98
99            host_ldlibs: [
100                "-lws2_32",
101                "-lgdi32",
102                "-luserenv",
103                "-liphlpapi",
104            ],
105        },
106    },
107
108    tidy: true,
109    tidy_checks: tidy_errors,
110    tidy_checks_as_errors: tidy_errors,
111}
112
113cc_defaults {
114    name: "adbd_defaults",
115    defaults: ["adb_defaults"],
116
117    cflags: [
118        "-UADB_HOST",
119        "-DADB_HOST=0",
120    ],
121}
122
123cc_defaults {
124    name: "host_adbd_supported",
125
126    host_supported: true,
127    target: {
128        linux: {
129            enabled: true,
130            host_ldlibs: [
131                "-lresolv", // b64_pton
132                "-lutil", // forkpty
133            ],
134        },
135        darwin: {
136            enabled: false,
137        },
138        windows: {
139            enabled: false,
140        },
141    },
142}
143
144soong_config_module_type_import {
145    from: "system/apex/Android.bp",
146    module_types: ["library_linking_strategy_cc_defaults"],
147}
148
149library_linking_strategy_cc_defaults {
150    name: "libadbd_binary_dependencies",
151    static_libs: [
152        "libadb_crypto",
153        "libadb_pairing_connection",
154        "libadb_protos",
155        "libadb_sysdeps",
156        "libadb_tls_connection",
157        "libadbconnection_server",
158        "libadbd",
159        "libadbd_core",
160        "libapp_processes_protos_lite",
161        "libasyncio",
162        "libbrotli",
163        "libcrypto_utils",
164        "libcutils_sockets",
165        "libdiagnose_usb",
166        "libmdnssd",
167        "libprotobuf-cpp-lite",
168        "libzstd",
169    ],
170
171    shared_libs: [
172        "libadbd_auth",
173        "libadbd_fs",
174        "liblog",
175        "libselinux",
176    ],
177
178    soong_config_variables: {
179        library_linking_strategy: {
180            prefer_static: {
181                static_libs: [
182                    "libbase",
183                ],
184            },
185            conditions_default: {
186                shared_libs: [
187                    "libbase",
188                ],
189            },
190        },
191    },
192
193    target: {
194        android: {
195            shared_libs: ["libcrypto"],
196        },
197        host_linux: {
198            static_libs: ["libcrypto_static"],
199        },
200        recovery: {
201            exclude_static_libs: [
202                "libadb_pairing_auth",
203                "libadb_pairing_connection",
204            ],
205        },
206    },
207}
208
209// libadb
210// =========================================================
211// These files are compiled for both the host and the device.
212libadb_srcs = [
213    "adb.cpp",
214    "adb_io.cpp",
215    "adb_listeners.cpp",
216    "adb_mdns.cpp",
217    "adb_trace.cpp",
218    "adb_unique_fd.cpp",
219    "adb_utils.cpp",
220    "apacket_reader.cpp",
221    "fdevent/fdevent.cpp",
222    "services.cpp",
223    "sockets.cpp",
224    "socket_spec.cpp",
225    "sysdeps/env.cpp",
226    "sysdeps/errno.cpp",
227    "transport.cpp",
228    "transport_fd.cpp",
229    "types.cpp",
230]
231
232libadb_darwin_srcs = [
233    "fdevent/fdevent_poll.cpp",
234]
235
236libadb_windows_srcs = [
237    "fdevent/fdevent_poll.cpp",
238    "sysdeps_win32.cpp",
239    "sysdeps/win32/errno.cpp",
240    "sysdeps/win32/stat.cpp",
241]
242
243libadb_posix_srcs = [
244    "sysdeps_unix.cpp",
245    "sysdeps/posix/network.cpp",
246]
247
248libadb_linux_srcs = [
249    "fdevent/fdevent_epoll.cpp",
250]
251
252libadb_test_srcs = [
253    "adb_io_test.cpp",
254    "adb_listeners_test.cpp",
255    "adb_utils_test.cpp",
256    "fdevent/fdevent_test.cpp",
257    "shell_service_protocol.cpp",
258    "socket_spec_test.cpp",
259    "socket_test.cpp",
260    "sysdeps_test.cpp",
261    "sysdeps/stat_test.cpp",
262    "transport_test.cpp",
263    "types_test.cpp",
264]
265
266cc_library_host_static {
267    name: "libadb_host",
268    defaults: ["adb_defaults"],
269
270    srcs: libadb_srcs + [
271        "client/openscreen/mdns_service_info.cpp",
272        "client/openscreen/mdns_service_watcher.cpp",
273        "client/openscreen/platform/logging.cpp",
274        "client/openscreen/platform/task_runner.cpp",
275        "client/openscreen/platform/udp_socket.cpp",
276        "client/auth.cpp",
277        "client/adb_wifi.cpp",
278        "client/usb_libusb.cpp",
279        "client/transport_emulator.cpp",
280        "client/mdnsresponder_client.cpp",
281        "client/mdns_utils.cpp",
282        "client/transport_mdns.cpp",
283        "client/transport_usb.cpp",
284        "client/pairing/pairing_client.cpp",
285    ],
286
287    generated_headers: ["platform_tools_version"],
288
289    target: {
290        linux: {
291            srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs,
292        },
293        darwin: {
294            srcs: ["client/usb_osx.cpp"] + libadb_darwin_srcs,
295        },
296        not_windows: {
297            srcs: libadb_posix_srcs,
298        },
299        windows: {
300            enabled: true,
301            srcs: [
302                "client/usb_windows.cpp",
303            ] + libadb_windows_srcs,
304            shared_libs: ["AdbWinApi"],
305        },
306    },
307
308    static_libs: [
309        "libadb_crypto",
310        "libadb_host_protos",
311        "libadb_pairing_connection",
312        "libadb_protos",
313        "libadb_tls_connection",
314        "libbase",
315        "libcrypto",
316        "libcrypto_utils",
317        "libcutils",
318        "libdiagnose_usb",
319        "liblog",
320        "libmdnssd",
321        "libopenscreen-discovery",
322        "libopenscreen-platform-impl",
323        "libprotobuf-cpp-lite",
324        "libusb",
325        "libutils",
326    ],
327}
328
329cc_library {
330    name: "libadb_sysdeps",
331    defaults: ["adb_defaults"],
332    recovery_available: true,
333    host_supported: true,
334    compile_multilib: "both",
335    min_sdk_version: "apex_inherit",
336    // This library doesn't use build::GetBuildNumber()
337    use_version_lib: false,
338
339    srcs: [
340        "sysdeps/env.cpp",
341    ],
342
343    shared_libs: [
344        "libbase",
345        "liblog",
346    ],
347
348    target: {
349        windows: {
350            enabled: true,
351            ldflags: ["-municode"],
352        },
353    },
354
355    export_include_dirs: ["."],
356
357    visibility: [
358        "//bootable/recovery/minadbd:__subpackages__",
359        "//packages/modules/adb:__subpackages__",
360    ],
361
362    apex_available: [
363        "com.android.adbd",
364        "test_com.android.adbd",
365    ],
366}
367
368cc_test_host {
369    name: "adb_test",
370    defaults: ["adb_defaults"],
371    srcs: libadb_test_srcs + [
372        "client/mdns_utils_test.cpp",
373        "test_utils/test_utils.cpp",
374    ],
375
376    static_libs: [
377        "libadb_crypto_static",
378        "libadb_host",
379        "libadb_host_protos",
380        "libadb_pairing_auth_static",
381        "libadb_pairing_connection_static",
382        "libadb_protos_static",
383        "libadb_sysdeps",
384        "libadb_tls_connection_static",
385        "libbase",
386        "libcrypto",
387        "libcrypto_utils",
388        "libcutils",
389        "libdiagnose_usb",
390        "liblog",
391        "libmdnssd",
392        "libopenscreen-discovery",
393        "libopenscreen-platform-impl",
394        "libprotobuf-cpp-full",
395        "libssl",
396        "libusb",
397    ],
398
399    target: {
400        windows: {
401            enabled: true,
402            ldflags: ["-municode"],
403            shared_libs: ["AdbWinApi"],
404        },
405        // TODO: Create an asan_default rule and use it for adb_asan target
406        // and ALL unit tests.
407        linux: {
408            sanitize: {
409                address: true,
410            },
411            strip: {
412                none: true,
413            },
414        },
415        darwin: {
416            sanitize: {
417                address: true,
418            },
419            strip: {
420                none: true,
421            },
422        },
423    },
424
425    test_options: {
426        // TODO(b/247985207) remove "no-remote" tag when b/247985207 is fixed.
427        tags: ["no-remote"],
428    },
429}
430
431cc_defaults {
432    name: "adb_binary_host_defaults",
433
434    stl: "libc++_static",
435    defaults: ["adb_defaults"],
436
437    srcs: [
438        "client/adb_client.cpp",
439        "client/bugreport.cpp",
440        "client/commandline.cpp",
441        "client/file_sync_client.cpp",
442        "client/main.cpp",
443        "client/console.cpp",
444        "client/adb_install.cpp",
445        "client/line_printer.cpp",
446        "client/fastdeploy.cpp",
447        "client/fastdeploycallbacks.cpp",
448        "client/incremental.cpp",
449        "client/incremental_server.cpp",
450        "client/incremental_utils.cpp",
451        "shell_service_protocol.cpp",
452    ],
453
454    device_first_generated_headers: [
455        "bin2c_fastdeployagent",
456        "bin2c_fastdeployagentscript",
457    ],
458
459    static_libs: [
460        "libadb_crypto",
461        "libadb_host",
462        "libadb_host_protos",
463        "libadb_pairing_auth",
464        "libadb_pairing_connection",
465        "libadb_protos",
466        "libadb_sysdeps",
467        "libadb_tls_connection",
468        "libandroidfw",
469        "libapp_processes_protos_full",
470        "libbase",
471        "libbrotli",
472        "libcrypto",
473        "libcrypto_utils",
474        "libcutils",
475        "libdiagnose_usb",
476        "libfastdeploy_host",
477        "liblog",
478        "liblog",
479        "liblz4",
480        "libmdnssd",
481        "libopenscreen-discovery",
482        "libopenscreen-platform-impl",
483        "libprotobuf-cpp-full",
484        "libssl",
485        "libusb",
486        "libutils",
487        "libz",
488        "libziparchive",
489        "libzstd",
490    ],
491
492    // Don't add anything here, we don't want additional shared dependencies
493    // on the host adb tool, and shared libraries that link against libc++
494    // will violate ODR
495    shared_libs: [],
496
497    // Archive adb, adb.exe.
498    dist: {
499        targets: [
500            "dist_files",
501            "sdk",
502            "sdk-repo-platform-tools",
503            "sdk_repo",
504            "win_sdk",
505        ],
506    },
507
508    target: {
509        darwin: {
510            cflags: [
511                "-Wno-sizeof-pointer-memaccess",
512            ],
513        },
514        windows: {
515            enabled: true,
516            ldflags: ["-municode"],
517            shared_libs: ["AdbWinApi"],
518            required: [
519                "AdbWinUsbApi",
520            ],
521        },
522    },
523}
524
525cc_binary_host {
526    name: "adb",
527    defaults: ["adb_binary_host_defaults"],
528}
529
530cc_binary_host {
531    name: "adb_asan",
532    defaults: ["adb_binary_host_defaults"],
533    target: {
534        darwin: {
535            sanitize: {
536                address: true,
537            },
538            strip: {
539                none: true,
540            },
541        },
542        linux: {
543            sanitize: {
544                address: true,
545            },
546            strip: {
547                none: true,
548            },
549        },
550        // Not supported on Windows yet...
551        windows: {
552            enabled: false,
553        },
554    },
555}
556
557// libadbd_core contains the common sources to build libadbd and libadbd_services.
558cc_library_static {
559    name: "libadbd_core",
560    defaults: [
561        "adbd_defaults",
562        "host_adbd_supported",
563    ],
564    recovery_available: true,
565
566    // libminadbd wants both, as it's used to build native tests.
567    compile_multilib: "both",
568
569    srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [
570        "daemon/adb_wifi.cpp",
571        "daemon/auth.cpp",
572        "daemon/jdwp_service.cpp",
573        "daemon/logging.cpp",
574        "daemon/transport_socket_server.cpp",
575    ],
576
577    generated_headers: ["platform_tools_version"],
578
579    static_libs: [
580        "libdiagnose_usb",
581    ],
582
583    shared_libs: [
584        "libadb_crypto",
585        "libadb_pairing_connection",
586        "libadb_protos",
587        "libadb_tls_connection",
588        "libadbconnection_server",
589        "libadbd_auth",
590        "libapp_processes_protos_lite",
591        "libasyncio",
592        "libbase",
593        "libcrypto",
594        "libcrypto_utils",
595        "libcutils_sockets",
596        "liblog",
597    ],
598
599    proto: {
600        type: "lite",
601        static: true,
602        export_proto_headers: true,
603    },
604
605    target: {
606        android: {
607            srcs: [
608                "daemon/property_monitor.cpp",
609                "daemon/usb.cpp",
610                "daemon/usb_ffs.cpp",
611                "daemon/watchdog.cpp",
612            ],
613        },
614        recovery: {
615            exclude_shared_libs: [
616                "libadb_pairing_auth",
617                "libadb_pairing_connection",
618                "libapp_processes_protos_lite",
619            ],
620        },
621    },
622
623    min_sdk_version: "30",
624    apex_available: [
625        "//apex_available:platform",
626        "com.android.adbd",
627    ],
628    visibility: [
629        "//bootable/recovery/minadbd",
630        "//packages/modules/adb:__subpackages__",
631    ],
632}
633
634cc_library {
635    name: "libadbd_services",
636    defaults: [
637        "adbd_defaults",
638        "host_adbd_supported",
639    ],
640    recovery_available: true,
641    compile_multilib: "both",
642
643    // avoid getting duplicate symbol of android::build::getbuildnumber().
644    use_version_lib: false,
645
646    srcs: [
647        "daemon/file_sync_service.cpp",
648        "daemon/services.cpp",
649        "daemon/shell_service.cpp",
650        "daemon/tradeinmode.cpp",
651        "shell_service_protocol.cpp",
652    ],
653
654    cflags: [
655        "-D_GNU_SOURCE",
656        "-Wno-deprecated-declarations",
657    ],
658
659    static_libs: [
660        "libadbconnection_server",
661        "libadbd_core",
662        "libbrotli",
663        "libdiagnose_usb",
664        "liblz4",
665        "libprotobuf-cpp-lite",
666        "libzstd",
667    ],
668
669    shared_libs: [
670        "libadb_crypto",
671        "libadb_pairing_connection",
672        "libadb_protos",
673        "libadb_tls_connection",
674        "libapp_processes_protos_lite",
675        "libasyncio",
676        "libbase",
677        "libcrypto_utils",
678        "libcutils_sockets",
679
680        // APEX dependencies.
681        "libadbd_auth",
682        "libadbd_fs",
683        "libcrypto",
684        "liblog",
685    ],
686
687    target: {
688        android: {
689            srcs: [
690                "daemon/abb_service.cpp",
691                "daemon/framebuffer_service.cpp",
692                "daemon/mdns.cpp",
693                "daemon/restart_service.cpp",
694            ],
695            shared_libs: [
696                "libmdnssd",
697                "libselinux",
698            ],
699            static_libs: [
700                "android_trade_in_mode_flags_cc_lib",
701            ],
702        },
703        recovery: {
704            exclude_srcs: [
705                "daemon/abb_service.cpp",
706            ],
707            exclude_shared_libs: [
708                "libadb_pairing_auth",
709                "libadb_pairing_connection",
710            ],
711            exclude_static_libs: [
712                "android_trade_in_mode_flags_cc_lib",
713            ],
714        },
715    },
716
717    min_sdk_version: "30",
718    apex_available: [
719        "//apex_available:platform",
720        "com.android.adbd",
721    ],
722    visibility: [
723        "//packages/modules/adb",
724    ],
725
726}
727
728cc_library {
729    name: "libadbd",
730    defaults: [
731        "adbd_defaults",
732        "host_adbd_supported",
733    ],
734    recovery_available: true,
735    min_sdk_version: "30",
736    apex_available: ["com.android.adbd"],
737
738    // avoid getting duplicate symbol of android::build::getbuildnumber().
739    use_version_lib: false,
740
741    // libminadbd wants both, as it's used to build native tests.
742    compile_multilib: "both",
743
744    static_libs: [
745        "libadbd_core",
746        "libadbd_services",
747        "libbrotli",
748        "libcutils_sockets",
749        "libdiagnose_usb",
750        "liblz4",
751        "libmdnssd",
752        "libprotobuf-cpp-lite",
753        "libzstd",
754    ],
755
756    shared_libs: [
757        "libadbconnection_server",
758        "libapp_processes_protos_lite",
759        "libadb_crypto",
760        "libadb_pairing_connection",
761        "libadb_tls_connection",
762        "libasyncio",
763        "libbase",
764        "libcrypto",
765        "libcrypto_utils",
766        "liblog",
767        "libselinux",
768
769        // APEX dependencies on the system image.
770        "libadbd_auth",
771        "libadbd_fs",
772    ],
773
774    target: {
775        recovery: {
776            exclude_shared_libs: [
777                "libadb_pairing_auth",
778                "libadb_pairing_connection",
779            ],
780        },
781    },
782
783    visibility: [
784        "//bootable/recovery/minadbd",
785        "//packages/modules/adb",
786    ],
787}
788
789cc_defaults {
790    name: "adbd_binary_defaults",
791    defaults: [
792        "adbd_defaults",
793        "libadbd_binary_dependencies",
794    ],
795    min_sdk_version: "30",
796    apex_available: ["com.android.adbd"],
797
798    srcs: [
799        "daemon/main.cpp",
800    ],
801
802    cflags: [
803        "-D_GNU_SOURCE",
804        "-Wno-deprecated-declarations",
805    ],
806
807    strip: {
808        keep_symbols: true,
809    },
810
811    static_libs: [
812        "libadb_protos",
813        "libadbd",
814        "libadbd_services",
815        "libasyncio",
816        "libcap",
817        "liblz4",
818        "libminijail",
819        "libssl",
820    ],
821
822    shared_libs: [
823        "libadbd_auth",
824    ],
825}
826
827cc_binary {
828    name: "adbd",
829    defaults: [
830        "host_adbd_supported",
831        "adbd_binary_defaults",
832    ],
833    target: {
834        android: {
835            static_libs: [
836                "android_trade_in_mode_flags_cc_lib",
837            ],
838        },
839    },
840}
841
842cc_binary {
843    name: "adbd.recovery",
844    defaults: [
845        "adbd_binary_defaults",
846    ],
847    recovery: true,
848    stem: "adbd",
849}
850
851phony {
852    // Interface between adbd in a module and the system.
853    name: "adbd_system_api",
854    required: [
855        "libadbd_auth",
856        "libadbd_fs",
857        "abb",
858        "reboot",
859    ],
860    product_variables: {
861        debuggable: {
862            required: [
863                "remount",
864            ],
865        },
866    },
867}
868
869phony {
870    name: "adbd_system_api_recovery",
871    required: [
872        "libadbd_auth.recovery",
873        "libadbd_fs.recovery",
874        "reboot.recovery",
875    ],
876}
877
878cc_binary {
879    name: "abb",
880
881    defaults: ["adbd_defaults"],
882    stl: "libc++",
883    recovery_available: false,
884
885    srcs: [
886        "daemon/abb.cpp",
887    ],
888
889    cflags: [
890        "-D_GNU_SOURCE",
891        "-Wno-deprecated-declarations",
892    ],
893
894    strip: {
895        keep_symbols: true,
896    },
897
898    static_libs: [
899        "libadbd_core",
900        "libadbd_services",
901        "libcmd",
902    ],
903
904    shared_libs: [
905        "libbase",
906        "libbinder",
907        "liblog",
908        "libutils",
909        "libselinux",
910    ],
911}
912
913ADBD_TEST_LIBS = [
914    "libadbd",
915    "libadbd_auth",
916    "libbase",
917    "libusb",
918]
919
920cc_test {
921    name: "adbd_test",
922
923    defaults: [
924        "adbd_defaults",
925        "libadbd_binary_dependencies",
926    ],
927
928    recovery_available: false,
929    srcs: libadb_test_srcs + [
930        "daemon/restart_service.cpp",
931        "daemon/restart_service_test.cpp",
932        "daemon/services.cpp",
933        "daemon/shell_service.cpp",
934        "daemon/shell_service_test.cpp",
935        "daemon/tradeinmode.cpp",
936        "daemon/tradeinmode_test.cpp",
937        "test_utils/test_utils.cpp",
938        "shell_service_protocol_test.cpp",
939        "mdns_test.cpp",
940    ],
941
942    test_config: "adbd_test.xml",
943
944    target: {
945        android: {
946            srcs: [
947                "daemon/property_monitor_test.cpp",
948            ],
949            static_libs: [
950                "android_trade_in_mode_flags_cc_lib",
951            ],
952        },
953    },
954
955    shared_libs: [
956        "liblog",
957    ],
958
959    version_script: "adbd_test.map",
960    stl: "libc++_static",
961    static_libs: ADBD_TEST_LIBS,
962
963    // Shared lib versions of static libs can potentially come from
964    // libadbd_binary_dependencies (e.g. libbase as a shared_lib, depending on
965    // library_linking_strategy), which will cause both shared/static versions of
966    // the same library to be in the link action.
967    //
968    // adbd_test uses the static version of these libraries above, so exclude them here.
969    exclude_shared_libs: ADBD_TEST_LIBS,
970
971    test_suites: [
972        "general-tests",
973        "mts-adbd",
974    ],
975    require_root: true,
976}
977
978python_test_host {
979    name: "adb_integration_test_adb",
980    main: "test_adb.py",
981    srcs: [
982        "test_adb.py",
983    ],
984    test_config: "adb_integration_test_adb.xml",
985    test_suites: ["general-tests"],
986    test_options: {
987        unit_test: false,
988    },
989}
990
991python_test_host {
992    name: "adb_integration_test_device",
993    main: "test_device.py",
994    srcs: [
995        "proto/app_processes.proto",
996        ":adb_host_proto",
997        "test_device.py",
998    ],
999    proto: {
1000        canonical_path_from_root: false,
1001    },
1002    libs: [
1003        "adb_py",
1004        "libprotobuf-python",
1005    ],
1006    test_config: "adb_integration_test_device.xml",
1007    test_suites: ["general-tests"],
1008    test_options: {
1009        unit_test: false,
1010    },
1011    device_common_data: [
1012        ":adb_test_app1",
1013        ":adb_test_app2",
1014    ],
1015}
1016
1017// Note: using pipe for xxd to control the variable name generated
1018// the default name used by xxd is the path to the input file.
1019java_genrule {
1020    name: "bin2c_fastdeployagent",
1021    out: ["deployagent.inc"],
1022    srcs: [":deployagent"],
1023    cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)",
1024}
1025
1026genrule {
1027    name: "bin2c_fastdeployagentscript",
1028    out: ["deployagentscript.inc"],
1029    srcs: ["fastdeploy/deployagent/deployagent.sh"],
1030    cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)",
1031}
1032
1033cc_library_host_static {
1034    name: "libfastdeploy_host",
1035    defaults: ["adb_defaults"],
1036    srcs: [
1037        "fastdeploy/deploypatchgenerator/apk_archive.cpp",
1038        "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp",
1039        "fastdeploy/deploypatchgenerator/patch_utils.cpp",
1040        "fastdeploy/proto/ApkEntry.proto",
1041    ],
1042    static_libs: [
1043        "libadb_host",
1044        "libandroidfw",
1045        "libbase",
1046        "libcrypto",
1047        "libcrypto_utils",
1048        "libcutils",
1049        "libdiagnose_usb",
1050        "liblog",
1051        "libmdnssd",
1052        "libusb",
1053        "libutils",
1054        "libz",
1055        "libziparchive",
1056    ],
1057    proto: {
1058        type: "lite",
1059        export_proto_headers: true,
1060    },
1061    target: {
1062        windows: {
1063            enabled: true,
1064            shared_libs: ["AdbWinApi"],
1065        },
1066    },
1067}
1068
1069cc_test_host {
1070    name: "fastdeploy_test",
1071    defaults: ["adb_defaults"],
1072    srcs: [
1073        "fastdeploy/deploypatchgenerator/apk_archive_test.cpp",
1074        "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp",
1075        "fastdeploy/deploypatchgenerator/patch_utils_test.cpp",
1076    ],
1077    static_libs: [
1078        "libadb_crypto_static",
1079        "libadb_host",
1080        "libadb_host_protos",
1081        "libadb_pairing_auth_static",
1082        "libadb_pairing_connection_static",
1083        "libadb_protos_static",
1084        "libadb_sysdeps",
1085        "libadb_tls_connection_static",
1086        "libandroidfw",
1087        "libbase",
1088        "libcrypto",
1089        "libcrypto_utils",
1090        "libcutils",
1091        "libdiagnose_usb",
1092        "libfastdeploy_host",
1093        "liblog",
1094        "libmdnssd",
1095        "libopenscreen-discovery",
1096        "libopenscreen-platform-impl",
1097        "libprotobuf-cpp-full",
1098        "libssl",
1099        "libusb",
1100        "libutils",
1101        "libz",
1102        "libziparchive",
1103    ],
1104    target: {
1105        windows: {
1106            enabled: true,
1107            shared_libs: ["AdbWinApi"],
1108        },
1109    },
1110    data: [
1111        "fastdeploy/testdata/rotating_cube-metadata-release.data",
1112        "fastdeploy/testdata/rotating_cube-release.apk",
1113        "fastdeploy/testdata/sample.apk",
1114        "fastdeploy/testdata/sample.cd",
1115    ],
1116}
1117