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