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", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 30 | "-DENABLE_FASTDEPLOY=1", // enable fast deploy |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 31 | ], |
Josh Gao | 6eb7882 | 2018-11-16 15:40:16 -0800 | [diff] [blame] | 32 | cpp_std: "experimental", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 33 | |
Josh Gao | c7567fa | 2018-02-27 15:49:23 -0800 | [diff] [blame] | 34 | use_version_lib: true, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 35 | compile_multilib: "first", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 36 | |
| 37 | target: { |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 38 | darwin: { |
| 39 | host_ldlibs: [ |
| 40 | "-lpthread", |
| 41 | "-framework CoreFoundation", |
| 42 | "-framework IOKit", |
| 43 | "-lobjc", |
| 44 | ], |
| 45 | }, |
| 46 | |
| 47 | windows: { |
| 48 | cflags: [ |
| 49 | // Define windows.h and tchar.h Unicode preprocessor symbols so that |
| 50 | // CreateFile(), _tfopen(), etc. map to versions that take wchar_t*, breaking the |
| 51 | // build if you accidentally pass char*. Fix by calling like: |
| 52 | // std::wstring path_wide; |
| 53 | // if (!android::base::UTF8ToWide(path_utf8, &path_wide)) { /* error handling */ } |
| 54 | // CreateFileW(path_wide.c_str()); |
| 55 | "-DUNICODE=1", |
| 56 | "-D_UNICODE=1", |
| 57 | |
Elliott Hughes | 3c59cb8 | 2018-12-03 09:02:18 -0800 | [diff] [blame] | 58 | // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows. |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 59 | "-D_GNU_SOURCE", |
Josh Gao | 2e1e789 | 2018-03-23 13:03:28 -0700 | [diff] [blame] | 60 | |
| 61 | // MinGW hides some things behind _POSIX_SOURCE. |
| 62 | "-D_POSIX_SOURCE", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 63 | |
Josh Gao | 4710e53 | 2019-04-17 16:57:43 -0700 | [diff] [blame] | 64 | // libusb uses __stdcall on a variadic function, which gets ignored. |
| 65 | "-Wno-ignored-attributes", |
| 66 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 67 | // Not supported yet. |
| 68 | "-Wno-thread-safety", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 69 | ], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 70 | |
| 71 | host_ldlibs: [ |
| 72 | "-lws2_32", |
| 73 | "-lgdi32", |
| 74 | "-luserenv", |
| 75 | ], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 76 | }, |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 77 | }, |
| 78 | } |
Pirama Arumuga Nainar | 7982178 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 79 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 80 | cc_defaults { |
| 81 | name: "adbd_defaults", |
| 82 | defaults: ["adb_defaults"], |
| 83 | |
| 84 | cflags: ["-UADB_HOST", "-DADB_HOST=0"], |
| 85 | product_variables: { |
| 86 | debuggable: { |
Pirama Arumuga Nainar | 7982178 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 87 | cflags: [ |
Bowgo Tsai | 9b30c0a | 2019-03-12 04:25:33 +0800 | [diff] [blame] | 88 | "-UALLOW_ADBD_ROOT", |
| 89 | "-DALLOW_ADBD_ROOT=1", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 90 | "-DALLOW_ADBD_DISABLE_VERITY", |
| 91 | "-DALLOW_ADBD_NO_AUTH", |
Pirama Arumuga Nainar | 7982178 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 92 | ], |
| 93 | }, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 94 | }, |
| 95 | } |
| 96 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 97 | cc_defaults { |
| 98 | name: "host_adbd_supported", |
| 99 | |
| 100 | host_supported: true, |
| 101 | target: { |
| 102 | linux: { |
| 103 | enabled: true, |
| 104 | host_ldlibs: [ |
| 105 | "-lresolv", // b64_pton |
| 106 | "-lutil", // forkpty |
| 107 | ], |
| 108 | }, |
| 109 | darwin: { |
| 110 | enabled: false, |
| 111 | }, |
| 112 | windows: { |
| 113 | enabled: false, |
| 114 | }, |
| 115 | }, |
| 116 | } |
| 117 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 118 | // libadb |
| 119 | // ========================================================= |
| 120 | // These files are compiled for both the host and the device. |
| 121 | libadb_srcs = [ |
| 122 | "adb.cpp", |
| 123 | "adb_io.cpp", |
| 124 | "adb_listeners.cpp", |
| 125 | "adb_trace.cpp", |
Josh Gao | 6e1246c | 2018-05-24 22:54:50 -0700 | [diff] [blame] | 126 | "adb_unique_fd.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 127 | "adb_utils.cpp", |
Josh Gao | 57e09b1 | 2019-06-28 13:50:37 -0700 | [diff] [blame] | 128 | "fdevent/fdevent.cpp", |
Josh Gao | 95068bb | 2019-07-08 15:23:17 -0700 | [diff] [blame] | 129 | "fdevent/fdevent_poll.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 130 | "services.cpp", |
| 131 | "sockets.cpp", |
| 132 | "socket_spec.cpp", |
| 133 | "sysdeps/errno.cpp", |
| 134 | "transport.cpp", |
Josh Gao | 6082e7d | 2018-04-05 16:16:04 -0700 | [diff] [blame] | 135 | "transport_fd.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 136 | "transport_local.cpp", |
| 137 | "transport_usb.cpp", |
| 138 | ] |
| 139 | |
| 140 | libadb_posix_srcs = [ |
| 141 | "sysdeps_unix.cpp", |
| 142 | "sysdeps/posix/network.cpp", |
| 143 | ] |
| 144 | |
| 145 | libadb_test_srcs = [ |
| 146 | "adb_io_test.cpp", |
| 147 | "adb_listeners_test.cpp", |
| 148 | "adb_utils_test.cpp", |
Josh Gao | 57e09b1 | 2019-06-28 13:50:37 -0700 | [diff] [blame] | 149 | "fdevent/fdevent_test.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 150 | "socket_spec_test.cpp", |
| 151 | "socket_test.cpp", |
| 152 | "sysdeps_test.cpp", |
| 153 | "sysdeps/stat_test.cpp", |
| 154 | "transport_test.cpp", |
Josh Gao | 7c738cd | 2018-04-03 14:37:11 -0700 | [diff] [blame] | 155 | "types_test.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 156 | ] |
| 157 | |
| 158 | cc_library_host_static { |
| 159 | name: "libadb_host", |
| 160 | defaults: ["adb_defaults"], |
| 161 | |
| 162 | srcs: libadb_srcs + [ |
| 163 | "client/auth.cpp", |
| 164 | "client/usb_libusb.cpp", |
| 165 | "client/usb_dispatch.cpp", |
| 166 | "client/transport_mdns.cpp", |
| 167 | ], |
| 168 | |
Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 169 | generated_headers: ["platform_tools_version"], |
| 170 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 171 | target: { |
| 172 | linux: { |
| 173 | srcs: ["client/usb_linux.cpp"], |
| 174 | }, |
| 175 | darwin: { |
| 176 | srcs: ["client/usb_osx.cpp"], |
| 177 | }, |
| 178 | |
| 179 | not_windows: { |
| 180 | srcs: libadb_posix_srcs, |
| 181 | }, |
| 182 | windows: { |
| 183 | enabled: true, |
| 184 | srcs: [ |
| 185 | "client/usb_windows.cpp", |
| 186 | "sysdeps_win32.cpp", |
| 187 | "sysdeps/win32/errno.cpp", |
| 188 | "sysdeps/win32/stat.cpp", |
| 189 | ], |
| 190 | shared_libs: ["AdbWinApi"], |
| 191 | }, |
| 192 | }, |
| 193 | |
| 194 | static_libs: [ |
| 195 | "libbase", |
| 196 | "libcrypto_utils", |
| 197 | "libcrypto", |
| 198 | "libdiagnose_usb", |
| 199 | "libmdnssd", |
| 200 | "libusb", |
Idries Hamadi | 269a4b4 | 2018-09-13 18:00:25 +0100 | [diff] [blame] | 201 | "libutils", |
| 202 | "liblog", |
| 203 | "libcutils", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 204 | ], |
| 205 | } |
| 206 | |
| 207 | cc_test_host { |
| 208 | name: "adb_test", |
| 209 | defaults: ["adb_defaults"], |
| 210 | srcs: libadb_test_srcs, |
| 211 | static_libs: [ |
| 212 | "libadb_host", |
| 213 | "libbase", |
| 214 | "libcutils", |
| 215 | "libcrypto_utils", |
| 216 | "libcrypto", |
| 217 | "libmdnssd", |
| 218 | "libdiagnose_usb", |
| 219 | "libusb", |
| 220 | ], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 221 | |
| 222 | target: { |
| 223 | windows: { |
| 224 | enabled: true, |
Josh Gao | efd8ae2 | 2019-07-16 15:08:42 -0700 | [diff] [blame] | 225 | ldflags: ["-municode"], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 226 | shared_libs: ["AdbWinApi"], |
| 227 | }, |
| 228 | }, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 229 | } |
| 230 | |
Josh Gao | 9c59649 | 2018-04-04 11:27:24 -0700 | [diff] [blame] | 231 | cc_benchmark { |
| 232 | name: "adb_benchmark", |
| 233 | defaults: ["adb_defaults"], |
| 234 | |
| 235 | srcs: ["transport_benchmark.cpp"], |
| 236 | target: { |
| 237 | android: { |
| 238 | static_libs: [ |
| 239 | "libadbd", |
| 240 | ], |
| 241 | }, |
| 242 | host: { |
| 243 | static_libs: [ |
| 244 | "libadb_host", |
| 245 | ], |
| 246 | }, |
| 247 | }, |
| 248 | |
| 249 | static_libs: [ |
| 250 | "libbase", |
| 251 | "libcutils", |
| 252 | "libcrypto_utils", |
| 253 | "libcrypto", |
| 254 | "libdiagnose_usb", |
| 255 | "liblog", |
| 256 | "libusb", |
| 257 | ], |
| 258 | } |
| 259 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 260 | cc_binary_host { |
| 261 | name: "adb", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 262 | |
| 263 | defaults: ["adb_defaults"], |
| 264 | |
| 265 | srcs: [ |
| 266 | "client/adb_client.cpp", |
| 267 | "client/bugreport.cpp", |
| 268 | "client/commandline.cpp", |
| 269 | "client/file_sync_client.cpp", |
| 270 | "client/main.cpp", |
| 271 | "client/console.cpp", |
Idries Hamadi | ed409ea | 2018-01-29 16:30:36 +0000 | [diff] [blame] | 272 | "client/adb_install.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 273 | "client/line_printer.cpp", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 274 | "client/fastdeploy.cpp", |
| 275 | "client/fastdeploycallbacks.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 276 | "shell_service_protocol.cpp", |
| 277 | ], |
| 278 | |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 279 | generated_headers: [ |
| 280 | "bin2c_fastdeployagent", |
| 281 | "bin2c_fastdeployagentscript" |
| 282 | ], |
| 283 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 284 | static_libs: [ |
| 285 | "libadb_host", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 286 | "libandroidfw", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 287 | "libbase", |
| 288 | "libcutils", |
| 289 | "libcrypto_utils", |
| 290 | "libcrypto", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 291 | "libfastdeploy_host", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 292 | "libdiagnose_usb", |
| 293 | "liblog", |
| 294 | "libmdnssd", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 295 | "libprotobuf-cpp-lite", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 296 | "libusb", |
Idries Hamadi | 269a4b4 | 2018-09-13 18:00:25 +0100 | [diff] [blame] | 297 | "libutils", |
| 298 | "liblog", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 299 | "libziparchive", |
| 300 | "libz", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 301 | ], |
| 302 | |
| 303 | stl: "libc++_static", |
| 304 | |
| 305 | // Don't add anything here, we don't want additional shared dependencies |
| 306 | // on the host adb tool, and shared libraries that link against libc++ |
| 307 | // will violate ODR |
| 308 | shared_libs: [], |
| 309 | |
Dan Willemsen | 3f439a7 | 2018-11-19 19:11:35 -0800 | [diff] [blame] | 310 | // Archive adb, adb.exe. |
| 311 | dist: { |
| 312 | targets: [ |
| 313 | "dist_files", |
| 314 | "sdk", |
| 315 | "win_sdk", |
| 316 | ], |
| 317 | }, |
| 318 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 319 | target: { |
| 320 | darwin: { |
| 321 | cflags: [ |
| 322 | "-Wno-sizeof-pointer-memaccess", |
| 323 | ], |
| 324 | }, |
| 325 | windows: { |
| 326 | enabled: true, |
| 327 | ldflags: ["-municode"], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 328 | shared_libs: ["AdbWinApi"], |
| 329 | required: [ |
| 330 | "AdbWinUsbApi", |
| 331 | ], |
| 332 | }, |
| 333 | }, |
| 334 | } |
| 335 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 336 | // libadbd_core contains the common sources to build libadbd and libadbd_services. |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 337 | cc_library_static { |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 338 | name: "libadbd_core", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 339 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 340 | recovery_available: true, |
| 341 | |
| 342 | // libminadbd wants both, as it's used to build native tests. |
| 343 | compile_multilib: "both", |
| 344 | |
| 345 | srcs: libadb_srcs + libadb_posix_srcs + [ |
| 346 | "daemon/auth.cpp", |
| 347 | "daemon/jdwp_service.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 348 | ], |
| 349 | |
| 350 | local_include_dirs: [ |
| 351 | "daemon/include", |
| 352 | ], |
| 353 | |
Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 354 | generated_headers: ["platform_tools_version"], |
| 355 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 356 | static_libs: [ |
Josh Gao | 5f2c5bb | 2019-06-19 14:14:57 -0700 | [diff] [blame] | 357 | "libadbconnection_server", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 358 | "libdiagnose_usb", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 359 | ], |
| 360 | |
| 361 | shared_libs: [ |
| 362 | "libasyncio", |
| 363 | "libbase", |
| 364 | "libcrypto", |
| 365 | "libcrypto_utils", |
| 366 | "libcutils", |
| 367 | "liblog", |
| 368 | ], |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 369 | |
| 370 | target: { |
| 371 | android: { |
| 372 | whole_static_libs: [ |
| 373 | "libqemu_pipe", |
| 374 | ], |
| 375 | srcs: [ |
| 376 | "daemon/transport_qemu.cpp", |
| 377 | "daemon/usb.cpp", |
| 378 | "daemon/usb_ffs.cpp", |
| 379 | "daemon/usb_legacy.cpp", |
| 380 | ] |
| 381 | }, |
| 382 | linux_glibc: { |
| 383 | srcs: [ |
| 384 | "daemon/usb_dummy.cpp", |
| 385 | ] |
| 386 | } |
| 387 | }, |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | cc_library { |
| 391 | name: "libadbd_services", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 392 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 393 | recovery_available: true, |
| 394 | compile_multilib: "both", |
| 395 | |
| 396 | srcs: [ |
| 397 | "daemon/file_sync_service.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 398 | "daemon/services.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 399 | "daemon/shell_service.cpp", |
| 400 | "shell_service_protocol.cpp", |
| 401 | ], |
| 402 | |
| 403 | cflags: [ |
| 404 | "-D_GNU_SOURCE", |
| 405 | "-Wno-deprecated-declarations", |
| 406 | ], |
| 407 | |
| 408 | static_libs: [ |
Josh Gao | 5f2c5bb | 2019-06-19 14:14:57 -0700 | [diff] [blame] | 409 | "libadbconnection_server", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 410 | "libadbd_core", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 411 | "libdiagnose_usb", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 412 | ], |
| 413 | |
| 414 | shared_libs: [ |
| 415 | "libasyncio", |
| 416 | "libbase", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 417 | "libcrypto", |
| 418 | "libcrypto_utils", |
| 419 | "libcutils", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 420 | "liblog", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 421 | ], |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 422 | |
Mark Salyzyn | 2f6c180 | 2019-02-15 07:45:26 -0800 | [diff] [blame] | 423 | product_variables: { |
| 424 | debuggable: { |
| 425 | required: [ |
| 426 | "remount", |
| 427 | ], |
| 428 | }, |
| 429 | }, |
| 430 | |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 431 | target: { |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 432 | android: { |
| 433 | srcs: [ |
| 434 | "daemon/abb_service.cpp", |
| 435 | "daemon/framebuffer_service.cpp", |
| 436 | "daemon/mdns.cpp", |
| 437 | "daemon/reboot_service.cpp", |
| 438 | "daemon/remount_service.cpp", |
| 439 | "daemon/restart_service.cpp", |
| 440 | "daemon/set_verity_enable_state_service.cpp", |
| 441 | ], |
| 442 | static_libs: [ |
| 443 | "libavb_user", |
| 444 | ], |
| 445 | shared_libs: [ |
| 446 | "libbootloader_message", |
| 447 | "libmdnssd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 448 | "libfec", |
| 449 | "libfs_mgr", |
| 450 | "libselinux", |
| 451 | ], |
| 452 | }, |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 453 | recovery: { |
| 454 | exclude_srcs: [ |
| 455 | "daemon/abb_service.cpp", |
| 456 | ], |
| 457 | }, |
| 458 | }, |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | cc_library { |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 462 | name: "libadbd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 463 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 464 | recovery_available: true, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 465 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 466 | // Avoid getting duplicate symbol of android::build::GetBuildNumber(). |
| 467 | use_version_lib: false, |
| 468 | |
| 469 | // libminadbd wants both, as it's used to build native tests. |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 470 | compile_multilib: "both", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 471 | |
| 472 | // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library. |
| 473 | whole_static_libs: [ |
| 474 | "libadbd_core", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 475 | ], |
| 476 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 477 | shared_libs: [ |
| 478 | "libadbd_services", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 479 | "libasyncio", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 480 | "libbase", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 481 | "libcrypto", |
| 482 | "libcrypto_utils", |
| 483 | "libcutils", |
| 484 | "liblog", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 485 | ], |
Jerry Zhang | b156c60 | 2018-05-07 15:14:47 -0700 | [diff] [blame] | 486 | |
| 487 | export_include_dirs: [ |
| 488 | "daemon/include", |
| 489 | ], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 490 | } |
| 491 | |
| 492 | cc_binary { |
| 493 | name: "adbd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 494 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 495 | recovery_available: true, |
Josh Gao | 8db99f8 | 2018-03-06 12:57:27 -0800 | [diff] [blame] | 496 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 497 | srcs: [ |
| 498 | "daemon/main.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 499 | ], |
| 500 | |
| 501 | cflags: [ |
| 502 | "-D_GNU_SOURCE", |
| 503 | "-Wno-deprecated-declarations", |
| 504 | ], |
| 505 | |
| 506 | strip: { |
| 507 | keep_symbols: true, |
| 508 | }, |
| 509 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 510 | shared_libs: [ |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 511 | "libadbd", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 512 | "libadbd_services", |
| 513 | "libbase", |
| 514 | "libcap", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 515 | "libcrypto", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 516 | "libcutils", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 517 | "liblog", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 518 | "libminijail", |
| 519 | "libselinux", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 520 | ], |
| 521 | } |
| 522 | |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 523 | cc_binary { |
Josh Gao | bde8c84 | 2019-05-01 18:25:14 -0700 | [diff] [blame] | 524 | name: "static_adbd", |
| 525 | defaults: ["adbd_defaults", "host_adbd_supported"], |
| 526 | |
| 527 | recovery_available: false, |
| 528 | static_executable: true, |
| 529 | host_supported: false, |
| 530 | |
| 531 | srcs: [ |
| 532 | "daemon/main.cpp", |
| 533 | ], |
| 534 | |
| 535 | cflags: [ |
| 536 | "-D_GNU_SOURCE", |
| 537 | "-Wno-deprecated-declarations", |
| 538 | ], |
| 539 | |
| 540 | strip: { |
| 541 | keep_symbols: true, |
| 542 | }, |
| 543 | |
| 544 | static_libs: [ |
Josh Gao | 5f2c5bb | 2019-06-19 14:14:57 -0700 | [diff] [blame] | 545 | "libadbconnection_server", |
Josh Gao | bde8c84 | 2019-05-01 18:25:14 -0700 | [diff] [blame] | 546 | "libadbd", |
| 547 | "libadbd_services", |
| 548 | "libasyncio", |
| 549 | "libavb_user", |
| 550 | "libbase", |
| 551 | "libbootloader_message", |
| 552 | "libcap", |
| 553 | "libcrypto", |
| 554 | "libcrypto_utils", |
| 555 | "libcutils", |
| 556 | "libdiagnose_usb", |
| 557 | "libext4_utils", |
| 558 | "libfec", |
| 559 | "libfec_rs", |
| 560 | "libfs_mgr", |
| 561 | "liblog", |
| 562 | "liblp", |
| 563 | "libmdnssd", |
| 564 | "libminijail", |
| 565 | "libselinux", |
| 566 | "libsquashfs_utils", |
| 567 | ], |
| 568 | } |
| 569 | |
| 570 | cc_binary { |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 571 | name: "abb", |
| 572 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 573 | defaults: ["adbd_defaults"], |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 574 | recovery_available: false, |
| 575 | |
| 576 | srcs: [ |
| 577 | "daemon/abb.cpp", |
| 578 | ], |
| 579 | |
| 580 | cflags: [ |
| 581 | "-D_GNU_SOURCE", |
| 582 | "-Wno-deprecated-declarations", |
| 583 | ], |
| 584 | |
| 585 | strip: { |
| 586 | keep_symbols: true, |
| 587 | }, |
| 588 | |
| 589 | static_libs: [ |
| 590 | "libadbd_core", |
| 591 | "libadbd_services", |
| 592 | "libcmd", |
| 593 | ], |
| 594 | |
| 595 | shared_libs: [ |
| 596 | "libbase", |
| 597 | "libbinder", |
| 598 | "liblog", |
| 599 | "libutils", |
| 600 | "libselinux", |
| 601 | ], |
| 602 | } |
| 603 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 604 | cc_test { |
| 605 | name: "adbd_test", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 606 | defaults: ["adbd_defaults"], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 607 | srcs: libadb_test_srcs + [ |
Josh Gao | 997cfac | 2018-07-25 18:15:52 -0700 | [diff] [blame] | 608 | "daemon/services.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 609 | "daemon/shell_service.cpp", |
| 610 | "daemon/shell_service_test.cpp", |
| 611 | "shell_service_protocol.cpp", |
| 612 | "shell_service_protocol_test.cpp", |
| 613 | ], |
| 614 | |
| 615 | static_libs: [ |
| 616 | "libadbd", |
| 617 | "libbase", |
Josh Gao | 997cfac | 2018-07-25 18:15:52 -0700 | [diff] [blame] | 618 | "libbootloader_message", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 619 | "libcutils", |
| 620 | "libcrypto_utils", |
| 621 | "libcrypto", |
| 622 | "libdiagnose_usb", |
| 623 | "liblog", |
| 624 | "libusb", |
| 625 | "libmdnssd", |
Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 626 | "libselinux", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 627 | ], |
Elliott Hughes | 40fdf3f | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 628 | test_suites: ["device-tests"], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 629 | } |
| 630 | |
Julien Desprez | 75fea7e | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 631 | python_test_host { |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 632 | name: "adb_integration_test_adb", |
| 633 | main: "test_adb.py", |
| 634 | srcs: [ |
| 635 | "test_adb.py", |
| 636 | ], |
Julien Desprez | 75fea7e | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 637 | test_config: "adb_integration_test_adb.xml", |
| 638 | test_suites: ["general-tests"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 639 | version: { |
| 640 | py2: { |
Josh Gao | 9b6522b | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 641 | enabled: false, |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 642 | }, |
| 643 | py3: { |
Josh Gao | 9b6522b | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 644 | enabled: true, |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 645 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 646 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 647 | } |
| 648 | |
Julien Desprez | 618f0e1 | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 649 | python_test_host { |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 650 | name: "adb_integration_test_device", |
| 651 | main: "test_device.py", |
| 652 | srcs: [ |
| 653 | "test_device.py", |
| 654 | ], |
| 655 | libs: [ |
| 656 | "adb_py", |
| 657 | ], |
Julien Desprez | 618f0e1 | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 658 | test_config: "adb_integration_test_device.xml", |
| 659 | test_suites: ["general-tests"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 660 | version: { |
| 661 | py2: { |
| 662 | enabled: true, |
| 663 | }, |
| 664 | py3: { |
| 665 | enabled: false, |
| 666 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 667 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 668 | } |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 669 | |
| 670 | // Note: using pipe for xxd to control the variable name generated |
| 671 | // the default name used by xxd is the path to the input file. |
| 672 | java_genrule { |
| 673 | name: "bin2c_fastdeployagent", |
| 674 | out: ["deployagent.inc"], |
| 675 | srcs: [":deployagent"], |
| 676 | cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)", |
| 677 | } |
| 678 | |
| 679 | genrule { |
| 680 | name: "bin2c_fastdeployagentscript", |
| 681 | out: ["deployagentscript.inc"], |
| 682 | srcs: ["fastdeploy/deployagent/deployagent.sh"], |
| 683 | cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)", |
| 684 | } |
| 685 | |
| 686 | cc_library_host_static { |
| 687 | name: "libfastdeploy_host", |
| 688 | defaults: ["adb_defaults"], |
| 689 | srcs: [ |
| 690 | "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp", |
| 691 | "fastdeploy/deploypatchgenerator/patch_utils.cpp", |
| 692 | "fastdeploy/proto/ApkEntry.proto", |
| 693 | ], |
| 694 | static_libs: [ |
| 695 | "libadb_host", |
| 696 | "libandroidfw", |
| 697 | "libbase", |
| 698 | "libcutils", |
| 699 | "libcrypto_utils", |
| 700 | "libcrypto", |
| 701 | "libdiagnose_usb", |
| 702 | "liblog", |
| 703 | "libmdnssd", |
| 704 | "libusb", |
| 705 | "libutils", |
| 706 | "libziparchive", |
| 707 | "libz", |
| 708 | ], |
| 709 | stl: "libc++_static", |
| 710 | proto: { |
| 711 | type: "lite", |
| 712 | export_proto_headers: true, |
| 713 | }, |
| 714 | target: { |
| 715 | windows: { |
| 716 | enabled: true, |
| 717 | shared_libs: ["AdbWinApi"], |
| 718 | }, |
| 719 | }, |
| 720 | } |
| 721 | |
| 722 | cc_test_host { |
| 723 | name: "fastdeploy_test", |
| 724 | defaults: ["adb_defaults"], |
| 725 | srcs: [ |
| 726 | "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp", |
| 727 | "fastdeploy/deploypatchgenerator/patch_utils_test.cpp", |
| 728 | ], |
| 729 | static_libs: [ |
| 730 | "libadb_host", |
| 731 | "libandroidfw", |
| 732 | "libbase", |
| 733 | "libcutils", |
| 734 | "libcrypto_utils", |
| 735 | "libcrypto", |
| 736 | "libdiagnose_usb", |
| 737 | "libfastdeploy_host", |
| 738 | "liblog", |
| 739 | "libmdnssd", |
| 740 | "libprotobuf-cpp-lite", |
| 741 | "libusb", |
| 742 | "libutils", |
| 743 | "libziparchive", |
| 744 | "libz", |
| 745 | ], |
| 746 | target: { |
| 747 | windows: { |
| 748 | enabled: true, |
| 749 | shared_libs: ["AdbWinApi"], |
| 750 | }, |
| 751 | }, |
| 752 | data: [ |
| 753 | "fastdeploy/testdata/rotating_cube-release.apk", |
| 754 | ], |
| 755 | } |