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", |
| 220 | "libmdnssd", |
| 221 | "libdiagnose_usb", |
| 222 | "libusb", |
| 223 | ], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 224 | |
| 225 | target: { |
| 226 | windows: { |
| 227 | enabled: true, |
Josh Gao | efd8ae2 | 2019-07-16 15:08:42 -0700 | [diff] [blame] | 228 | ldflags: ["-municode"], |
Josh Gao | f8a97c1 | 2018-03-23 15:37:20 -0700 | [diff] [blame] | 229 | shared_libs: ["AdbWinApi"], |
| 230 | }, |
| 231 | }, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 232 | } |
| 233 | |
Josh Gao | 9c59649 | 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", |
Colin Cross | f117f34 | 2019-09-18 11:04:35 -0700 | [diff] [blame] | 256 | "libcrypto_static", |
Josh Gao | 9c59649 | 2018-04-04 11:27:24 -0700 | [diff] [blame] | 257 | "libdiagnose_usb", |
| 258 | "liblog", |
| 259 | "libusb", |
| 260 | ], |
| 261 | } |
| 262 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 263 | cc_binary_host { |
| 264 | name: "adb", |
Josh Gao | 2776845 | 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 | ed409ea | 2018-01-29 16:30:36 +0000 | [diff] [blame] | 275 | "client/adb_install.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 276 | "client/line_printer.cpp", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 277 | "client/fastdeploy.cpp", |
| 278 | "client/fastdeploycallbacks.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 279 | "shell_service_protocol.cpp", |
| 280 | ], |
| 281 | |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 282 | generated_headers: [ |
| 283 | "bin2c_fastdeployagent", |
| 284 | "bin2c_fastdeployagentscript" |
| 285 | ], |
| 286 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 287 | static_libs: [ |
| 288 | "libadb_host", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 289 | "libandroidfw", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 290 | "libbase", |
| 291 | "libcutils", |
| 292 | "libcrypto_utils", |
| 293 | "libcrypto", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 294 | "libfastdeploy_host", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 295 | "libdiagnose_usb", |
| 296 | "liblog", |
| 297 | "libmdnssd", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 298 | "libprotobuf-cpp-lite", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 299 | "libusb", |
Idries Hamadi | 269a4b4 | 2018-09-13 18:00:25 +0100 | [diff] [blame] | 300 | "libutils", |
| 301 | "liblog", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 302 | "libziparchive", |
| 303 | "libz", |
Josh Gao | 2776845 | 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 | 3f439a7 | 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 | 2776845 | 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 | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 331 | shared_libs: ["AdbWinApi"], |
| 332 | required: [ |
| 333 | "AdbWinUsbApi", |
| 334 | ], |
| 335 | }, |
| 336 | }, |
| 337 | } |
| 338 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 339 | // libadbd_core contains the common sources to build libadbd and libadbd_services. |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 340 | cc_library_static { |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 341 | name: "libadbd_core", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 342 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | eca59ae | 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 | b43ad44 | 2019-07-11 13:47:44 -0700 | [diff] [blame] | 348 | srcs: libadb_srcs + libadb_linux_srcs + libadb_posix_srcs + [ |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 349 | "daemon/auth.cpp", |
| 350 | "daemon/jdwp_service.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 351 | ], |
| 352 | |
| 353 | local_include_dirs: [ |
| 354 | "daemon/include", |
| 355 | ], |
| 356 | |
Dan Willemsen | ab971b5 | 2018-08-29 14:58:02 -0700 | [diff] [blame] | 357 | generated_headers: ["platform_tools_version"], |
| 358 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 359 | static_libs: [ |
| 360 | "libdiagnose_usb", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 361 | ], |
| 362 | |
| 363 | shared_libs: [ |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 364 | "libadbconnection_server", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 365 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 366 | "libasyncio", |
| 367 | "libbase", |
| 368 | "libcrypto", |
| 369 | "libcrypto_utils", |
| 370 | "libcutils", |
| 371 | "liblog", |
| 372 | ], |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 373 | |
| 374 | target: { |
| 375 | android: { |
| 376 | whole_static_libs: [ |
| 377 | "libqemu_pipe", |
| 378 | ], |
| 379 | srcs: [ |
| 380 | "daemon/transport_qemu.cpp", |
| 381 | "daemon/usb.cpp", |
| 382 | "daemon/usb_ffs.cpp", |
| 383 | "daemon/usb_legacy.cpp", |
| 384 | ] |
| 385 | }, |
| 386 | linux_glibc: { |
| 387 | srcs: [ |
| 388 | "daemon/usb_dummy.cpp", |
| 389 | ] |
| 390 | } |
| 391 | }, |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 392 | } |
| 393 | |
| 394 | cc_library { |
| 395 | name: "libadbd_services", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 396 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 397 | recovery_available: true, |
| 398 | compile_multilib: "both", |
| 399 | |
| 400 | srcs: [ |
| 401 | "daemon/file_sync_service.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 402 | "daemon/services.cpp", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 403 | "daemon/shell_service.cpp", |
| 404 | "shell_service_protocol.cpp", |
| 405 | ], |
| 406 | |
| 407 | cflags: [ |
| 408 | "-D_GNU_SOURCE", |
| 409 | "-Wno-deprecated-declarations", |
| 410 | ], |
| 411 | |
| 412 | static_libs: [ |
| 413 | "libadbd_core", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 414 | "libdiagnose_usb", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 415 | ], |
| 416 | |
| 417 | shared_libs: [ |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 418 | "libadbconnection_server", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 419 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 420 | "libasyncio", |
| 421 | "libbase", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 422 | "libcrypto", |
| 423 | "libcrypto_utils", |
| 424 | "libcutils", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 425 | "liblog", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 426 | ], |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 427 | |
| 428 | target: { |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 429 | android: { |
| 430 | srcs: [ |
| 431 | "daemon/abb_service.cpp", |
| 432 | "daemon/framebuffer_service.cpp", |
| 433 | "daemon/mdns.cpp", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 434 | "daemon/restart_service.cpp", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 435 | ], |
| 436 | shared_libs: [ |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 437 | "libmdnssd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 438 | "libselinux", |
| 439 | ], |
| 440 | }, |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 441 | recovery: { |
| 442 | exclude_srcs: [ |
| 443 | "daemon/abb_service.cpp", |
| 444 | ], |
| 445 | }, |
| 446 | }, |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 447 | } |
| 448 | |
| 449 | cc_library { |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 450 | name: "libadbd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 451 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 452 | recovery_available: true, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 453 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 454 | // Avoid getting duplicate symbol of android::build::GetBuildNumber(). |
| 455 | use_version_lib: false, |
| 456 | |
| 457 | // libminadbd wants both, as it's used to build native tests. |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 458 | compile_multilib: "both", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 459 | |
| 460 | // libadbd doesn't build any additional source, but to expose libadbd_core as a shared library. |
| 461 | whole_static_libs: [ |
| 462 | "libadbd_core", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 463 | ], |
| 464 | |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 465 | shared_libs: [ |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 466 | "libadbconnection_server", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 467 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 468 | "libadbd_services", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 469 | "libasyncio", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 470 | "libbase", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 471 | "libcrypto", |
| 472 | "libcrypto_utils", |
| 473 | "libcutils", |
| 474 | "liblog", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 475 | ], |
Jerry Zhang | b156c60 | 2018-05-07 15:14:47 -0700 | [diff] [blame] | 476 | |
| 477 | export_include_dirs: [ |
| 478 | "daemon/include", |
| 479 | ], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | cc_binary { |
| 483 | name: "adbd", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 484 | defaults: ["adbd_defaults", "host_adbd_supported"], |
Jiyong Park | a0e7504 | 2018-05-24 14:11:00 +0900 | [diff] [blame] | 485 | recovery_available: true, |
Josh Gao | 8db99f8 | 2018-03-06 12:57:27 -0800 | [diff] [blame] | 486 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 487 | srcs: [ |
| 488 | "daemon/main.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 489 | ], |
| 490 | |
| 491 | cflags: [ |
| 492 | "-D_GNU_SOURCE", |
| 493 | "-Wno-deprecated-declarations", |
| 494 | ], |
| 495 | |
| 496 | strip: { |
| 497 | keep_symbols: true, |
| 498 | }, |
| 499 | |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 500 | stl: "libc++_static", |
| 501 | static_libs: [ |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 502 | "libadbd", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 503 | "libadbd_auth", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 504 | "libadbd_services", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 505 | "libasyncio", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 506 | "libbase", |
| 507 | "libcap", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 508 | "libcrypto_utils", |
Tao Bao | eca59ae | 2018-07-30 20:45:27 -0700 | [diff] [blame] | 509 | "libcutils", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 510 | "libdiagnose_usb", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 511 | "liblog", |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 512 | "libmdnssd", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 513 | "libminijail", |
| 514 | "libselinux", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 515 | ], |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 516 | |
| 517 | shared_libs: [ |
| 518 | "libadbconnection_server", |
| 519 | "libcrypto", |
| 520 | ], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 521 | } |
| 522 | |
Josh Gao | 7b7ee19 | 2019-10-23 13:27:17 -0700 | [diff] [blame] | 523 | phony { |
| 524 | name: "adbd_system_binaries", |
| 525 | required: [ |
| 526 | "abb", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 527 | "libadbd_auth", |
Josh Gao | 2c356bb | 2019-10-22 12:30:36 -0700 | [diff] [blame] | 528 | "reboot", |
Josh Gao | f61f414 | 2019-10-22 12:30:30 -0700 | [diff] [blame] | 529 | "set-verity-state", |
Josh Gao | 7b7ee19 | 2019-10-23 13:27:17 -0700 | [diff] [blame] | 530 | ] |
| 531 | } |
| 532 | |
| 533 | phony { |
| 534 | name: "adbd_system_binaries_recovery", |
| 535 | required: [ |
Josh Gao | 2c356bb | 2019-10-22 12:30:36 -0700 | [diff] [blame] | 536 | "reboot.recovery", |
Josh Gao | 7b7ee19 | 2019-10-23 13:27:17 -0700 | [diff] [blame] | 537 | ], |
| 538 | } |
| 539 | |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 540 | cc_binary { |
| 541 | name: "abb", |
| 542 | |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 543 | defaults: ["adbd_defaults"], |
Alex Buynytskyy | 640407d | 2018-12-12 10:48:50 -0800 | [diff] [blame] | 544 | recovery_available: false, |
| 545 | |
| 546 | srcs: [ |
| 547 | "daemon/abb.cpp", |
| 548 | ], |
| 549 | |
| 550 | cflags: [ |
| 551 | "-D_GNU_SOURCE", |
| 552 | "-Wno-deprecated-declarations", |
| 553 | ], |
| 554 | |
| 555 | strip: { |
| 556 | keep_symbols: true, |
| 557 | }, |
| 558 | |
| 559 | static_libs: [ |
| 560 | "libadbd_core", |
| 561 | "libadbd_services", |
| 562 | "libcmd", |
| 563 | ], |
| 564 | |
| 565 | shared_libs: [ |
| 566 | "libbase", |
| 567 | "libbinder", |
| 568 | "liblog", |
| 569 | "libutils", |
| 570 | "libselinux", |
| 571 | ], |
| 572 | } |
| 573 | |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 574 | cc_test { |
| 575 | name: "adbd_test", |
Josh Gao | 776c2ec | 2019-01-22 19:36:15 -0800 | [diff] [blame] | 576 | defaults: ["adbd_defaults"], |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 577 | srcs: libadb_test_srcs + [ |
Josh Gao | 997cfac | 2018-07-25 18:15:52 -0700 | [diff] [blame] | 578 | "daemon/services.cpp", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 579 | "daemon/shell_service.cpp", |
| 580 | "daemon/shell_service_test.cpp", |
| 581 | "shell_service_protocol.cpp", |
| 582 | "shell_service_protocol_test.cpp", |
| 583 | ], |
| 584 | |
| 585 | static_libs: [ |
| 586 | "libadbd", |
Josh Gao | 2752326 | 2019-10-22 12:30:39 -0700 | [diff] [blame] | 587 | "libadbd_auth", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 588 | "libbase", |
| 589 | "libcutils", |
| 590 | "libcrypto_utils", |
Colin Cross | f117f34 | 2019-09-18 11:04:35 -0700 | [diff] [blame] | 591 | "libcrypto_static", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 592 | "libdiagnose_usb", |
| 593 | "liblog", |
| 594 | "libusb", |
| 595 | "libmdnssd", |
Jiyong Park | 011ee12 | 2018-05-29 16:41:30 +0900 | [diff] [blame] | 596 | "libselinux", |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 597 | ], |
Elliott Hughes | 40fdf3f | 2018-04-27 16:12:06 -0700 | [diff] [blame] | 598 | test_suites: ["device-tests"], |
Dan Shi | d1360f4 | 2019-09-24 09:04:05 -0700 | [diff] [blame] | 599 | require_root: true, |
Josh Gao | 2776845 | 2018-01-02 12:01:43 -0800 | [diff] [blame] | 600 | } |
| 601 | |
Julien Desprez | 75fea7e | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 602 | python_test_host { |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 603 | name: "adb_integration_test_adb", |
| 604 | main: "test_adb.py", |
| 605 | srcs: [ |
| 606 | "test_adb.py", |
| 607 | ], |
Julien Desprez | 75fea7e | 2018-08-08 12:08:50 -0700 | [diff] [blame] | 608 | test_config: "adb_integration_test_adb.xml", |
| 609 | test_suites: ["general-tests"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 610 | version: { |
| 611 | py2: { |
Josh Gao | 9b6522b | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 612 | enabled: false, |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 613 | }, |
| 614 | py3: { |
Josh Gao | 9b6522b | 2018-08-07 14:31:17 -0700 | [diff] [blame] | 615 | enabled: true, |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 616 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 617 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 618 | } |
| 619 | |
Julien Desprez | 618f0e1 | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 620 | python_test_host { |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 621 | name: "adb_integration_test_device", |
| 622 | main: "test_device.py", |
| 623 | srcs: [ |
| 624 | "test_device.py", |
| 625 | ], |
| 626 | libs: [ |
| 627 | "adb_py", |
| 628 | ], |
Julien Desprez | 618f0e1 | 2018-10-12 13:48:14 -0700 | [diff] [blame] | 629 | test_config: "adb_integration_test_device.xml", |
| 630 | test_suites: ["general-tests"], |
Elliott Hughes | dc699a2 | 2018-02-16 17:58:14 -0800 | [diff] [blame] | 631 | version: { |
| 632 | py2: { |
| 633 | enabled: true, |
| 634 | }, |
| 635 | py3: { |
| 636 | enabled: false, |
| 637 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 638 | }, |
GuangHui Liu | 41bda34 | 2017-05-10 14:37:17 -0700 | [diff] [blame] | 639 | } |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 640 | |
| 641 | // Note: using pipe for xxd to control the variable name generated |
| 642 | // the default name used by xxd is the path to the input file. |
| 643 | java_genrule { |
| 644 | name: "bin2c_fastdeployagent", |
| 645 | out: ["deployagent.inc"], |
| 646 | srcs: [":deployagent"], |
| 647 | cmd: "(echo 'unsigned char kDeployAgent[] = {' && xxd -i <$(in) && echo '};') > $(out)", |
| 648 | } |
| 649 | |
| 650 | genrule { |
| 651 | name: "bin2c_fastdeployagentscript", |
| 652 | out: ["deployagentscript.inc"], |
| 653 | srcs: ["fastdeploy/deployagent/deployagent.sh"], |
| 654 | cmd: "(echo 'unsigned char kDeployAgentScript[] = {' && xxd -i <$(in) && echo '};') > $(out)", |
| 655 | } |
| 656 | |
| 657 | cc_library_host_static { |
| 658 | name: "libfastdeploy_host", |
| 659 | defaults: ["adb_defaults"], |
| 660 | srcs: [ |
Alex Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 661 | "fastdeploy/deploypatchgenerator/apk_archive.cpp", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 662 | "fastdeploy/deploypatchgenerator/deploy_patch_generator.cpp", |
| 663 | "fastdeploy/deploypatchgenerator/patch_utils.cpp", |
| 664 | "fastdeploy/proto/ApkEntry.proto", |
| 665 | ], |
| 666 | static_libs: [ |
| 667 | "libadb_host", |
| 668 | "libandroidfw", |
| 669 | "libbase", |
| 670 | "libcutils", |
| 671 | "libcrypto_utils", |
| 672 | "libcrypto", |
| 673 | "libdiagnose_usb", |
| 674 | "liblog", |
| 675 | "libmdnssd", |
| 676 | "libusb", |
| 677 | "libutils", |
| 678 | "libziparchive", |
| 679 | "libz", |
| 680 | ], |
| 681 | stl: "libc++_static", |
| 682 | proto: { |
| 683 | type: "lite", |
| 684 | export_proto_headers: true, |
| 685 | }, |
| 686 | target: { |
| 687 | windows: { |
| 688 | enabled: true, |
| 689 | shared_libs: ["AdbWinApi"], |
| 690 | }, |
| 691 | }, |
| 692 | } |
| 693 | |
| 694 | cc_test_host { |
| 695 | name: "fastdeploy_test", |
| 696 | defaults: ["adb_defaults"], |
| 697 | srcs: [ |
Alex Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 698 | "fastdeploy/deploypatchgenerator/apk_archive_test.cpp", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 699 | "fastdeploy/deploypatchgenerator/deploy_patch_generator_test.cpp", |
| 700 | "fastdeploy/deploypatchgenerator/patch_utils_test.cpp", |
| 701 | ], |
| 702 | static_libs: [ |
| 703 | "libadb_host", |
| 704 | "libandroidfw", |
| 705 | "libbase", |
| 706 | "libcutils", |
| 707 | "libcrypto_utils", |
| 708 | "libcrypto", |
| 709 | "libdiagnose_usb", |
| 710 | "libfastdeploy_host", |
| 711 | "liblog", |
| 712 | "libmdnssd", |
| 713 | "libprotobuf-cpp-lite", |
| 714 | "libusb", |
| 715 | "libutils", |
| 716 | "libziparchive", |
| 717 | "libz", |
| 718 | ], |
| 719 | target: { |
| 720 | windows: { |
| 721 | enabled: true, |
| 722 | shared_libs: ["AdbWinApi"], |
| 723 | }, |
| 724 | }, |
| 725 | data: [ |
Alex Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 726 | "fastdeploy/testdata/rotating_cube-metadata-release.data", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 727 | "fastdeploy/testdata/rotating_cube-release.apk", |
Alex Buynytskyy | 665f3ff | 2019-09-16 12:10:54 -0700 | [diff] [blame] | 728 | "fastdeploy/testdata/sample.apk", |
| 729 | "fastdeploy/testdata/sample.cd", |
Joshua Gilpatrick | af3ce08 | 2019-07-19 09:42:12 -0700 | [diff] [blame] | 730 | ], |
| 731 | } |
Josh Gao | 594f70f | 2019-08-15 14:05:12 -0700 | [diff] [blame] | 732 | |
| 733 | prebuilt_etc { |
| 734 | name: "com.android.adbd.ld.config.txt", |
| 735 | src: "apex/ld.config.txt", |
| 736 | filename: "ld.config.txt", |
| 737 | installable: false, |
| 738 | } |
| 739 | |
| 740 | apex { |
| 741 | name: "com.android.adbd", |
| 742 | manifest: "apex/apex_manifest.json", |
| 743 | |
| 744 | binaries: ["adbd"], |
| 745 | prebuilts: ["com.android.adbd.init.rc", "com.android.adbd.ld.config.txt"], |
| 746 | |
| 747 | key: "com.android.adbd.key", |
| 748 | certificate: ":com.android.adbd.certificate", |
| 749 | } |
| 750 | |
| 751 | apex_key { |
| 752 | name: "com.android.adbd.key", |
| 753 | public_key: "apex/com.android.adbd.avbpubkey", |
| 754 | private_key: "apex/com.android.adbd.pem", |
| 755 | } |
| 756 | |
| 757 | android_app_certificate { |
| 758 | name: "com.android.adbd.certificate", |
| 759 | certificate: "apex/com.android.adbd", |
| 760 | } |
| 761 | |
| 762 | prebuilt_etc { |
| 763 | name: "com.android.adbd.init.rc", |
| 764 | src: "apex/adbd.rc", |
| 765 | filename: "init.rc", |
| 766 | installable: false, |
| 767 | } |