AndroidR 修改framework后如何快速模塊編譯
最近作業安排android大版本升級,需要將androidQ上的framework修改移植到androidR上,
移植后,整個工程全部make編譯太耗費時間了,于是經驗性的使用模塊編譯命令make framework進行模塊單編,然而,雖然提示編譯成功,但在out目錄下并沒有相應的framework.jar包生成,看來android11在此處進行了改動,
對比androidQ和androidR的frameworks/base/Android.bp檔案,發現Android.bp檔案做了不小的修改,
擷取其中一段對我們編譯有幫助的配置及注釋,如下:
java_library {
name: "framework-minus-apex",
defaults: ["framework-defaults"],
srcs: [":framework-non-updatable-sources"],
installable: true,
javac_shard_size: 150,
required: [
"framework-platform-compat-config",
"libcore-platform-compat-config",
"services-platform-compat-config",
"documents-ui-compat-config",
],
libs: ["framework-updatable-stubs-module_libs_api"],
static_libs: [
// If MimeMap ever becomes its own APEX, then this dependency would need to be removed
// in favor of an API stubs dependency in java_library "framework" below.
"mimemap",
],
// For backwards compatibility.
stem: "framework",
apex_available: ["//apex_available:platform"],
visibility: [
"//frameworks/base",
// TODO(b/147128803) remove the below lines
"//frameworks/base/apex/blobstore/framework",
"//frameworks/base/apex/jobscheduler/framework",
"//frameworks/base/packages/Tethering/tests/unit",
],
}
// This "framework" module is NOT installed to the device. It's
// "framework-minus-apex" that gets installed to the device. Note that
// the filename is still framework.jar (via the stem property) for
// compatibility reason. The purpose of this module is to provide
// framework APIs (both public and private) for bundled apps.
// "framework-minus-apex" can't be used for the purpose because 1)
// many apps have already hardcoded the name "framework" and
// 2) it lacks API symbols from updatable modules - as it's clear from
// its suffix "-minus-apex".
java_library {
name: "framework",
defaults: ["framework-aidl-export-defaults"],
installable: false, // this lib is a build-only library
static_libs: [
"app-compat-annotations",
"framework-minus-apex",
"framework-updatable-stubs-module_libs_api",
],
sdk_version: "core_platform",
apex_available: ["//apex_available:platform"],
}
通過反復理解此bp檔案,對谷歌工程師的想法似乎可以揣摩一二了,
于是嘗試采用下面的模塊編譯命令(可以加-j8/-j16指定編譯執行緒數):
make framework-minus-apex
果不其然,順利編譯出了frameowrk.jar包:
[100% 1155/1155] Install: out/target/product/PorjectAndroidR/system/framework/framework.jar
#### build completed successfully (04:50 (mm:ss)) ####
為文以記之,
2020年12月末,于青島,
感謝:
[1]: https://blog.csdn.net/zhzhangnews/article/details/105634037
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/241873.html
標籤:其他
下一篇:安卓學期總結和作業完成情況
