GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 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 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 15 | cc_defaults { |
| 16 | name: "adb_defaults", |
| 17 | |
| 18 | cflags: [ |
| 19 | "-Wall", |
| 20 | "-Wextra", |
| 21 | "-Werror", |
Pirama Arumuga Nainar | 7982178 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 22 | "-Wexit-time-destructors", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 23 | "-Wno-unused-parameter", |
| 24 | "-Wno-missing-field-initializers", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 25 | "-Wthread-safety", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 26 | "-Wvla", |
Bowgo Tsai | 9b30c0a | 2019-03-12 04:25:33 +0800 | [diff] [blame] | 27 | "-DADB_HOST=1", // overridden by adbd_defaults |
| 28 | "-DALLOW_ADBD_ROOT=0", // overridden by adbd_defaults |
Josh Gao | 27241a7 | 2019-04-25 14:04:57 -0700 | [diff] [blame] | 29 | "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 30 | ], |
Josh Gao | 6eb7882 | 2018-11-16 15:40:16 -0800 | [diff] [blame] | 31 | cpp_std: "experimental", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 32 | |
Josh Gao | c7567fa | 2018-02-27 15:49:23 -0800 | [diff] [blame] | 33 | use_version_lib: true, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 34 | compile_multilib: "first", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 35 | |
| 36 | target: { |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 37 | 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 Hughes | 3c59cb8 | 2018-12-03 09:02:18 -0800 | [diff] [blame] | 57 | // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows. |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 58 | "-D_GNU_SOURCE", |
Josh Gao | 2e1e789 | 2018-03-23 13:03:28 -0700 | [diff] [blame] | 59 | |
| 60 | // MinGW hides some things behind _POSIX_SOURCE. |
| 61 | "-D_POSIX_SOURCE", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 62 | |
Josh Gao | 4710e53 | 2019-04-17 16:57:43 -0700 | [diff] [blame] | 63 | // libusb uses __stdcall on a variadic function, which gets ignored. |
| 64 | "-Wno-ignored-attributes", |
| 65 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 66 | // Not supported yet. |
| 67 | "-Wno-thread-safety", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 68 | ], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 69 | |
| 70 | host_ldlibs: [ |
| 71 | "-lws2_32", |
| 72 | "-lgdi32", |
| 73 | "-luserenv", |
| 74 | ], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 75 | }, |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 76 | }, |
| 77 | } |
Pirama Arumuga Nainar | 7982178 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 78 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 79 | cc_defaults { |
| 80 | name: "adbd_defaults", |
| 81 | defaults: ["adb_defaults"], |
| 82 | |
| 83 | cflags: ["-UADB_HOST", "-DADB_HOST=0"], |
| 84 | product_variables: { |
| 85 | debuggable: { |
Pirama Arumuga Nainar | 7982178 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 86 | cflags: [ |
Bowgo Tsai | 9b30c0a | 2019-03-12 04:25:33 +0800 | [diff] [blame] | 87 | "-UALLOW_ADBD_ROOT", |
| 88 | "-DALLOW_ADBD_ROOT=1", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 89 | "-DALLOW_ADBD_DISABLE_VERITY", |
| 90 | "-DALLOW_ADBD_NO_AUTH", |
Pirama Arumuga Nainar | 7982178 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 91 | ], |
| 92 | }, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 93 | }, |
| 94 | } |
| 95 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 96 | cc_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 Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 117 | // libadb |
| 118 | // ========================================================= |
| 119 | // These files are compiled for both the host and the device. |
| 120 | libadb_srcs = [ |
| 121 | "adb.cpp", |
| 122 | "adb_io.cpp", |
| 123 | "adb_listeners.cpp", |
| 124 | "adb_trace.cpp", |
Josh Gao | 6e1246c | 2018-05-24 22:54:50 -0700 | [diff] [blame] | 125 | "adb_unique_fd.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 126 | "adb_utils.cpp", |
Josh Gao | 57e09b1 | 2019-06-28 13:50:37 -0700 | [diff] [blame] | 127 | "fdevent/fdevent.cpp", |
Josh Gao | 95068bb | 2019-07-08 15:23:17 -0700 | [diff] [blame] | 128 | "fdevent/fdevent_poll.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 129 | "services.cpp", |
| 130 | "sockets.cpp", |
| 131 | "socket_spec.cpp", |
| 132 | "sysdeps/errno.cpp", |
| 133 | "transport.cpp", |
Josh Gao | 6082e7d | 2018-04-05 16:16:04 -0700 | [diff] [blame] | 134 | "transport_fd.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 135 | "transport_local.cpp", |
| 136 | "transport_usb.cpp", |
Yurii Zubrytskyi | 5dda7f6 | 2019-07-12 14:11:54 -0700 | [diff] [blame] | 137 | "types.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 138 | ] |
| 139 | |
| 140 | libadb_posix_srcs = [ |
| 141 | "sysdeps_unix.cpp", |
| 142 | "sysdeps/posix/network.cpp", |
| 143 | ] |
| 144 | |
Josh Gao | b43ad44 | 2019-07-11 13:47:44 -0700 | [diff] [blame] | 145 | libadb_linux_srcs = [ |
| 146 | "fdevent/fdevent_epoll.cpp", |
| 147 | ] |
| 148 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 149 | libadb_test_srcs = [ |
| 150 | "adb_io_test.cpp", |
| 151 | "adb_listeners_test.cpp", |
| 152 | "adb_utils_test.cpp", |
Josh Gao | 57e09b1 | 2019-06-28 13:50:37 -0700 | [diff] [blame] | 153 | "fdevent/fdevent_test.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 154 | "socket_spec_test.cpp", |
| 155 | "socket_test.cpp", |
| 156 | "sysdeps_test.cpp", |
| 157 | "sysdeps/stat_test.cpp", |
| 158 | "transport_test.cpp", |
Josh Gao | 7c738cd | 2018-04-03 14:37:11 -0700 | [diff] [blame] | 159 | "types_test.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 160 | ] |
| 161 | |
| 162 | cc_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 Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 173 | generated_headers: ["platform_tools_version"], |
| 174 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 175 | target: { |
| 176 | linux: { |
Josh Gao | b43ad44 | 2019-07-11 13:47:44 -0700 | [diff] [blame] | 177 | srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 178 | }, |
| 179 | darwin: { |
| 180 | srcs: ["client/usb_osx.cpp"], |
| 181 | }, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 182 | 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 Hamadi | 269a4b4 | 2018-09-13 18:00:25 +0100 | [diff] [blame] | 204 | "libutils", |
| 205 | "liblog", |
| 206 | "libcutils", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 207 | ], |
| 208 | } |
| 209 | |
| 210 | cc_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 Cherry | 9921630 | 2020-01-08 13:41:56 -0800 | [diff] [blame^] | 220 | "liblog", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 221 | "libmdnssd", |
| 222 | "libdiagnose_usb", |
| 223 | "libusb", |
| 224 | ], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 225 | |
| 226 | target: { |
| 227 | windows: { |
| 228 | enabled: true, |
Josh Gao | efd8ae2 | 2019-07-16 15:08:42 -0700 | [diff] [blame] | 229 | ldflags: ["-municode"], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 230 | shared_libs: ["AdbWinApi"], |
| 231 | }, |
| 232 | }, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 233 | } |
| 234 | |
Josh Gao | 9c59649 | 2018-04-04 11:27:24 -0700 | [diff] [blame] | 235 | cc_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 Cross | f117f34 | 2019-09-18 11:04:35 -0700 | [diff] [blame] | 257 | "libcrypto_static", |
Josh Gao | 9c59649 | 2018-04-04 11:27:24 -0700 | [diff] [blame] | 258 | "libdiagnose_usb", |
| 259 | "liblog", |
| 260 | "libusb", |
| 261 | ], |
| 262 | } |
| 263 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 264 | cc_binary_host { |
| 265 | name: "adb", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 266 | |
| 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 Hamadi | ed409ea | 2018-01-29 16:30:36 +0000 | [diff] [blame] | 276 | "client/adb_install.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 277 | "client/line_printer.cpp", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 278 | "client/fastdeploy.cpp", |
| 279 | "client/fastdeploycallbacks.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 280 | "shell_service_protocol.cpp", |
| 281 | ], |
| 282 | |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 283 | generated_headers: [ |
| 284 | "bin2c_fastdeployagent", |
| 285 | "bin2c_fastdeployagentscript" |
| 286 | ], |
| 287 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 288 | static_libs: [ |
| 289 | "libadb_host", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 290 | "libandroidfw", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 291 | "libbase", |
| 292 | "libcutils", |
| 293 | "libcrypto_utils", |
| 294 | "libcrypto", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 295 | "libfastdeploy_host", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 296 | "libdiagnose_usb", |
| 297 | "liblog", |
| 298 | "libmdnssd", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 299 | "libprotobuf-cpp-lite", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 300 | "libusb", |
Idries Hamadi | 269a4b4 | 2018-09-13 18:00:25 +0100 | [diff] [blame] | 301 | "libutils", |
| 302 | "liblog", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 303 | "libziparchive", |
| 304 | "libz", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 305 | ], |
| 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 Willemsen | 3f439a7 | 2018-11-19 19:11:35 -0800 | [diff] [blame] | 314 | // Archive adb, adb.exe. |
| 315 | dist: { |
| 316 | targets: [ |
| 317 | "dist_files", |
| 318 | "sdk", |
| 319 | "win_sdk", |
| 320 | ], |
| 321 | }, |
| 322 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 323 | target: { |
| 324 | darwin: { |
| 325 | cflags: [ |
| 326 | "-Wno-sizeof-pointer-memaccess", |
| 327 | ], |
| 328 | }, |
| 329 | windows: { |
| 330 | enabled: true, |
| 331 | ldflags: ["-municode"], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 332 | shared_libs: ["AdbWinApi"], |
| 333 | required: [ |
| 334 | "AdbWinUsbApi", |
| 335 | ], |
| 336 | }, |
| 337 | }, |
| 338 | } |
| 339 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 340 | // libadbd_core contains the common sources to build libadbd and libadbd_services. |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 341 | cc_library_static { |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 342 | name: "libadbd_core", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 343 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 344 | recovery_available: true, |
| 345 | |
| 346 | // libminadbd wants both, as it's used to build native tests. |
| 347 | compile_multilib: "both", |
| 348 | |
Josh Gao | b43ad44 | 2019-07-11 13:47:44 -0700 | [diff] [blame] | 349 | srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [ |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 350 | "daemon/auth.cpp", |
| 351 | "daemon/jdwp_service.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 352 | ], |
| 353 | |
| 354 | local_include_dirs: [ |
| 355 | "daemon/include", |
| 356 | ], |
| 357 | |
Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 358 | generated_headers: ["platform_tools_version"], |
| 359 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 360 | static_libs: [ |
| 361 | "libdiagnose_usb", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 362 | ], |
| 363 | |
| 364 | shared_libs: [ |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 365 | "libadbconnection_server", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 366 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 367 | "libasyncio", |
| 368 | "libbase", |
| 369 | "libcrypto", |
| 370 | "libcrypto_utils", |
| 371 | "libcutils", |
| 372 | "liblog", |
| 373 | ], |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 374 | |
| 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 Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 393 | } |
| 394 | |
| 395 | cc_library { |
| 396 | name: "libadbd_services", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 397 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 398 | recovery_available: true, |
| 399 | compile_multilib: "both", |
| 400 | |
| 401 | srcs: [ |
| 402 | "daemon/file_sync_service.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 403 | "daemon/services.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 404 | "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 Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 415 | "libdiagnose_usb", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 416 | ], |
| 417 | |
| 418 | shared_libs: [ |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 419 | "libadbconnection_server", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 420 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 421 | "libasyncio", |
| 422 | "libbase", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 423 | "libcrypto", |
| 424 | "libcrypto_utils", |
| 425 | "libcutils", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 426 | "liblog", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 427 | ], |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 428 | |
| 429 | target: { |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 430 | android: { |
| 431 | srcs: [ |
| 432 | "daemon/abb_service.cpp", |
| 433 | "daemon/framebuffer_service.cpp", |
| 434 | "daemon/mdns.cpp", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 435 | "daemon/restart_service.cpp", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 436 | ], |
| 437 | shared_libs: [ |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 438 | "libmdnssd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 439 | "libselinux", |
| 440 | ], |
| 441 | }, |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 442 | recovery: { |
| 443 | exclude_srcs: [ |
| 444 | "daemon/abb_service.cpp", |
| 445 | ], |
| 446 | }, |
| 447 | }, |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 448 | } |
| 449 | |
| 450 | cc_library { |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 451 | name: "libadbd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 452 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 453 | recovery_available: true, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 454 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 455 | // 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 Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 459 | compile_multilib: "both", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 460 | |
| 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 Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 464 | ], |
| 465 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 466 | shared_libs: [ |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 467 | "libadbconnection_server", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 468 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 469 | "libadbd_services", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 470 | "libasyncio", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 471 | "libbase", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 472 | "libcrypto", |
| 473 | "libcrypto_utils", |
| 474 | "libcutils", |
| 475 | "liblog", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 476 | ], |
Jerry Zhang | b156c60 | 2018-05-07 15:14:47 -0700 | [diff] [blame] | 477 | |
| 478 | export_include_dirs: [ |
| 479 | "daemon/include", |
| 480 | ], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 481 | } |
| 482 | |
| 483 | cc_binary { |
| 484 | name: "adbd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 485 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 486 | recovery_available: true, |
Josh Gao | 8db99f8 | 2018-03-06 12:57:27 -0800 | [diff] [blame] | 487 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 488 | srcs: [ |
| 489 | "daemon/main.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 490 | ], |
| 491 | |
| 492 | cflags: [ |
| 493 | "-D_GNU_SOURCE", |
| 494 | "-Wno-deprecated-declarations", |
| 495 | ], |
| 496 | |
| 497 | strip: { |
| 498 | keep_symbols: true, |
| 499 | }, |
| 500 | |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 501 | stl: "libc++_static", |
| 502 | static_libs: [ |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 503 | "libadbd", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 504 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 505 | "libadbd_services", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 506 | "libasyncio", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 507 | "libbase", |
| 508 | "libcap", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 509 | "libcrypto_utils", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 510 | "libcutils", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 511 | "libdiagnose_usb", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 512 | "liblog", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 513 | "libmdnssd", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 514 | "libminijail", |
| 515 | "libselinux", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 516 | ], |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 517 | |
| 518 | shared_libs: [ |
| 519 | "libadbconnection_server", |
| 520 | "libcrypto", |
| 521 | ], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 522 | } |
| 523 | |
Josh Gao | 7b7ee19 | 2019-10-23 13:27:17 -0700 | [diff] [blame] | 524 | phony { |
| 525 | name: "adbd_system_binaries", |
| 526 | required: [ |
| 527 | "abb", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 528 | "libadbd_auth", |
Josh Gao | 2c356bb | 2019-10-22 12:30:36 -0700 | [diff] [blame] | 529 | "reboot", |
Josh Gao | f61f414 | 2019-10-22 12:30:30 -0700 | [diff] [blame] | 530 | "set-verity-state", |
Josh Gao | 7b7ee19 | 2019-10-23 13:27:17 -0700 | [diff] [blame] | 531 | ] |
| 532 | } |
| 533 | |
| 534 | phony { |
| 535 | name: "adbd_system_binaries_recovery", |
| 536 | required: [ |
Josh Gao | 2c356bb | 2019-10-22 12:30:36 -0700 | [diff] [blame] | 537 | "reboot.recovery", |
Josh Gao | 7b7ee19 | 2019-10-23 13:27:17 -0700 | [diff] [blame] | 538 | ], |
| 539 | } |
| 540 | |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 541 | cc_binary { |
| 542 | name: "abb", |
| 543 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 544 | defaults: ["adbd_defaults"], |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 545 | 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 Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 575 | cc_test { |
| 576 | name: "adbd_test", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 577 | defaults: ["adbd_defaults"], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 578 | srcs: libadb_test_srcs + [ |
Josh Gao | 997cfac | 2018-07-25 18:15:52 -0700 | [diff] [blame] | 579 | "daemon/services.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 580 | "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 Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 588 | "libadbd_auth", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 589 | "libbase", |
| 590 | "libcutils", |
| 591 | "libcrypto_utils", |
Colin Cross | f117f34 | 2019-09-18 11:04:35 -0700 | [diff] [blame] | 592 | "libcrypto_static", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 593 | "libdiagnose_usb", |
| 594 | "liblog", |
| 595 | "libusb", |
| 596 | "libmdnssd", |
Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 597 | "libselinux", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 598 | ], |
Elliott Hughes | 40fdf3f | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 599 | test_suites: ["device-tests"], |
Dan Shi | d1360f4 | 2019-09-24 09:04:05 -0700 | [diff] [blame] | 600 | require_root: true, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 601 | } |
| 602 | |
Julien Desprez | 75fea7e | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 603 | python_test_host { |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 604 | name: "adb_integration_test_adb", |
| 605 | main: "test_adb.py", |
| 606 | srcs: [ |
| 607 | "test_adb.py", |
| 608 | ], |
Julien Desprez | 75fea7e | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 609 | test_config: "adb_integration_test_adb.xml", |
| 610 | test_suites: ["general-tests"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 611 | version: { |
| 612 | py2: { |
Josh Gao | 9b6522b | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 613 | enabled: false, |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 614 | }, |
| 615 | py3: { |
Josh Gao | 9b6522b | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 616 | enabled: true, |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 617 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 618 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 619 | } |
| 620 | |
Julien Desprez | 618f0e1 | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 621 | python_test_host { |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 622 | name: "adb_integration_test_device", |
| 623 | main: "test_device.py", |
| 624 | srcs: [ |
| 625 | "test_device.py", |
| 626 | ], |
| 627 | libs: [ |
| 628 | "adb_py", |
| 629 | ], |
Julien Desprez | 618f0e1 | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 630 | test_config: "adb_integration_test_device.xml", |
| 631 | test_suites: ["general-tests"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 632 | version: { |
| 633 | py2: { |
| 634 | enabled: true, |
| 635 | }, |
| 636 | py3: { |
| 637 | enabled: false, |
| 638 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 639 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 640 | } |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 641 | |
| 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. |
| 644 | java_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 | |
| 651 | genrule { |
| 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 | |
| 658 | cc_library_host_static { |
| 659 | name: "libfastdeploy_host", |
| 660 | defaults: ["adb_defaults"], |
| 661 | srcs: [ |
Alex Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 662 | "fastdeploy/deploypatchgenerator/apk_archive.cpp", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 663 | "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 | |
| 695 | cc_test_host { |
| 696 | name: "fastdeploy_test", |
| 697 | defaults: ["adb_defaults"], |
| 698 | srcs: [ |
Alex Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 699 | "fastdeploy/deploypatchgenerator/apk_archive_test.cpp", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 700 | "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 Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 727 | "fastdeploy/testdata/rotating_cube-metadata-release.data", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 728 | "fastdeploy/testdata/rotating_cube-release.apk", |
Alex Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 729 | "fastdeploy/testdata/sample.apk", |
| 730 | "fastdeploy/testdata/sample.cd", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 731 | ], |
| 732 | } |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 733 | |
| 734 | prebuilt_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 | |
| 741 | apex { |
| 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 | |
| 752 | apex_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 | |
| 758 | android_app_certificate { |
| 759 | name: "com.android.adbd.certificate", |
| 760 | certificate: "apex/com.android.adbd", |
| 761 | } |
| 762 | |
| 763 | prebuilt_etc { |
| 764 | name: "com.android.adbd.init.rc", |
| 765 | src: "apex/adbd.rc", |
| 766 | filename: "init.rc", |
| 767 | installable: false, |
| 768 | } |