1// Copyright (C) 2019 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 15// 16// Module-specific defaults. 17// 18// For module X, if we need to build it both as a library and an executable: 19// - A default rule `releasetools_X_defaults` is created, which lists `srcs`, `libs` and 20// `required` properties. 21// - `python_library_host` and `python_binary_host` are created by listing 22// `releasetools_X_defaults` in their defaults. 23// 24 25python_defaults { 26 name: "releasetools_add_img_to_target_files_defaults", 27 srcs: [ 28 "add_img_to_target_files.py", 29 ], 30 libs: [ 31 "releasetools_build_image", 32 "releasetools_build_super_image", 33 "releasetools_common", 34 ], 35 required: [ 36 "care_map_generator", 37 ], 38} 39 40python_defaults { 41 name: "releasetools_build_image_defaults", 42 srcs: [ 43 "build_image.py", 44 ], 45 libs: [ 46 "releasetools_common", 47 "releasetools_verity_utils", 48 ], 49 required: [ 50 "blk_alloc_to_base_fs", 51 "e2fsck", 52 "simg2img", 53 "tune2fs", 54 ], 55} 56 57python_defaults { 58 name: "releasetools_build_super_image_defaults", 59 srcs: [ 60 "build_super_image.py", 61 ], 62 libs: [ 63 "releasetools_common", 64 ], 65} 66 67python_defaults { 68 name: "releasetools_img_from_target_files_defaults", 69 srcs: [ 70 "img_from_target_files.py", 71 ], 72 libs: [ 73 "releasetools_build_super_image", 74 "releasetools_common", 75 ], 76} 77 78python_defaults { 79 name: "releasetools_check_target_files_vintf_defaults", 80 srcs: [ 81 "check_target_files_vintf.py", 82 ], 83 libs: [ 84 "releasetools_common", 85 ], 86 required: [ 87 "checkvintf", 88 ], 89} 90 91python_defaults { 92 name: "releasetools_ota_from_target_files_defaults", 93 srcs: [ 94 "edify_generator.py", 95 "ota_from_target_files.py", 96 "target_files_diff.py", 97 ], 98 libs: [ 99 "releasetools_check_target_files_vintf", 100 "releasetools_common", 101 "releasetools_verity_utils", 102 ], 103 required: [ 104 "brillo_update_payload", 105 "checkvintf", 106 ], 107} 108 109// 110// Host libraries. 111// 112 113python_defaults { 114 name: "releasetools_library_defaults", 115 version: { 116 py2: { 117 enabled: true, 118 }, 119 py3: { 120 enabled: true, 121 }, 122 }, 123} 124 125python_library_host { 126 name: "releasetools_add_img_to_target_files", 127 defaults: [ 128 "releasetools_library_defaults", 129 "releasetools_add_img_to_target_files_defaults", 130 ], 131} 132 133python_library_host { 134 name: "releasetools_apex_utils", 135 defaults: ["releasetools_library_defaults"], 136 srcs: [ 137 "apex_utils.py", 138 ], 139 libs: [ 140 "releasetools_common", 141 ], 142} 143 144python_library_host { 145 name: "releasetools_build_image", 146 defaults: [ 147 "releasetools_library_defaults", 148 "releasetools_build_image_defaults", 149 ], 150} 151 152python_library_host { 153 name: "releasetools_build_super_image", 154 defaults: [ 155 "releasetools_library_defaults", 156 "releasetools_build_super_image_defaults", 157 ], 158} 159 160python_library_host { 161 name: "releasetools_check_target_files_vintf", 162 defaults: [ 163 "releasetools_library_defaults", 164 "releasetools_check_target_files_vintf_defaults", 165 ], 166} 167 168python_library_host { 169 name: "releasetools_common", 170 defaults: ["releasetools_library_defaults"], 171 srcs: [ 172 "blockimgdiff.py", 173 "common.py", 174 "images.py", 175 "rangelib.py", 176 "sparse_img.py", 177 ], 178 // Only the tools that are referenced directly are listed as required modules. For example, 179 // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool']. 180 required: [ 181 "aapt2", 182 "boot_signer", 183 "brotli", 184 "bsdiff", 185 "imgdiff", 186 "minigzip", 187 "lz4", 188 "mkbootfs", 189 "signapk", 190 ], 191} 192 193python_library_host { 194 name: "releasetools_img_from_target_files", 195 defaults: [ 196 "releasetools_library_defaults", 197 "releasetools_img_from_target_files_defaults", 198 ], 199} 200 201python_library_host { 202 name: "releasetools_ota_from_target_files", 203 defaults: [ 204 "releasetools_library_defaults", 205 "releasetools_ota_from_target_files_defaults", 206 ], 207} 208 209python_library_host { 210 name: "releasetools_verity_utils", 211 defaults: ["releasetools_library_defaults"], 212 srcs: [ 213 "verity_utils.py", 214 ], 215 required: [ 216 "append2simg", 217 "build_verity_metadata", 218 "build_verity_tree", 219 "fec", 220 ], 221} 222 223// 224// Host binaries. 225// 226 227python_defaults { 228 name: "releasetools_binary_defaults", 229 version: { 230 py2: { 231 enabled: true, 232 embedded_launcher: true, 233 }, 234 py3: { 235 enabled: false, 236 embedded_launcher: false, 237 }, 238 }, 239 // TODO (b/140144201) Build imgdiff from releasetools_common 240 required: [ 241 "aapt2", 242 "boot_signer", 243 "brotli", 244 "bsdiff", 245 "imgdiff", 246 "minigzip", 247 "mkbootfs", 248 ], 249} 250 251python_binary_host { 252 name: "add_img_to_target_files", 253 defaults: [ 254 "releasetools_binary_defaults", 255 "releasetools_add_img_to_target_files_defaults", 256 ], 257} 258 259python_binary_host { 260 name: "build_image", 261 defaults: [ 262 "releasetools_binary_defaults", 263 "releasetools_build_image_defaults", 264 ], 265} 266 267python_binary_host { 268 name: "build_super_image", 269 defaults: [ 270 "releasetools_binary_defaults", 271 "releasetools_build_super_image_defaults", 272 ], 273} 274 275python_binary_host { 276 name: "check_partition_sizes", 277 srcs: [ 278 "check_partition_sizes.py", 279 ], 280 libs: [ 281 "releasetools_common", 282 ], 283 defaults: [ 284 "releasetools_binary_defaults", 285 ], 286} 287 288python_binary_host { 289 name: "check_ota_package_signature", 290 defaults: ["releasetools_binary_defaults"], 291 srcs: [ 292 "check_ota_package_signature.py", 293 ], 294 libs: [ 295 "releasetools_common", 296 ], 297 required: [ 298 "delta_generator", 299 ], 300} 301 302python_binary_host { 303 name: "check_target_files_signatures", 304 defaults: ["releasetools_binary_defaults"], 305 srcs: [ 306 "check_target_files_signatures.py", 307 ], 308 libs: [ 309 "releasetools_common", 310 ], 311 required: [ 312 "aapt", 313 ], 314} 315 316python_binary_host { 317 name: "check_target_files_vintf", 318 defaults: [ 319 "releasetools_binary_defaults", 320 "releasetools_check_target_files_vintf_defaults" 321 ], 322} 323 324python_binary_host { 325 name: "img_from_target_files", 326 defaults: [ 327 "releasetools_binary_defaults", 328 "releasetools_img_from_target_files_defaults", 329 ], 330} 331 332python_binary_host { 333 name: "make_recovery_patch", 334 defaults: ["releasetools_binary_defaults"], 335 srcs: [ 336 "make_recovery_patch.py", 337 ], 338 libs: [ 339 "releasetools_common", 340 ], 341} 342 343python_binary_host { 344 name: "merge_builds", 345 defaults: ["releasetools_binary_defaults"], 346 srcs: [ 347 "merge_builds.py", 348 ], 349 libs: [ 350 "releasetools_build_super_image", 351 "releasetools_common", 352 ], 353} 354 355python_binary_host { 356 name: "merge_target_files", 357 defaults: ["releasetools_binary_defaults"], 358 srcs: [ 359 "merge_target_files.py", 360 ], 361 libs: [ 362 "releasetools_add_img_to_target_files", 363 "releasetools_build_super_image", 364 "releasetools_check_target_files_vintf", 365 "releasetools_common", 366 "releasetools_img_from_target_files", 367 "releasetools_ota_from_target_files", 368 ], 369 required: [ 370 "checkvintf", 371 ], 372} 373 374python_binary_host { 375 name: "ota_from_target_files", 376 defaults: [ 377 "releasetools_binary_defaults", 378 "releasetools_ota_from_target_files_defaults", 379 ], 380} 381 382python_binary_host { 383 name: "ota_package_parser", 384 defaults: ["releasetools_binary_defaults"], 385 srcs: [ 386 "ota_package_parser.py", 387 "rangelib.py", 388 ], 389} 390 391python_binary_host { 392 name: "sparse_img", 393 defaults: ["releasetools_binary_defaults"], 394 srcs: [ 395 "rangelib.py", 396 "sparse_img.py", 397 ], 398} 399 400python_binary_host { 401 name: "sign_apex", 402 defaults: ["releasetools_binary_defaults"], 403 srcs: [ 404 "sign_apex.py", 405 ], 406 libs: [ 407 "releasetools_apex_utils", 408 "releasetools_common", 409 ], 410} 411 412python_binary_host { 413 name: "sign_target_files_apks", 414 defaults: ["releasetools_binary_defaults"], 415 srcs: [ 416 "sign_target_files_apks.py", 417 ], 418 libs: [ 419 "releasetools_add_img_to_target_files", 420 "releasetools_apex_utils", 421 "releasetools_common", 422 ], 423} 424 425python_binary_host { 426 name: "validate_target_files", 427 defaults: ["releasetools_binary_defaults"], 428 srcs: [ 429 "validate_target_files.py", 430 ], 431 libs: [ 432 "releasetools_common", 433 ], 434} 435 436// 437// Tests. 438// 439 440python_defaults { 441 name: "releasetools_test_defaults", 442 srcs: [ 443 "check_ota_package_signature.py", 444 "check_partition_sizes.py", 445 "check_target_files_signatures.py", 446 "make_recovery_patch.py", 447 "merge_target_files.py", 448 "ota_package_parser.py", 449 "sign_apex.py", 450 "sign_target_files_apks.py", 451 "validate_target_files.py", 452 453 "test_*.py", 454 ], 455 libs: [ 456 "releasetools_add_img_to_target_files", 457 "releasetools_apex_utils", 458 "releasetools_build_image", 459 "releasetools_build_super_image", 460 "releasetools_check_target_files_vintf", 461 "releasetools_common", 462 "releasetools_img_from_target_files", 463 "releasetools_ota_from_target_files", 464 "releasetools_verity_utils", 465 ], 466 data: [ 467 "testdata/**/*", 468 ], 469} 470 471python_test_host { 472 name: "releasetools_test", 473 defaults: ["releasetools_test_defaults"], 474 main: "test_utils.py", 475 version: { 476 py2: { 477 enabled: true, 478 // When using embedded launcher, atest will try (but may fail) to load libc++.so from 479 // host, because the test executable won't be able to find the needed libs via its 480 // runpath. 481 embedded_launcher: false, 482 }, 483 py3: { 484 enabled: false, 485 embedded_launcher: false, 486 }, 487 }, 488 test_suites: ["general-tests"], 489} 490 491python_test_host { 492 name: "releasetools_py3_test", 493 defaults: ["releasetools_test_defaults"], 494 main: "test_utils.py", 495 version: { 496 py2: { 497 enabled: false, 498 embedded_launcher: false, 499 }, 500 py3: { 501 enabled: true, 502 embedded_launcher: false, 503 }, 504 }, 505 test_suites: ["general-tests"], 506} 507