GuangHui Liu | 3599439 | 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 | 361148b | 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 | 7aa2023 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 22 | "-Wexit-time-destructors", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 23 | "-Wno-unused-parameter", |
| 24 | "-Wno-missing-field-initializers", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 25 | "-Wthread-safety", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 26 | "-Wvla", |
Bowgo Tsai | 35b817b | 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 | 90228a6 | 2019-04-25 14:04:57 -0700 | [diff] [blame] | 29 | "-DANDROID_BASE_UNIQUE_FD_DISABLE_IMPLICIT_CONVERSION=1", |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 30 | "-DENABLE_FASTDEPLOY=1", // enable fast deploy |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 31 | ], |
Josh Gao | 3edf807 | 2018-11-16 15:40:16 -0800 | [diff] [blame] | 32 | cpp_std: "experimental", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 33 | |
Josh Gao | 66766f8 | 2018-02-27 15:49:23 -0800 | [diff] [blame] | 34 | use_version_lib: true, |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 35 | compile_multilib: "first", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 36 | |
| 37 | target: { |
Josh Gao | 361148b | 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 | c229a72 | 2018-12-03 09:02:18 -0800 | [diff] [blame] | 58 | // Unlike on Linux, -std=gnu++ doesn't set _GNU_SOURCE on Windows. |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 59 | "-D_GNU_SOURCE", |
Josh Gao | 96049b9 | 2018-03-23 13:03:28 -0700 | [diff] [blame] | 60 | |
| 61 | // MinGW hides some things behind _POSIX_SOURCE. |
| 62 | "-D_POSIX_SOURCE", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 63 | |
Josh Gao | c3b6403 | 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 | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 67 | // Not supported yet. |
| 68 | "-Wno-thread-safety", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 69 | ], |
Josh Gao | ea7b95a | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 70 | |
| 71 | host_ldlibs: [ |
| 72 | "-lws2_32", |
| 73 | "-lgdi32", |
| 74 | "-luserenv", |
| 75 | ], |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 76 | }, |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 77 | }, |
| 78 | } |
Pirama Arumuga Nainar | 7aa2023 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 79 | |
Josh Gao | 0560feb | 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 | 7aa2023 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 87 | cflags: [ |
Bowgo Tsai | 35b817b | 2019-03-12 04:25:33 +0800 | [diff] [blame] | 88 | "-UALLOW_ADBD_ROOT", |
| 89 | "-DALLOW_ADBD_ROOT=1", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 90 | "-DALLOW_ADBD_DISABLE_VERITY", |
| 91 | "-DALLOW_ADBD_NO_AUTH", |
Pirama Arumuga Nainar | 7aa2023 | 2018-06-01 11:31:38 -0700 | [diff] [blame] | 92 | ], |
| 93 | }, |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 94 | }, |
| 95 | } |
| 96 | |
Josh Gao | 0560feb | 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 | 361148b | 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 | 7d5762c | 2018-05-24 22:54:50 -0700 | [diff] [blame] | 126 | "adb_unique_fd.cpp", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 127 | "adb_utils.cpp", |
Josh Gao | b51193a | 2019-06-28 13:50:37 -0700 | [diff] [blame] | 128 | "fdevent/fdevent.cpp", |
Josh Gao | 9e4aa3a | 2019-07-08 15:23:17 -0700 | [diff] [blame] | 129 | "fdevent/fdevent_poll.cpp", |
Josh Gao | 361148b | 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 | 1e41fda | 2018-04-05 16:16:04 -0700 | [diff] [blame] | 135 | "transport_fd.cpp", |
Josh Gao | 361148b | 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 | |
Josh Gao | dd71642 | 2019-07-11 13:47:44 -0700 | [diff] [blame] | 145 | libadb_linux_srcs = [ |
| 146 | "fdevent/fdevent_epoll.cpp", |
| 147 | ] |
| 148 | |
Josh Gao | 361148b | 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 | b51193a | 2019-06-28 13:50:37 -0700 | [diff] [blame] | 153 | "fdevent/fdevent_test.cpp", |
Josh Gao | 361148b | 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 | 9f155db | 2018-04-03 14:37:11 -0700 | [diff] [blame] | 159 | "types_test.cpp", |
Josh Gao | 361148b | 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 | 1886189 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 173 | generated_headers: ["platform_tools_version"], |
| 174 | |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 175 | target: { |
| 176 | linux: { |
Josh Gao | dd71642 | 2019-07-11 13:47:44 -0700 | [diff] [blame] | 177 | srcs: ["client/usb_linux.cpp"] + libadb_linux_srcs, |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 178 | }, |
| 179 | darwin: { |
| 180 | srcs: ["client/usb_osx.cpp"], |
| 181 | }, |
Josh Gao | 361148b | 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 | 78330f0 | 2018-09-13 18:00:25 +0100 | [diff] [blame] | 204 | "libutils", |
| 205 | "liblog", |
| 206 | "libcutils", |
Josh Gao | 361148b | 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", |
| 220 | "libmdnssd", |
| 221 | "libdiagnose_usb", |
| 222 | "libusb", |
| 223 | ], |
Josh Gao | ea7b95a | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 224 | |
| 225 | target: { |
| 226 | windows: { |
| 227 | enabled: true, |
Josh Gao | 3e8bdab | 2019-07-16 15:08:42 -0700 | [diff] [blame] | 228 | ldflags: ["-municode"], |
Josh Gao | ea7b95a | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 229 | shared_libs: ["AdbWinApi"], |
| 230 | }, |
| 231 | }, |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 232 | } |
| 233 | |
Josh Gao | 11e41d6 | 2018-04-04 11:27:24 -0700 | [diff] [blame] | 234 | cc_benchmark { |
| 235 | name: "adb_benchmark", |
| 236 | defaults: ["adb_defaults"], |
| 237 | |
| 238 | srcs: ["transport_benchmark.cpp"], |
| 239 | target: { |
| 240 | android: { |
| 241 | static_libs: [ |
| 242 | "libadbd", |
| 243 | ], |
| 244 | }, |
| 245 | host: { |
| 246 | static_libs: [ |
| 247 | "libadb_host", |
| 248 | ], |
| 249 | }, |
| 250 | }, |
| 251 | |
| 252 | static_libs: [ |
| 253 | "libbase", |
| 254 | "libcutils", |
| 255 | "libcrypto_utils", |
| 256 | "libcrypto", |
| 257 | "libdiagnose_usb", |
| 258 | "liblog", |
| 259 | "libusb", |
| 260 | ], |
| 261 | } |
| 262 | |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 263 | cc_binary_host { |
| 264 | name: "adb", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 265 | |
| 266 | defaults: ["adb_defaults"], |
| 267 | |
| 268 | srcs: [ |
| 269 | "client/adb_client.cpp", |
| 270 | "client/bugreport.cpp", |
| 271 | "client/commandline.cpp", |
| 272 | "client/file_sync_client.cpp", |
| 273 | "client/main.cpp", |
| 274 | "client/console.cpp", |
Idries Hamadi | 1ecee44 | 2018-01-29 16:30:36 +0000 | [diff] [blame] | 275 | "client/adb_install.cpp", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 276 | "client/line_printer.cpp", |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 277 | "client/fastdeploy.cpp", |
| 278 | "client/fastdeploycallbacks.cpp", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 279 | "shell_service_protocol.cpp", |
| 280 | ], |
| 281 | |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 282 | generated_headers: [ |
| 283 | "bin2c_fastdeployagent", |
| 284 | "bin2c_fastdeployagentscript" |
| 285 | ], |
| 286 | |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 287 | static_libs: [ |
| 288 | "libadb_host", |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 289 | "libandroidfw", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 290 | "libbase", |
| 291 | "libcutils", |
| 292 | "libcrypto_utils", |
| 293 | "libcrypto", |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 294 | "libfastdeploy_host", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 295 | "libdiagnose_usb", |
| 296 | "liblog", |
| 297 | "libmdnssd", |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 298 | "libprotobuf-cpp-lite", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 299 | "libusb", |
Idries Hamadi | 78330f0 | 2018-09-13 18:00:25 +0100 | [diff] [blame] | 300 | "libutils", |
| 301 | "liblog", |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 302 | "libziparchive", |
| 303 | "libz", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 304 | ], |
| 305 | |
| 306 | stl: "libc++_static", |
| 307 | |
| 308 | // Don't add anything here, we don't want additional shared dependencies |
| 309 | // on the host adb tool, and shared libraries that link against libc++ |
| 310 | // will violate ODR |
| 311 | shared_libs: [], |
| 312 | |
Dan Willemsen | 7024da4 | 2018-11-19 19:11:35 -0800 | [diff] [blame] | 313 | // Archive adb, adb.exe. |
| 314 | dist: { |
| 315 | targets: [ |
| 316 | "dist_files", |
| 317 | "sdk", |
| 318 | "win_sdk", |
| 319 | ], |
| 320 | }, |
| 321 | |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 322 | target: { |
| 323 | darwin: { |
| 324 | cflags: [ |
| 325 | "-Wno-sizeof-pointer-memaccess", |
| 326 | ], |
| 327 | }, |
| 328 | windows: { |
| 329 | enabled: true, |
| 330 | ldflags: ["-municode"], |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 331 | shared_libs: ["AdbWinApi"], |
| 332 | required: [ |
| 333 | "AdbWinUsbApi", |
| 334 | ], |
| 335 | }, |
| 336 | }, |
| 337 | } |
| 338 | |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 339 | // libadbd_core contains the common sources to build libadbd and libadbd_services. |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 340 | cc_library_static { |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 341 | name: "libadbd_core", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 342 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 343 | recovery_available: true, |
| 344 | |
| 345 | // libminadbd wants both, as it's used to build native tests. |
| 346 | compile_multilib: "both", |
| 347 | |
Josh Gao | dd71642 | 2019-07-11 13:47:44 -0700 | [diff] [blame] | 348 | srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [ |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 349 | "daemon/auth.cpp", |
| 350 | "daemon/jdwp_service.cpp", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 351 | ], |
| 352 | |
| 353 | local_include_dirs: [ |
| 354 | "daemon/include", |
| 355 | ], |
| 356 | |
Dan Willemsen | 1886189 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 357 | generated_headers: ["platform_tools_version"], |
| 358 | |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 359 | static_libs: [ |
Josh Gao | eb5e605 | 2019-06-19 14:14:57 -0700 | [diff] [blame] | 360 | "libadbconnection_server", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 361 | "libdiagnose_usb", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 362 | ], |
| 363 | |
| 364 | shared_libs: [ |
| 365 | "libasyncio", |
| 366 | "libbase", |
| 367 | "libcrypto", |
| 368 | "libcrypto_utils", |
| 369 | "libcutils", |
| 370 | "liblog", |
| 371 | ], |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 372 | |
| 373 | target: { |
| 374 | android: { |
| 375 | whole_static_libs: [ |
| 376 | "libqemu_pipe", |
| 377 | ], |
| 378 | srcs: [ |
| 379 | "daemon/transport_qemu.cpp", |
| 380 | "daemon/usb.cpp", |
| 381 | "daemon/usb_ffs.cpp", |
| 382 | "daemon/usb_legacy.cpp", |
| 383 | ] |
| 384 | }, |
| 385 | linux_glibc: { |
| 386 | srcs: [ |
| 387 | "daemon/usb_dummy.cpp", |
| 388 | ] |
| 389 | } |
| 390 | }, |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 391 | } |
| 392 | |
| 393 | cc_library { |
| 394 | name: "libadbd_services", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 395 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 396 | recovery_available: true, |
| 397 | compile_multilib: "both", |
| 398 | |
| 399 | srcs: [ |
| 400 | "daemon/file_sync_service.cpp", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 401 | "daemon/services.cpp", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 402 | "daemon/shell_service.cpp", |
| 403 | "shell_service_protocol.cpp", |
| 404 | ], |
| 405 | |
| 406 | cflags: [ |
| 407 | "-D_GNU_SOURCE", |
| 408 | "-Wno-deprecated-declarations", |
| 409 | ], |
| 410 | |
| 411 | static_libs: [ |
Josh Gao | eb5e605 | 2019-06-19 14:14:57 -0700 | [diff] [blame] | 412 | "libadbconnection_server", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 413 | "libadbd_core", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 414 | "libdiagnose_usb", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 415 | ], |
| 416 | |
| 417 | shared_libs: [ |
| 418 | "libasyncio", |
| 419 | "libbase", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 420 | "libcrypto", |
| 421 | "libcrypto_utils", |
| 422 | "libcutils", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 423 | "liblog", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 424 | ], |
Alex Buynytskyy | ef34f01 | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 425 | |
Mark Salyzyn | 81bcf58 | 2019-02-15 07:45:26 -0800 | [diff] [blame] | 426 | product_variables: { |
| 427 | debuggable: { |
| 428 | required: [ |
| 429 | "remount", |
| 430 | ], |
| 431 | }, |
| 432 | }, |
| 433 | |
Alex Buynytskyy | ef34f01 | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 434 | target: { |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 435 | android: { |
| 436 | srcs: [ |
| 437 | "daemon/abb_service.cpp", |
| 438 | "daemon/framebuffer_service.cpp", |
| 439 | "daemon/mdns.cpp", |
| 440 | "daemon/reboot_service.cpp", |
| 441 | "daemon/remount_service.cpp", |
| 442 | "daemon/restart_service.cpp", |
| 443 | "daemon/set_verity_enable_state_service.cpp", |
| 444 | ], |
| 445 | static_libs: [ |
| 446 | "libavb_user", |
| 447 | ], |
| 448 | shared_libs: [ |
| 449 | "libbootloader_message", |
| 450 | "libmdnssd", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 451 | "libfec", |
| 452 | "libfs_mgr", |
| 453 | "libselinux", |
| 454 | ], |
| 455 | }, |
Alex Buynytskyy | ef34f01 | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 456 | recovery: { |
| 457 | exclude_srcs: [ |
| 458 | "daemon/abb_service.cpp", |
| 459 | ], |
| 460 | }, |
| 461 | }, |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 462 | } |
| 463 | |
| 464 | cc_library { |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 465 | name: "libadbd", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 466 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | eb59039 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 467 | recovery_available: true, |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 468 | |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 469 | // Avoid getting duplicate symbol of android::build::GetBuildNumber(). |
| 470 | use_version_lib: false, |
| 471 | |
| 472 | // libminadbd wants both, as it's used to build native tests. |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 473 | compile_multilib: "both", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 474 | |
| 475 | // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library. |
| 476 | whole_static_libs: [ |
| 477 | "libadbd_core", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 478 | ], |
| 479 | |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 480 | shared_libs: [ |
| 481 | "libadbd_services", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 482 | "libasyncio", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 483 | "libbase", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 484 | "libcrypto", |
| 485 | "libcrypto_utils", |
| 486 | "libcutils", |
| 487 | "liblog", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 488 | ], |
Jerry Zhang | d4fe8b6 | 2018-05-07 15:14:47 -0700 | [diff] [blame] | 489 | |
| 490 | export_include_dirs: [ |
| 491 | "daemon/include", |
| 492 | ], |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 493 | } |
| 494 | |
| 495 | cc_binary { |
| 496 | name: "adbd", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 497 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | eb59039 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 498 | recovery_available: true, |
Josh Gao | 3e0540a | 2018-03-06 12:57:27 -0800 | [diff] [blame] | 499 | |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 500 | srcs: [ |
| 501 | "daemon/main.cpp", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 502 | ], |
| 503 | |
| 504 | cflags: [ |
| 505 | "-D_GNU_SOURCE", |
| 506 | "-Wno-deprecated-declarations", |
| 507 | ], |
| 508 | |
| 509 | strip: { |
| 510 | keep_symbols: true, |
| 511 | }, |
| 512 | |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 513 | shared_libs: [ |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 514 | "libadbd", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 515 | "libadbd_services", |
| 516 | "libbase", |
| 517 | "libcap", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 518 | "libcrypto", |
Tao Bao | 49042e3 | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 519 | "libcutils", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 520 | "liblog", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 521 | "libminijail", |
| 522 | "libselinux", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 523 | ], |
| 524 | } |
| 525 | |
Alex Buynytskyy | ef34f01 | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 526 | cc_binary { |
Josh Gao | 5836b3a | 2019-05-01 18:25:14 -0700 | [diff] [blame] | 527 | name: "static_adbd", |
| 528 | defaults: ["adbd_defaults", "host_adbd_supported"], |
| 529 | |
| 530 | recovery_available: false, |
| 531 | static_executable: true, |
| 532 | host_supported: false, |
| 533 | |
| 534 | srcs: [ |
| 535 | "daemon/main.cpp", |
| 536 | ], |
| 537 | |
| 538 | cflags: [ |
| 539 | "-D_GNU_SOURCE", |
| 540 | "-Wno-deprecated-declarations", |
| 541 | ], |
| 542 | |
| 543 | strip: { |
| 544 | keep_symbols: true, |
| 545 | }, |
| 546 | |
| 547 | static_libs: [ |
Josh Gao | eb5e605 | 2019-06-19 14:14:57 -0700 | [diff] [blame] | 548 | "libadbconnection_server", |
Josh Gao | 5836b3a | 2019-05-01 18:25:14 -0700 | [diff] [blame] | 549 | "libadbd", |
| 550 | "libadbd_services", |
| 551 | "libasyncio", |
| 552 | "libavb_user", |
| 553 | "libbase", |
| 554 | "libbootloader_message", |
| 555 | "libcap", |
| 556 | "libcrypto", |
| 557 | "libcrypto_utils", |
| 558 | "libcutils", |
| 559 | "libdiagnose_usb", |
| 560 | "libext4_utils", |
| 561 | "libfec", |
| 562 | "libfec_rs", |
| 563 | "libfs_mgr", |
| 564 | "liblog", |
| 565 | "liblp", |
| 566 | "libmdnssd", |
| 567 | "libminijail", |
| 568 | "libselinux", |
| 569 | "libsquashfs_utils", |
| 570 | ], |
| 571 | } |
| 572 | |
| 573 | cc_binary { |
Alex Buynytskyy | ef34f01 | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 574 | name: "abb", |
| 575 | |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 576 | defaults: ["adbd_defaults"], |
Alex Buynytskyy | ef34f01 | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 577 | recovery_available: false, |
| 578 | |
| 579 | srcs: [ |
| 580 | "daemon/abb.cpp", |
| 581 | ], |
| 582 | |
| 583 | cflags: [ |
| 584 | "-D_GNU_SOURCE", |
| 585 | "-Wno-deprecated-declarations", |
| 586 | ], |
| 587 | |
| 588 | strip: { |
| 589 | keep_symbols: true, |
| 590 | }, |
| 591 | |
| 592 | static_libs: [ |
| 593 | "libadbd_core", |
| 594 | "libadbd_services", |
| 595 | "libcmd", |
| 596 | ], |
| 597 | |
| 598 | shared_libs: [ |
| 599 | "libbase", |
| 600 | "libbinder", |
| 601 | "liblog", |
| 602 | "libutils", |
| 603 | "libselinux", |
| 604 | ], |
| 605 | } |
| 606 | |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 607 | cc_test { |
| 608 | name: "adbd_test", |
Josh Gao | 0560feb | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 609 | defaults: ["adbd_defaults"], |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 610 | srcs: libadb_test_srcs + [ |
Josh Gao | 5607e92 | 2018-07-25 18:15:52 -0700 | [diff] [blame] | 611 | "daemon/services.cpp", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 612 | "daemon/shell_service.cpp", |
| 613 | "daemon/shell_service_test.cpp", |
| 614 | "shell_service_protocol.cpp", |
| 615 | "shell_service_protocol_test.cpp", |
| 616 | ], |
| 617 | |
| 618 | static_libs: [ |
| 619 | "libadbd", |
| 620 | "libbase", |
Josh Gao | 5607e92 | 2018-07-25 18:15:52 -0700 | [diff] [blame] | 621 | "libbootloader_message", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 622 | "libcutils", |
| 623 | "libcrypto_utils", |
| 624 | "libcrypto", |
| 625 | "libdiagnose_usb", |
| 626 | "liblog", |
| 627 | "libusb", |
| 628 | "libmdnssd", |
Jiyong Park | 19c39fa | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 629 | "libselinux", |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 630 | ], |
Elliott Hughes | ce226c9 | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 631 | test_suites: ["device-tests"], |
Josh Gao | 361148b | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 632 | } |
| 633 | |
Julien Desprez | ae94f51 | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 634 | python_test_host { |
Elliott Hughes | 307e767 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 635 | name: "adb_integration_test_adb", |
| 636 | main: "test_adb.py", |
| 637 | srcs: [ |
| 638 | "test_adb.py", |
| 639 | ], |
Julien Desprez | ae94f51 | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 640 | test_config: "adb_integration_test_adb.xml", |
| 641 | test_suites: ["general-tests"], |
Elliott Hughes | 307e767 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 642 | version: { |
| 643 | py2: { |
Josh Gao | b1df00e | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 644 | enabled: false, |
Elliott Hughes | 307e767 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 645 | }, |
| 646 | py3: { |
Josh Gao | b1df00e | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 647 | enabled: true, |
Elliott Hughes | 307e767 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 648 | }, |
GuangHui Liu | 3599439 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 649 | }, |
GuangHui Liu | 3599439 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 650 | } |
| 651 | |
Julien Desprez | cd11d0d | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 652 | python_test_host { |
Elliott Hughes | 307e767 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 653 | name: "adb_integration_test_device", |
| 654 | main: "test_device.py", |
| 655 | srcs: [ |
| 656 | "test_device.py", |
| 657 | ], |
| 658 | libs: [ |
| 659 | "adb_py", |
| 660 | ], |
Julien Desprez | cd11d0d | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 661 | test_config: "adb_integration_test_device.xml", |
| 662 | test_suites: ["general-tests"], |
Elliott Hughes | 307e767 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 663 | version: { |
| 664 | py2: { |
| 665 | enabled: true, |
| 666 | }, |
| 667 | py3: { |
| 668 | enabled: false, |
| 669 | }, |
GuangHui Liu | 3599439 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 670 | }, |
GuangHui Liu | 3599439 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 671 | } |
Joshua Gilpatrick | 0d38411 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 672 | |
| 673 | // Note: using pipe for xxd to control the variable name generated |
| 674 | // the default name used by xxd is the path to the input file. |
| 675 | java_genrule { |
| 676 | name: "bin2c_fastdeployagent", |
| 677 | out: ["deployagent.inc"], |
| 678 | srcs: [":deployagent"], |
| 679 | cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)", |
| 680 | } |
| 681 | |
| 682 | genrule { |
| 683 | name: "bin2c_fastdeployagentscript", |
| 684 | out: ["deployagentscript.inc"], |
| 685 | srcs: ["fastdeploy/deployagent/deployagent.sh"], |
| 686 | cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)", |
| 687 | } |
| 688 | |
| 689 | cc_library_host_static { |
| 690 | name: "libfastdeploy_host", |
| 691 | defaults: ["adb_defaults"], |
| 692 | srcs: [ |
| 693 | "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp", |
| 694 | "fastdeploy/deploypatchgenerator/patch_utils.cpp", |
| 695 | "fastdeploy/proto/ApkEntry.proto", |
| 696 | ], |
| 697 | static_libs: [ |
| 698 | "libadb_host", |
| 699 | "libandroidfw", |
| 700 | "libbase", |
| 701 | "libcutils", |
| 702 | "libcrypto_utils", |
| 703 | "libcrypto", |
| 704 | "libdiagnose_usb", |
| 705 | "liblog", |
| 706 | "libmdnssd", |
| 707 | "libusb", |
| 708 | "libutils", |
| 709 | "libziparchive", |
| 710 | "libz", |
| 711 | ], |
| 712 | stl: "libc++_static", |
| 713 | proto: { |
| 714 | type: "lite", |
| 715 | export_proto_headers: true, |
| 716 | }, |
| 717 | target: { |
| 718 | windows: { |
| 719 | enabled: true, |
| 720 | shared_libs: ["AdbWinApi"], |
| 721 | }, |
| 722 | }, |
| 723 | } |
| 724 | |
| 725 | cc_test_host { |
| 726 | name: "fastdeploy_test", |
| 727 | defaults: ["adb_defaults"], |
| 728 | srcs: [ |
| 729 | "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp", |
| 730 | "fastdeploy/deploypatchgenerator/patch_utils_test.cpp", |
| 731 | ], |
| 732 | static_libs: [ |
| 733 | "libadb_host", |
| 734 | "libandroidfw", |
| 735 | "libbase", |
| 736 | "libcutils", |
| 737 | "libcrypto_utils", |
| 738 | "libcrypto", |
| 739 | "libdiagnose_usb", |
| 740 | "libfastdeploy_host", |
| 741 | "liblog", |
| 742 | "libmdnssd", |
| 743 | "libprotobuf-cpp-lite", |
| 744 | "libusb", |
| 745 | "libutils", |
| 746 | "libziparchive", |
| 747 | "libz", |
| 748 | ], |
| 749 | target: { |
| 750 | windows: { |
| 751 | enabled: true, |
| 752 | shared_libs: ["AdbWinApi"], |
| 753 | }, |
| 754 | }, |
| 755 | data: [ |
| 756 | "fastdeploy/testdata/rotating_cube-release.apk", |
| 757 | ], |
| 758 | } |