PageRenderTime 114ms CodeModel.GetById 27ms RepoModel.GetById 8ms app.codeStats 1ms

/tools/releasetools/Android.bp

https://github.com/Evervolv/android_build
Makefile | 666 lines | 616 code | 50 blank | 0 comment | 2 complexity | 5c59ab2081717eadf69a189defe77419 MD5 | raw file
  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. // Module-specific defaults.
  16. //
  17. // For module X, if we need to build it both as a library and an executable:
  18. // - A default rule `releasetools_X_defaults` is created, which lists `srcs`, `libs` and
  19. // `required` properties.
  20. // - `python_library_host` and `python_binary_host` are created by listing
  21. // `releasetools_X_defaults` in their defaults.
  22. //
  23. package {
  24. default_applicable_licenses: ["Android-Apache-2.0"],
  25. }
  26. python_defaults {
  27. name: "releasetools_add_img_to_target_files_defaults",
  28. srcs: [
  29. "add_img_to_target_files.py",
  30. ],
  31. libs: [
  32. "ota_metadata_proto",
  33. "releasetools_apex_utils",
  34. "releasetools_build_image",
  35. "releasetools_build_super_image",
  36. "releasetools_common",
  37. ],
  38. required: [
  39. "care_map_generator",
  40. ],
  41. }
  42. python_defaults {
  43. name: "releasetools_build_image_defaults",
  44. srcs: [
  45. "build_image.py",
  46. ],
  47. libs: [
  48. "releasetools_common",
  49. "releasetools_verity_utils",
  50. ],
  51. required: [
  52. "blk_alloc_to_base_fs",
  53. "e2fsck",
  54. "mkerofsimage.sh",
  55. "mkuserimg_mke2fs",
  56. "simg2img",
  57. "tune2fs",
  58. "mkf2fsuserimg.sh",
  59. "fsck.f2fs",
  60. ],
  61. }
  62. python_defaults {
  63. name: "releasetools_build_super_image_defaults",
  64. srcs: [
  65. "build_super_image.py",
  66. ],
  67. libs: [
  68. "releasetools_common",
  69. ],
  70. }
  71. python_defaults {
  72. name: "releasetools_img_from_target_files_defaults",
  73. srcs: [
  74. "img_from_target_files.py",
  75. ],
  76. libs: [
  77. "releasetools_build_super_image",
  78. "releasetools_common",
  79. ],
  80. }
  81. python_defaults {
  82. name: "releasetools_check_target_files_vintf_defaults",
  83. srcs: [
  84. "check_target_files_vintf.py",
  85. ],
  86. libs: [
  87. "releasetools_common",
  88. ],
  89. required: [
  90. "checkvintf",
  91. ],
  92. }
  93. python_library_host {
  94. name: "ota_metadata_proto",
  95. version: {
  96. py2: {
  97. enabled: true,
  98. },
  99. py3: {
  100. enabled: true,
  101. },
  102. },
  103. srcs: [
  104. "ota_metadata.proto",
  105. ],
  106. proto: {
  107. canonical_path_from_root: false,
  108. },
  109. }
  110. cc_library_static {
  111. name: "ota_metadata_proto_cc",
  112. srcs: [
  113. "ota_metadata.proto",
  114. ],
  115. host_supported: true,
  116. recovery_available: true,
  117. proto: {
  118. canonical_path_from_root: false,
  119. type: "lite",
  120. export_proto_headers: true,
  121. },
  122. }
  123. java_library_static {
  124. name: "ota_metadata_proto_java",
  125. host_supported: true,
  126. proto: {
  127. type: "nano",
  128. },
  129. srcs: ["ota_metadata.proto"],
  130. sdk_version: "9",
  131. target: {
  132. android: {
  133. jarjar_rules: "jarjar-rules.txt",
  134. },
  135. host: {
  136. static_libs: ["libprotobuf-java-nano"],
  137. },
  138. },
  139. visibility: ["//frameworks/base:__subpackages__"]
  140. }
  141. python_defaults {
  142. name: "releasetools_ota_from_target_files_defaults",
  143. srcs: [
  144. "edify_generator.py",
  145. "non_ab_ota.py",
  146. "ota_from_target_files.py",
  147. "ota_utils.py",
  148. "target_files_diff.py",
  149. ],
  150. libs: [
  151. "ota_metadata_proto",
  152. "releasetools_check_target_files_vintf",
  153. "releasetools_common",
  154. "releasetools_verity_utils",
  155. "apex_manifest",
  156. ],
  157. required: [
  158. "brillo_update_payload",
  159. "checkvintf",
  160. "minigzip",
  161. "lz4",
  162. "toybox",
  163. "unpack_bootimg",
  164. "deapexer",
  165. ],
  166. target: {
  167. darwin: {
  168. // required module "brillo_update_payload" is disabled on darwin
  169. enabled: false,
  170. },
  171. },
  172. }
  173. //
  174. // Host libraries.
  175. //
  176. python_defaults {
  177. name: "releasetools_library_defaults",
  178. version: {
  179. py2: {
  180. enabled: true,
  181. },
  182. py3: {
  183. enabled: true,
  184. },
  185. },
  186. }
  187. python_library_host {
  188. name: "releasetools_add_img_to_target_files",
  189. defaults: [
  190. "releasetools_library_defaults",
  191. "releasetools_add_img_to_target_files_defaults",
  192. ],
  193. }
  194. python_library_host {
  195. name: "releasetools_apex_utils",
  196. defaults: ["releasetools_library_defaults"],
  197. srcs: [
  198. "apex_utils.py",
  199. ],
  200. libs: [
  201. "apex_manifest",
  202. "ota_metadata_proto",
  203. "releasetools_common",
  204. ],
  205. }
  206. python_library_host {
  207. name: "releasetools_build_image",
  208. defaults: [
  209. "releasetools_library_defaults",
  210. "releasetools_build_image_defaults",
  211. ],
  212. }
  213. python_library_host {
  214. name: "releasetools_build_super_image",
  215. defaults: [
  216. "releasetools_library_defaults",
  217. "releasetools_build_super_image_defaults",
  218. ],
  219. }
  220. python_library_host {
  221. name: "releasetools_check_target_files_vintf",
  222. defaults: [
  223. "releasetools_library_defaults",
  224. "releasetools_check_target_files_vintf_defaults",
  225. ],
  226. }
  227. python_library_host {
  228. name: "releasetools_common",
  229. defaults: ["releasetools_library_defaults"],
  230. srcs: [
  231. "blockimgdiff.py",
  232. "common.py",
  233. "images.py",
  234. "rangelib.py",
  235. "sparse_img.py",
  236. ],
  237. // Only the tools that are referenced directly are listed as required modules. For example,
  238. // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
  239. required: [
  240. "aapt2",
  241. "boot_signer",
  242. "brotli",
  243. "bsdiff",
  244. "imgdiff",
  245. "minigzip",
  246. "lz4",
  247. "mkbootfs",
  248. "signapk",
  249. "toybox",
  250. "unpack_bootimg",
  251. ],
  252. }
  253. python_library_host {
  254. name: "releasetools_img_from_target_files",
  255. defaults: [
  256. "releasetools_library_defaults",
  257. "releasetools_img_from_target_files_defaults",
  258. ],
  259. }
  260. python_library_host {
  261. name: "releasetools_ota_from_target_files",
  262. defaults: [
  263. "releasetools_library_defaults",
  264. "releasetools_ota_from_target_files_defaults",
  265. ],
  266. }
  267. python_library_host {
  268. name: "releasetools_verity_utils",
  269. defaults: ["releasetools_library_defaults"],
  270. srcs: [
  271. "verity_utils.py",
  272. ],
  273. required: [
  274. "append2simg",
  275. "build_verity_metadata",
  276. "build_verity_tree",
  277. "fec",
  278. ],
  279. }
  280. //
  281. // Host binaries.
  282. //
  283. python_defaults {
  284. name: "releasetools_binary_defaults",
  285. version: {
  286. py2: {
  287. enabled: true,
  288. embedded_launcher: true,
  289. },
  290. py3: {
  291. enabled: false,
  292. embedded_launcher: false,
  293. },
  294. },
  295. // TODO (b/140144201) Build imgdiff from releasetools_common
  296. required: [
  297. "aapt2",
  298. "boot_signer",
  299. "brotli",
  300. "bsdiff",
  301. "deapexer",
  302. "imgdiff",
  303. "minigzip",
  304. "lz4",
  305. "mkbootfs",
  306. "signapk",
  307. "toybox",
  308. "unpack_bootimg",
  309. ],
  310. }
  311. python_binary_host {
  312. name: "add_img_to_target_files",
  313. defaults: [
  314. "releasetools_binary_defaults",
  315. "releasetools_add_img_to_target_files_defaults",
  316. ],
  317. }
  318. python_binary_host {
  319. name: "build_image",
  320. defaults: [
  321. "releasetools_binary_defaults",
  322. "releasetools_build_image_defaults",
  323. ],
  324. }
  325. python_binary_host {
  326. name: "build_super_image",
  327. defaults: [
  328. "releasetools_binary_defaults",
  329. "releasetools_build_super_image_defaults",
  330. ],
  331. }
  332. python_binary_host {
  333. name: "check_partition_sizes",
  334. srcs: [
  335. "check_partition_sizes.py",
  336. ],
  337. libs: [
  338. "releasetools_common",
  339. ],
  340. defaults: [
  341. "releasetools_binary_defaults",
  342. ],
  343. }
  344. python_binary_host {
  345. name: "check_ota_package_signature",
  346. defaults: ["releasetools_binary_defaults"],
  347. srcs: [
  348. "check_ota_package_signature.py",
  349. ],
  350. libs: [
  351. "releasetools_common",
  352. ],
  353. required: [
  354. "delta_generator",
  355. ],
  356. target: {
  357. darwin: {
  358. // required module "delta_generator" is disabled on darwin
  359. enabled: false,
  360. },
  361. },
  362. }
  363. python_binary_host {
  364. name: "check_target_files_signatures",
  365. defaults: ["releasetools_binary_defaults"],
  366. srcs: [
  367. "check_target_files_signatures.py",
  368. ],
  369. libs: [
  370. "releasetools_common",
  371. ],
  372. required: [
  373. "aapt",
  374. ],
  375. }
  376. python_binary_host {
  377. name: "check_target_files_vintf",
  378. defaults: [
  379. "releasetools_binary_defaults",
  380. "releasetools_check_target_files_vintf_defaults"
  381. ],
  382. }
  383. python_binary_host {
  384. name: "img_from_target_files",
  385. defaults: [
  386. "releasetools_binary_defaults",
  387. "releasetools_img_from_target_files_defaults",
  388. ],
  389. }
  390. python_defaults {
  391. name: "releasetools_find_shareduid_violation_defaults",
  392. srcs: [
  393. "find_shareduid_violation.py",
  394. ],
  395. libs: [
  396. "releasetools_common",
  397. ],
  398. }
  399. python_binary_host {
  400. name: "find_shareduid_violation",
  401. defaults: [
  402. "releasetools_binary_defaults",
  403. "releasetools_find_shareduid_violation_defaults",
  404. ],
  405. }
  406. python_library_host {
  407. name: "releasetools_find_shareduid_violation",
  408. defaults: [
  409. "releasetools_find_shareduid_violation_defaults",
  410. "releasetools_library_defaults",
  411. ],
  412. }
  413. python_binary_host {
  414. name: "make_recovery_patch",
  415. defaults: ["releasetools_binary_defaults"],
  416. srcs: [
  417. "make_recovery_patch.py",
  418. ],
  419. libs: [
  420. "releasetools_common",
  421. ],
  422. }
  423. python_binary_host {
  424. name: "merge_builds",
  425. defaults: ["releasetools_binary_defaults"],
  426. srcs: [
  427. "merge_builds.py",
  428. ],
  429. libs: [
  430. "releasetools_build_super_image",
  431. "releasetools_common",
  432. ],
  433. }
  434. python_binary_host {
  435. name: "merge_target_files",
  436. defaults: ["releasetools_binary_defaults"],
  437. srcs: [
  438. "merge_target_files.py",
  439. ],
  440. libs: [
  441. "releasetools_add_img_to_target_files",
  442. "releasetools_build_super_image",
  443. "releasetools_check_target_files_vintf",
  444. "releasetools_common",
  445. "releasetools_find_shareduid_violation",
  446. "releasetools_img_from_target_files",
  447. "releasetools_ota_from_target_files",
  448. ],
  449. required: [
  450. "checkvintf",
  451. "host_init_verifier",
  452. "secilc",
  453. ],
  454. target: {
  455. darwin: {
  456. // libs dep "releasetools_ota_from_target_files" is disabled on darwin
  457. enabled: false,
  458. },
  459. },
  460. }
  461. python_binary_host {
  462. name: "ota_from_target_files",
  463. defaults: [
  464. "releasetools_binary_defaults",
  465. "releasetools_ota_from_target_files_defaults",
  466. ],
  467. }
  468. python_binary_host {
  469. name: "ota_package_parser",
  470. defaults: ["releasetools_binary_defaults"],
  471. srcs: [
  472. "ota_package_parser.py",
  473. "rangelib.py",
  474. ],
  475. }
  476. python_binary_host {
  477. name: "sparse_img",
  478. defaults: ["releasetools_binary_defaults"],
  479. srcs: [
  480. "rangelib.py",
  481. "sparse_img.py",
  482. ],
  483. }
  484. python_binary_host {
  485. name: "sign_apex",
  486. defaults: ["releasetools_binary_defaults"],
  487. srcs: [
  488. "sign_apex.py",
  489. ],
  490. libs: [
  491. "releasetools_apex_utils",
  492. "releasetools_common",
  493. ],
  494. }
  495. python_binary_host {
  496. name: "sign_target_files_apks",
  497. defaults: ["releasetools_binary_defaults"],
  498. srcs: [
  499. "sign_target_files_apks.py",
  500. ],
  501. libs: [
  502. "releasetools_add_img_to_target_files",
  503. "releasetools_apex_utils",
  504. "releasetools_common",
  505. ],
  506. }
  507. python_binary_host {
  508. name: "validate_target_files",
  509. defaults: ["releasetools_binary_defaults"],
  510. srcs: [
  511. "validate_target_files.py",
  512. ],
  513. libs: [
  514. "releasetools_common",
  515. ],
  516. }
  517. python_binary_host {
  518. name: "verity_utils",
  519. defaults: ["releasetools_binary_defaults"],
  520. srcs: [
  521. "verity_utils.py",
  522. ],
  523. libs: [
  524. "releasetools_common",
  525. ],
  526. required: [
  527. "append2simg",
  528. "build_verity_metadata",
  529. "build_verity_tree",
  530. "fec",
  531. ],
  532. }
  533. //
  534. // Tests.
  535. //
  536. python_defaults {
  537. name: "releasetools_test_defaults",
  538. srcs: [
  539. "check_ota_package_signature.py",
  540. "check_partition_sizes.py",
  541. "check_target_files_signatures.py",
  542. "make_recovery_patch.py",
  543. "merge_target_files.py",
  544. "ota_package_parser.py",
  545. "sign_apex.py",
  546. "sign_target_files_apks.py",
  547. "validate_target_files.py",
  548. "test_*.py",
  549. ],
  550. libs: [
  551. "releasetools_add_img_to_target_files",
  552. "releasetools_apex_utils",
  553. "releasetools_build_image",
  554. "releasetools_build_super_image",
  555. "releasetools_check_target_files_vintf",
  556. "releasetools_common",
  557. "releasetools_find_shareduid_violation",
  558. "releasetools_img_from_target_files",
  559. "releasetools_ota_from_target_files",
  560. "releasetools_verity_utils",
  561. ],
  562. data: [
  563. "testdata/**/*",
  564. ":com.android.apex.compressed.v1",
  565. ":com.android.apex.compressed.v1_original",
  566. ],
  567. target: {
  568. darwin: {
  569. // libs dep "releasetools_ota_from_target_files" is disabled on darwin
  570. enabled: false,
  571. },
  572. },
  573. required: [
  574. "deapexer",
  575. ],
  576. }
  577. python_test_host {
  578. name: "releasetools_test",
  579. defaults: ["releasetools_test_defaults"],
  580. main: "test_utils.py",
  581. version: {
  582. py2: {
  583. enabled: true,
  584. // When using embedded launcher, atest will try (but may fail) to load libc++.so from
  585. // host, because the test executable won't be able to find the needed libs via its
  586. // runpath.
  587. embedded_launcher: false,
  588. },
  589. py3: {
  590. enabled: false,
  591. embedded_launcher: false,
  592. },
  593. },
  594. test_options: {
  595. unit_test: true,
  596. },
  597. }
  598. python_test_host {
  599. name: "releasetools_py3_test",
  600. defaults: ["releasetools_test_defaults"],
  601. main: "test_utils.py",
  602. test_suites: ["general-tests"],
  603. version: {
  604. py2: {
  605. enabled: false,
  606. embedded_launcher: false,
  607. },
  608. py3: {
  609. enabled: true,
  610. embedded_launcher: false,
  611. },
  612. },
  613. test_options: {
  614. unit_test: true,
  615. },
  616. }