1// 2// Copyright (C) 2018 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package { 18 default_applicable_licenses: ["Android-Apache-2.0"], 19} 20 21cc_defaults { 22 name: "libsnapshot_defaults", 23 defaults: ["fs_mgr_defaults"], 24 cflags: [ 25 "-D_FILE_OFFSET_BITS=64", 26 "-Wall", 27 "-Werror", 28 ], 29 shared_libs: [ 30 "libbase", 31 "libchrome", 32 "libcutils", 33 "liblog", 34 ], 35 static_libs: [ 36 "libbrotli", 37 "libdm", 38 "libfstab", 39 "update_metadata-protos", 40 ], 41 whole_static_libs: [ 42 "libbrotli", 43 "libcutils", 44 "libext2_uuid", 45 "libext4_utils", 46 "libfstab", 47 "libsnapshot_snapuserd", 48 "libz", 49 ], 50 header_libs: [ 51 "libfiemap_headers", 52 "libstorage_literals_headers", 53 "libupdate_engine_headers", 54 ], 55 export_static_lib_headers: [ 56 "update_metadata-protos", 57 ], 58 export_header_lib_headers: [ 59 "libfiemap_headers", 60 ], 61 export_include_dirs: ["include"], 62 proto: { 63 type: "lite", 64 export_proto_headers: true, 65 canonical_path_from_root: false, 66 }, 67} 68 69cc_defaults { 70 name: "libsnapshot_hal_deps", 71 cflags: [ 72 "-DLIBSNAPSHOT_USE_HAL", 73 ], 74 shared_libs: [ 75 "android.hardware.boot@1.0", 76 "android.hardware.boot@1.1", 77 "android.hardware.boot-V1-ndk", 78 "libboot_control_client", 79 ], 80} 81 82filegroup { 83 name: "libsnapshot_sources", 84 srcs: [ 85 "android/snapshot/snapshot.proto", 86 "device_info.cpp", 87 "snapshot.cpp", 88 "snapshot_reader.cpp", 89 "snapshot_stats.cpp", 90 "snapshot_stub.cpp", 91 "snapshot_metadata_updater.cpp", 92 "snapshot_writer.cpp", 93 "partition_cow_creator.cpp", 94 "return.cpp", 95 "utility.cpp", 96 ], 97} 98 99cc_library_headers { 100 name: "libsnapshot_headers", 101 recovery_available: true, 102 defaults: ["libsnapshot_defaults"], 103} 104 105cc_library_static { 106 name: "libsnapshot", 107 defaults: [ 108 "libsnapshot_defaults", 109 "libsnapshot_hal_deps", 110 ], 111 srcs: [":libsnapshot_sources"], 112 static_libs: [ 113 "libfs_mgr_binder" 114 ], 115} 116 117cc_library_static { 118 name: "libsnapshot_init", 119 native_coverage : true, 120 defaults: ["libsnapshot_defaults"], 121 srcs: [":libsnapshot_sources"], 122 ramdisk_available: true, 123 recovery_available: true, 124 cflags: [ 125 "-DLIBSNAPSHOT_NO_COW_WRITE", 126 ], 127 static_libs: [ 128 "libfs_mgr", 129 ], 130} 131 132cc_library_static { 133 name: "libsnapshot_nobinder", 134 defaults: [ 135 "libsnapshot_defaults", 136 "libsnapshot_hal_deps", 137 ], 138 srcs: [":libsnapshot_sources"], 139 recovery_available: true, 140 cflags: [ 141 "-DLIBSNAPSHOT_NO_COW_WRITE", 142 ], 143 static_libs: [ 144 "libfs_mgr", 145 ], 146} 147 148cc_defaults { 149 name: "libsnapshot_cow_defaults", 150 defaults: [ 151 "fs_mgr_defaults", 152 ], 153 cflags: [ 154 "-D_FILE_OFFSET_BITS=64", 155 "-Wall", 156 "-Werror", 157 ], 158 shared_libs: [ 159 "libbase", 160 "liblog", 161 ], 162 static_libs: [ 163 "libbrotli", 164 "libz", 165 "liblz4", 166 ], 167 export_include_dirs: ["include"], 168} 169 170cc_library_static { 171 name: "libsnapshot_cow", 172 defaults: [ 173 "libsnapshot_cow_defaults", 174 ], 175 srcs: [ 176 "libsnapshot_cow/cow_decompress.cpp", 177 "libsnapshot_cow/cow_reader.cpp", 178 "libsnapshot_cow/cow_writer.cpp", 179 "libsnapshot_cow/cow_format.cpp", 180 "libsnapshot_cow/cow_compress.cpp", 181 ], 182 host_supported: true, 183 recovery_available: true, 184 ramdisk_available: true, 185 vendor_ramdisk_available: true, 186} 187 188cc_library_static { 189 name: "libsnapshot_test_helpers", 190 defaults: ["libsnapshot_defaults"], 191 export_include_dirs: [ 192 "include_test", 193 ], 194 srcs: [ 195 "android/snapshot/snapshot.proto", 196 "test_helpers.cpp", 197 ], 198 shared_libs: [ 199 "android.hardware.boot@1.1", 200 "libcrypto", 201 ], 202 export_shared_lib_headers: [ 203 "android.hardware.boot@1.1", 204 ], 205 header_libs: [ 206 "libstorage_literals_headers", 207 ], 208 export_header_lib_headers: [ 209 "libstorage_literals_headers", 210 ], 211 static_libs: [ 212 "libfs_mgr", 213 "libgmock", 214 "libgtest", 215 ], 216} 217 218cc_defaults { 219 name: "libsnapshot_test_defaults", 220 defaults: ["libsnapshot_defaults", "libsnapshot_cow_defaults"], 221 srcs: [ 222 "partition_cow_creator_test.cpp", 223 "snapshot_metadata_updater_test.cpp", 224 "snapshot_reader_test.cpp", 225 "snapshot_test.cpp", 226 "snapshot_writer_test.cpp", 227 ], 228 shared_libs: [ 229 "libbinder", 230 "libcrypto", 231 "libhidlbase", 232 "libprotobuf-cpp-lite", 233 "libutils", 234 "libz", 235 ], 236 static_libs: [ 237 "android.hardware.boot@1.0", 238 "android.hardware.boot@1.1", 239 "android.hardware.boot-V1-ndk", 240 "libbrotli", 241 "libc++fs", 242 "libfs_mgr_binder", 243 "libgflags", 244 "libgsi", 245 "libgmock", 246 "liblp", 247 "libsnapshot", 248 "libsnapshot_cow", 249 "libsnapshot_test_helpers", 250 "libsparse", 251 ], 252 header_libs: [ 253 "libstorage_literals_headers", 254 ], 255 auto_gen_config: true, 256 require_root: true, 257 compile_multilib: "first", 258} 259 260cc_test { 261 name: "vts_libsnapshot_test", 262 defaults: ["libsnapshot_test_defaults", "libsnapshot_hal_deps"], 263 test_suites: [ 264 "vts", 265 "device-tests" 266 ], 267 test_options: { 268 min_shipping_api_level: 30, 269 }, 270} 271 272cc_test { 273 name: "vab_legacy_tests", 274 defaults: ["libsnapshot_test_defaults", "libsnapshot_hal_deps"], 275 cppflags: [ 276 "-DLIBSNAPSHOT_TEST_VAB_LEGACY", 277 ], 278 test_suites: [ 279 "device-tests" 280 ], 281 test_options: { 282 // Legacy VAB launched in Android R. 283 min_shipping_api_level: 30, 284 }, 285} 286 287cc_test { 288 name: "vabc_legacy_tests", 289 defaults: ["libsnapshot_test_defaults", "libsnapshot_hal_deps"], 290 cppflags: [ 291 "-DLIBSNAPSHOT_TEST_VABC_LEGACY", 292 ], 293 test_suites: [ 294 "device-tests" 295 ], 296 test_options: { 297 // Legacy VABC launched in Android S. 298 min_shipping_api_level: 31, 299 }, 300} 301 302cc_test { 303 name: "vts_ota_config_test", 304 srcs: [ 305 "vts_ota_config_test.cpp", 306 ], 307 shared_libs: [ 308 "libbase", 309 ], 310 test_suites: [ 311 "vts", 312 ], 313 test_options: { 314 min_shipping_api_level: 33, 315 }, 316 auto_gen_config: true, 317 require_root: true, 318} 319 320cc_binary { 321 name: "snapshotctl", 322 defaults: ["libsnapshot_cow_defaults", "libsnapshot_hal_deps"], 323 srcs: [ 324 "snapshotctl.cpp", 325 ], 326 static_libs: [ 327 "libbrotli", 328 "libc++fs", 329 "libfstab", 330 "libsnapshot", 331 "libsnapshot_cow", 332 "libz", 333 "update_metadata-protos", 334 ], 335 shared_libs: [ 336 "libbase", 337 "libext2_uuid", 338 "libext4_utils", 339 "libfs_mgr_binder", 340 "libhidlbase", 341 "liblog", 342 "liblp", 343 "libprotobuf-cpp-lite", 344 "libstatslog", 345 "libutils", 346 ], 347 header_libs: [ 348 "libstorage_literals_headers", 349 ], 350 product_variables: { 351 debuggable: { 352 cppflags: [ 353 "-DSNAPSHOTCTL_USERDEBUG_OR_ENG", 354 ], 355 shared_libs: [ 356 "android.hardware.boot@1.0", 357 "android.hardware.boot@1.1", 358 "android.hardware.boot-V1-ndk", 359 "libboot_control_client", 360 ], 361 }, 362 }, 363} 364 365cc_test { 366 name: "cow_api_test", 367 defaults: [ 368 "fs_mgr_defaults", 369 "libsnapshot_cow_defaults", 370 ], 371 srcs: [ 372 "libsnapshot_cow/cow_api_test.cpp", 373 ], 374 cflags: [ 375 "-D_FILE_OFFSET_BITS=64", 376 "-Wall", 377 "-Werror", 378 ], 379 shared_libs: [ 380 "libbase", 381 "libcrypto", 382 "liblog", 383 "libz", 384 ], 385 static_libs: [ 386 "libbrotli", 387 "libgtest", 388 "libsnapshot_cow", 389 ], 390 test_suites: [ 391 "device-tests" 392 ], 393 test_options: { 394 min_shipping_api_level: 30, 395 }, 396 auto_gen_config: true, 397 require_root: false, 398 host_supported: true, 399} 400 401cc_binary { 402 name: "inspect_cow", 403 host_supported: true, 404 device_supported: true, 405 defaults: ["libsnapshot_cow_defaults"], 406 cflags: [ 407 "-D_FILE_OFFSET_BITS=64", 408 "-Wall", 409 "-Werror", 410 ], 411 static_libs: [ 412 "libbase", 413 "libbrotli", 414 "libcrypto_static", 415 "liblog", 416 "libsnapshot_cow", 417 "libz", 418 ], 419 shared_libs: [ 420 ], 421 srcs: [ 422 "libsnapshot_cow/inspect_cow.cpp", 423 ], 424} 425 426python_library_host { 427 name: "snapshot_proto_python", 428 srcs: [ 429 "android/snapshot/snapshot.proto", 430 ], 431 proto: { 432 canonical_path_from_root: false, 433 }, 434} 435