OH編譯構(gòu)建分析 - 依賴(lài)關(guān)系檢查
想了解更多關(guān)于開(kāi)源的內(nèi)容,請(qǐng)?jiān)L問(wèn):
背景
OHOS的編譯構(gòu)建系統(tǒng)是由sh腳本(或bat腳本),python腳本,Gn和Ninja工具組成的編譯構(gòu)建框架??傮w編譯構(gòu)建流程是根據(jù)產(chǎn)品配置,生成具體依賴(lài)關(guān)系,然后使用Gn配置構(gòu)建目標(biāo),通過(guò)Gn生成ninja文件,然后執(zhí)行ninja生成二進(jìn)制,最后打包生成鏡像的過(guò)程。本篇主要涉及配置文件規(guī)則和編譯初期的規(guī)則檢查。
編譯初期(prebuild)
[OHOS INFO] Start building...
[OHOS INFO] Set cache size limit to 100.0 GB
[OHOS INFO] generated build prop info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/build.prop
[OHOS INFO] generated build config info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/build_config.json
[OHOS INFO] generated product parts info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/parts.json
[OHOS INFO] generated parts config info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/parts_config.json
[OHOS INFO] generated build gnargs prop info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/build_gnargs.prop
[OHOS INFO] generated features info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/features.json
[OHOS INFO] generated syscap info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/syscap.json
[OHOS INFO] generated exclusion modules info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/exclusion_modules.json
[OHOS INFO] generated platforms build info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/platforms.build
[OHOS INFO] generated subsystem config info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/subsystem_config.json
[OHOS INFO] generated system capability info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/systemcapability.json
[OHOS INFO] generated compile_standard_whitelist info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/compile_standard_whitelist.json
[OHOS INFO] generated compile_env_allowlist info to /home/anybody/ohos/master/newsrc/out/preloader/rk3568/compile_env_allowlist.json
[OHOS INFO] Checking all build args...
[OHOS INFO] subsytem config scan completed
warning: subsystem name config incorrect in '/home/anybody/ohos/master/newsrc/vendor/hihope/rk3568/ohos.build', build file subsystem name is product_hihope,configured subsystem name is product_rk3568.
warning: subsystem name config incorrect in '/home/anybody/ohos/master/newsrc/device/board/hihope/rk3568/ohos.build', build file subsystem name is rockchip_products,configured subsystem name is device_rk3568.
[OHOS INFO] all parts scan completed
[OHOS INFO] Loading configuration file...
[OHOS INFO] loader args:['platforms_config_file="/home/anybody/ohos/master/newsrc/out/preloader/rk3568/platforms.build"', 'subsystem_config_file="/home/anybody/ohos/master/newsrc/out/preloader/rk3568/subsystem_config.json"', 'example_subsystem_file=""', 'exclusion_modules_config_file="/home/anybody/ohos/master/newsrc/out/preloader/rk3568/exclusion_modules.json"', 'source_root_dir="/home/anybody/ohos/master/newsrc/"', 'gn_root_out_dir="out/rk3568"', 'build_platform_name=phone', 'build_xts=False', 'load_test_config=True', 'target_os=ohos', 'target_cpu=arm', 'os_level=standard', "ignore_api_check=['xts', 'common', 'testfwk']", 'scalable_build=False', 'skip_partlist_check=False']
[OHOS INFO] Checking parts config...
[OHOS INFO] generated subsystem build config to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/subsystem_info/subsystem_build_config.json'
[OHOS INFO] generated src subsystem info to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/subsystem_info/src_subsystem_info.json'
[OHOS INFO] generated no src subsystem info to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/subsystem_info/no_src_subsystem_info.json'
[OHOS INFO] generate target platform parts to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/target_platforms_parts.json'
[OHOS INFO] generated system capabilities to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/phone_system_capabilities.json'
[OHOS INFO] generated platforms parts by src to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/platforms_parts_by_src.json'
[OHOS INFO] generate required parts targets to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/required_parts_targets.json'
[OHOS INFO] generate build targets list file to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/required_parts_targets_list.json'
[OHOS INFO] generated parts src flag to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/subsystem_info/parts_src_flag.json'
[OHOS INFO] generate auto install part to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/auto_install_parts.json'
[OHOS INFO] generate platforms list to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/platforms_list.gni'
[OHOS INFO] generate part different info to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/parts_different_info.json'
[OHOS INFO] generate infos for testfwk to '/home/anybody/ohos/master/newsrc/out/rk3568/build_configs/infos_for_testfwk.json'
[OHOS INFO] Checking all product features...
[OHOS INFO] generate syscap info file to '/home/anybody/ohos/master/newsrc/out/preloader/rk3568/system/etc/SystemCapability.json'
[OHOS INFO] generate syscap info with part name list to '/home/anybody/ohos/master/newsrc/out/preloader/rk3568/system/etc/syscap.json'
[OHOS INFO] generate target syscap for init list to '/home/anybody/ohos/master/newsrc/out/preloader/rk3568/system/etc/param/syscap.para'
[OHOS INFO] Excuting gn command: /home/anybody/ohos/master/newsrc/prebuilts/build-tools/linux-x86/bin/gn gen --args="product_name=\"rk3568\" product_path=\"/home/anybody/ohos/master/newsrc/vendor/hihope/rk3568\" product_config_path=\"/home/anybody/ohos/master/newsrc/vendor/hihope/rk3568\" device_name=\"rk3568\" device_path=\"/home/anybody/ohos/master/newsrc/device/board/rockchip/rk3568\" device_company=\"rockchip\" device_config_path=\"/home/anybody/ohos/master/newsrc/device/board/rockchip/rk3568\" target_cpu=\"arm\" is_standard_system=true ohos_build_compiler_specified=\"\" ohos_build_time=1704150237815 ohos_build_datetime=\"2024-01-02 15:03:57\" ace_engine_feature_enable_accessibility=true ace_engine_feature_enable_web=true datamgr_service_udmf=true code_signature_support_oh_code_sign=false enable_ohos_startup_init_feature_ab_partition=true enable_ohos_startup_init_feature_loader=true dsoftbus_feature_conn_p2p=true dsoftbus_feature_disc_ble=true dsoftbus_feature_conn_br=true dsoftbus_feature_conn_ble=true dsoftbus_feature_trans_udp_stream=true wifi_feature_non_seperate_p2p=true wifi_feature_non_hdf_driver=true graphic_2d_feature_rs_enable_eglimage=true graphic_2d_feature_use_texgine=true audio_framework_feature_dtmf_tone=true audio_framework_feature_opensl_es=true input_feature_combination_key=true input_feature_pointer_drawing=true input_feature_interceptor=true input_feature_monitor=true input_feature_keyboard=true input_feature_mouse=true input_feature_touchscreen=true input_feature_input_device=true memmgr_purgeable_memory=true fusion_interaction_coordination=false wpa_supplicant_driver_nl80211=true hdf_core_platform_test_support=true drivers_peripheral_input_feature_model=true drivers_peripheral_display_community=true drivers_peripheral_display_vdi_default=true drivers_peripheral_wlan_feature_enable_HDF_NL80211=true drivers_peripheral_wlan_feature_enable_HDF_UT=false drivers_peripheral_sensor_feature_model=true drivers_peripheral_audio_feature_full_test_suite=true drivers_peripheral_audio_feature_alsa_lib=false drivers_peripheral_audio_feature_effect=true drivers_peripheral_light_feature_model=true drivers_peripheral_vibrator_feature_model=true drivers_peripheral_codec_feature_support_omx_extend_test=true drivers_peripheral_codec_feature_support_hdi_v1=true use_ffrt=true ohos_build_enable_ccache=true ohos_build_type=\"debug\" device_type=\"default\" build_variant=\"root\" root_perf_main=\"main\" runtime_mode=\"release\"" --args=product_name="rk3568" product_path="/home/anybody/ohos/master/newsrc/vendor/hihope/rk3568" product_config_path="/home/anybody/ohos/master/newsrc/vendor/hihope/rk3568" device_name="rk3568" device_path="/home/anybody/ohos/master/newsrc/device/board/rockchip/rk3568" device_company="rockchip" device_config_path="/home/anybody/ohos/master/newsrc/device/board/rockchip/rk3568" target_cpu="arm" is_standard_system=true ohos_build_compiler_specified="" ohos_build_time=1704150237815 ohos_build_datetime="2024-01-02 15:03:57" ace_engine_feature_enable_accessibility=true ace_engine_feature_enable_web=true datamgr_service_udmf=true code_signature_support_oh_code_sign=false enable_ohos_startup_init_feature_ab_partition=true enable_ohos_startup_init_feature_loader=true dsoftbus_feature_conn_p2p=true dsoftbus_feature_disc_ble=true dsoftbus_feature_conn_br=true dsoftbus_feature_conn_ble=true dsoftbus_feature_trans_udp_stream=true wifi_feature_non_seperate_p2p=true wifi_feature_non_hdf_driver=true graphic_2d_feature_rs_enable_eglimage=true graphic_2d_feature_use_texgine=true audio_framework_feature_dtmf_tone=true audio_framework_feature_opensl_es=true input_feature_combination_key=true input_feature_pointer_drawing=true input_feature_interceptor=true input_feature_monitor=true input_feature_keyboard=true input_feature_mouse=true input_feature_touchscreen=true input_feature_input_device=true memmgr_purgeable_memory=true fusion_interaction_coordination=false wpa_supplicant_driver_nl80211=true hdf_core_platform_test_support=true drivers_peripheral_input_feature_model=true drivers_peripheral_display_community=true drivers_peripheral_display_vdi_default=true drivers_peripheral_wlan_feature_enable_HDF_NL80211=true drivers_peripheral_wlan_feature_enable_HDF_UT=false drivers_peripheral_sensor_feature_model=true drivers_peripheral_audio_feature_full_test_suite=true drivers_peripheral_audio_feature_alsa_lib=false drivers_peripheral_audio_feature_effect=true drivers_peripheral_light_feature_model=true drivers_peripheral_vibrator_feature_model=true drivers_peripheral_codec_feature_support_omx_extend_test=true drivers_peripheral_codec_feature_support_hdi_v1=true use_ffrt=true ohos_build_enable_ccache=true ohos_build_type="debug" device_type="default" build_variant="root" root_perf_main="main" runtime_mode="release" /home/anybody/ohos/master/newsrc/out/rk3568
簡(jiǎn)單解讀(基本規(guī)則)
- 編譯構(gòu)建的重要組成部分:
OHOS的編譯構(gòu)建以下三個(gè)倉(cāng)是編譯構(gòu)建重要的三個(gè)倉(cāng):
- productdefine:產(chǎn)品配置倉(cāng),包含了基礎(chǔ)部件的組成形態(tài),主要看/produdctdefine/common/base目錄下的文件。
- vendor:各廠家的產(chǎn)品倉(cāng),如大家最熟悉的/vendor/hihope/rk3568,編譯命令指定–product-name來(lái)尋找對(duì)應(yīng)的產(chǎn)品。
- build:編譯構(gòu)建倉(cāng),包括規(guī)范,檢查工具,編譯構(gòu)建腳本等等,OHOS編譯構(gòu)建的核心倉(cāng)
- 關(guān)注重點(diǎn)
- BUILD.gn:每個(gè)模塊都對(duì)應(yīng)一個(gè)BUILD.gn文件。可以使用提供的模板,也可以使用gn語(yǔ)法規(guī)則自定義編寫(xiě)。
例子:
ohos_shared_library示例:
```
import("http://build/ohos.gni")
ohos_shared_library("helloworld") {
sources = []
include_dirs = []
cflags = []
cflags_c = []
cflags_cc = []
ldflags = []
configs = []
deps =[] # 部件內(nèi)模塊依賴(lài)
# 跨部件模塊依賴(lài)定義,
# 定義格式為 "部件名:模塊名稱(chēng)"
# 這里依賴(lài)的模塊必須是依賴(lài)的部件聲明在inner_kits中的模塊
external_deps = [
"part_name:module_name",
]
output_name = "" # 可選,模塊輸出名
output_extension = "" # 可選,模塊名后綴
module_install_dir = "" # 可選,缺省在/system/lib64或/system/lib下, 模塊安裝路徑,模塊安裝路徑,從system/,vendor/后開(kāi)始指定
relative_install_dir = "" # 可選,模塊安裝相對(duì)路徑,相對(duì)于/system/lib64或/system/lib;如果有module_install_dir配置時(shí),該配置不生效
install_images = [] # 可選,缺省值system,指定模塊安裝到那個(gè)分區(qū)鏡像中,可以指定多個(gè)
part_name = "" # 必選,所屬部件名稱(chēng)
}
```
ohos_executable示例:
ohos_executable模板屬性和ohos_shared_library基本一致。
注意:可執(zhí)行模塊(即ohos_executable模板定義的)默認(rèn)是不安裝的,如果要安裝,需要指定install_enable = true。
ohos_prebuilt_etc示例:
```
import("http://build/ohos.gni")
ohos_prebuilt_etc("etc_file") {
source = "file"
deps = [] # 部件內(nèi)模塊依賴(lài)
module_install_dir = "" #可選,模塊安裝路徑,從system/,vendor/后開(kāi)始指定
relative_install_dir = "" #可選,模塊安裝相對(duì)路徑,相對(duì)于system/etc;如果有module_install_dir配置時(shí),該配置不生效
install_images = [] # 可選,缺省值system,指定模塊安裝到那個(gè)分區(qū)鏡像中,可以指定多個(gè)
part_name = "" # 必選,所屬部件名稱(chēng)
}
```
更多詳細(xì)的模板信息請(qǐng)參照模塊配置規(guī)則。
- bundle.json:定義了子系統(tǒng)包含的部件。每個(gè)部件定義它所包含的模塊目標(biāo)component.build.sub_component,以及部件間交互的接口component.build.inner_kits,測(cè)試用例component.build.test_list。部件包含的模塊目標(biāo)component.build.sub_component是必須要說(shuō)明的。原來(lái)老版本有ohos.build,后面全部整改為bundle.json。
{
"name": "@ohos/<component_name>", # HPM部件英文名稱(chēng),格式"@組織/部件名稱(chēng)"
"description": "xxxxxxxxxxxxxxxxxxx", # 部件功能一句話描述
"version": "3.1", # 版本號(hào),版本號(hào)與OpenHarmony版本號(hào)一致
"license": "MIT", # 部件License
"publishAs": "code-segment", # HPM包的發(fā)布方式,當(dāng)前默認(rèn)都為code_segment
"segment": {
"destPath": ""
}, # 發(fā)布類(lèi)型為code_segment時(shí)為必填項(xiàng),定義發(fā)布類(lèi)型code_segment的代碼還原路徑(源碼路徑)
"dirs": {}, # HPM包的目錄結(jié)構(gòu),字段必填內(nèi)容可以留空
"scripts": {}, # HPM包定義需要執(zhí)行的腳本,字段必填,值非必填
"licensePath": "COPYING",
"readmePath": {
"en": "README.rst"
},
"component": { # 部件屬性
"name": "<component_name>", # 部件名稱(chēng)
"subsystem": "", # 部件所屬子系統(tǒng)
"syscap": [], # 部件為應(yīng)用提供的系統(tǒng)能力
"features": [], # 部件對(duì)外的可配置特性列表,一般與build中的sub_component對(duì)應(yīng),可供產(chǎn)品配置
"adapted_system_type": [], # 輕量(mini)小型(small)和標(biāo)準(zhǔn)(standard),可以是多個(gè)
"rom": "xxxKB" # ROM基線,沒(méi)有基線寫(xiě)當(dāng)前值
"ram": "xxxKB", # RAM基線,沒(méi)有基線寫(xiě)當(dāng)前值
"deps": {
"components": [], # 部件依賴(lài)的其他部件
"third_party": [] # 部件依賴(lài)的三方開(kāi)源軟件
},
"build": { # 編譯相關(guān)配置
"sub_component": ["部件包含模塊的gn目標(biāo)"], # 部件編譯入口,新增模塊在此處配置
"inner_kits": [], # 部件間接口
"test": [] # 部件測(cè)試用例編譯入口
}
}
}
新增部件的大致步驟就是在在部件目錄中新建一個(gè)bundle.json,然后再在//vendor/{product_company}/{product-name}/config.json中添加對(duì)應(yīng)的部件,直接添加到原有部件后即可。具體流程請(qǐng)參照編譯構(gòu)建指導(dǎo)的配置規(guī)則與新增并編譯不同配置,其中詳細(xì)的介紹了如何添加一個(gè)模塊、部件或者子系統(tǒng)。
- vendor里的config.json:指明了產(chǎn)品名,產(chǎn)品廠商,產(chǎn)品設(shè)備,版本,要編譯的系統(tǒng)類(lèi)型,以及產(chǎn)品包含的子系統(tǒng)。
{
"product_name": "MyProduct",
"version": "3.0",
"type": "standard",
"target_cpu": "arm",
"ohos_version": "OpenHarmony 1.0",
"device_company": "MyProductVendor",
"board": "MySOC",
"enable_ramdisk": true,
"subsystems": [
{
"subsystem": "ace",
"components": [
{ "component": "ace_engine_lite", "features":[""] }
]
},
...
]
}
其他更詳細(xì)內(nèi)容請(qǐng)查看:build: Compilation and building framework and scripts | 編譯構(gòu)建框架和腳本 (gitee.com)
常見(jiàn)Q&A解讀(錯(cuò)誤處理)
常見(jiàn)七類(lèi)問(wèn)題:
- subsystem_components
錯(cuò)誤原因:
子系統(tǒng)配置清單中的子系統(tǒng)名和部件配置清單中的子系統(tǒng)名不一致;或bundle.json中的部件名和部件配置清單中的部件名不一致
Warning: find subsystem startup_ext failed, please check it in /home/XXX/workspace/system_single_frame/system_component/out/products_ext/vendor/xxx/XXX/config.json.
或
Exception: find subsystem startup_ext failed, please check it in /home/XXX/workspace/system_single_frame/system_component/out/products_ext/vendor/xxx/XXX/config.json.
Warning: find component hiview_plugins_xxx failed, please check it in /home/XXX/workspace/system_single_frame/system_component/out/products_ext/vendor/xxx/XXX/config.json.
或
Exception: find component hiview_plugins failed, please check it in /home/XXX/workspace/system_single_frame/system_component/out/products_ext/vendor/xxx/XXX/config.json.
解讀:
“subsystem” 代表產(chǎn)品部件列表(config.json)配置的子系統(tǒng)名錯(cuò)誤。
“component”代表產(chǎn)品部件列表(config.json)配置的部件名錯(cuò)誤。
此類(lèi)問(wèn)題代表vendor\xxx\build\component_config\system\XXX\part_config.json 文件中配置的子系統(tǒng)名或者部件名錯(cuò)誤,component 代表部件名配置錯(cuò)誤, subsystem 代表子系統(tǒng)名配置錯(cuò)誤。
整改方法:
如果是子系統(tǒng)名配置錯(cuò)誤,請(qǐng)排查 part_config.json中配置的子系統(tǒng)名是否在subsystem_config.json中有配置
OHOS的subsystem_config.json路徑:build/subsystem_config.json。
如果是部件名配置錯(cuò)誤,請(qǐng)排查part_config.json文件中的部件名是否和該部件的bundle.json中的部件名配置一致。
- bundle_subsystem_error
錯(cuò)誤原因:
bundle.json中定義的子系統(tǒng)名和子系統(tǒng)配置清單中的不一致
具體日志
warning: subsystem name config incorrect in '/home/XXX/workspace/system_single_frame/system_component/foundation/ability/ability_base/bundle.json', build file subsystem name is ability, configured subsystem name is aafwk.
或
Exception: subsystem name config incorrect in '/home/XXX/workspace/system_single_frame/system_component/foundation/ability/ability_base/bundle.json', build file subsystem name is ability, configured subsystem name is aafwk.
解讀:
該問(wèn)題代表bundle.json里的子系統(tǒng)名稱(chēng)配置和subsystem_config.json配置不一致,需要整改bundle.json的子系統(tǒng)名稱(chēng)。
bundle.json路徑:foundation/ability/ability_base/bundle.json。
整改方法:
請(qǐng)檢查本部件bundle.json中是否有配置子系統(tǒng)并且配置的子系統(tǒng)名與subsystem_config.json中一致,若不一致,請(qǐng)將bundle.json中的子系統(tǒng)名改為subsystem_config.json中的子系統(tǒng)名。
- gn_part_or_subsystem_error。
錯(cuò)誤原因:
BUILD.gn中定義的部件名或子系統(tǒng)名與bundle.json中定義的不一致。
具體日志:
[OHOS INFO] warning: subsystem name or part name is incorrect, target is //foundation/distributedhardware/distributed_audio/hdf_service/distributed_audio/hdi_service/audio/v1_0:libaudio_manager_daudio_primary_service_1.0, subsystem name is hdf, part name is drivers_peripheral_distributed_audio
或
Exception: subsystem name or part name is incorrect, target is //foundation/distributedhardware/distributed_audio/hdf_service/distributed_audio/hdi_service/audio/v1_0:libaudio_manager_daudio_primary_service_1.0, subsystem name is hdf, part name is drivers_peripheral_distributed_audio
解讀:
該問(wèn)題代表模塊的BUILD.gn里面配置的子系統(tǒng)名或者部件名不準(zhǔn)確,需要和部件bundle.json對(duì)齊
BUILD.gn路徑:foundation/distributedhardware/distributed_audio/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn。
編譯目標(biāo):libaudio_manager_daudio_primary_service_1.0
整改方法:
將本部件下該模塊BUILD.gn中的部件名與子系統(tǒng)名改為本部件bundle.json中的子系統(tǒng)名和部件名
如果已確認(rèn)BUILD.gn和bundle.json中的子系統(tǒng)名和部件名一致,請(qǐng)?jiān)俅_認(rèn)part_config.json中是否正確配置了該子系統(tǒng)名和部件名
part_config.json路徑:(和編譯命令中abi-type、device-type參數(shù)一致)
系統(tǒng)組件:
vendor/xxx/build/component_config/system/XXX/part_config.json
vendor/xxx/build/component_config/system/XXX/part_config.json
芯片組件:
vendor/xxx/build/component_config/chipset/XXX/part_config.json
vendor/xxx/build/component_config/chipset/XXX/part_config.json
- deps_added_external_part_module
錯(cuò)誤原因:
BUILD.gn中使用deps依賴(lài)了外部部件的模塊
具體日志:
[OHOS INFO] WARNING:deps validation part_name: 'distributed_camera', target: '//foundation/distributedhardware/distributed_camera/services/channel:distributed_camera_channel', dep: '//foundation/distributedhardware/distributed_hardware_fwk/interfaces/inner_kits:libdhfwk_sdk' failed!!
解讀:
該問(wèn)題代表該模塊通過(guò)deps依賴(lài)了部件外的模塊,應(yīng)該用external_deps依賴(lài)。
BUILD.gn路徑:foundation/distributedhardware/distributed_camera/services/channel/BUILD.gn。
編譯目標(biāo):distributed_camera_channel。
deps中依賴(lài)的外部模塊:foundation/distributedhardware/distributed_hardware_fwk/interfaces/inner_kits:libdhfwk_sdk。
整改方法:
將該模塊從deps轉(zhuǎn)移到external_deps中。
注:deps中使用的是"路徑:模塊名",而改到external_deps中是使用 “部件名:模塊名” 的方式。
- external_deps_added_self_part_module
錯(cuò)誤原因:
使用external_deps依賴(lài)了本部件的模塊。
具體日志:
[OHOS INFO] WARNING: preferences in target //foundation/distributeddatamgr/preferences/frameworks/js/napi/preferences:preferences is dependency within part preferences, Need to used deps
或
Exception: preferences in target //foundation/distributeddatamgr/preferences/frameworks/js/napi/preferences:preferences is dependency within part preferences, Need to used deps
解讀:
該日志代表該模塊通過(guò)external_deps依賴(lài)了本部件模塊,需要改成deps依賴(lài)
BUILD.gn路徑:foundation/distributeddatamgr/preferences/frameworks/js/napi/preferences
external_deps中依賴(lài)的本部件:preferences
整改方法:
將該依賴(lài)從external_deps轉(zhuǎn)移到deps中
- external_deps_bundle_not_add
**錯(cuò)誤原因:**BUILD.gn中外部依賴(lài)了其他部件的模塊,但是bundle.json中沒(méi)有添加這個(gè)部件
注:對(duì)于三方部件,如果BUILD.gn里面用的是deps依賴(lài),那在bundle.json中需要加到third_party中,如果使用的是external_deps依賴(lài)的三方部件,那在bundle.json中需要加到components中
具體日志:
[OHOS INFO] WARNING: //base/theme/wallpaper_mgr/frameworks/kits/extension:wallpaperextension depend part window_manager, need set part deps info to /home/XXX/workspace/system_single_frame/system_component/base/theme/wallpaper_mgr/bundle.json.
或
Exception: //base/theme/wallpaper_mgr/frameworks/kits/extension:wallpaperextension depend part window_manager, need set part deps info to /home/XXX/workspace/system_single_frame/system_component/base/theme/wallpaper_mgr/bundle.json.
解讀:
該日志代表該模塊(BUILD.gn)里面依賴(lài)的外部部件,但沒(méi)有在部件bundle.json聲明,需要在bundle.json聲明。
- BUILD.gn路徑:base/theme/wallpaper_mgr/frameworks/kits/extension/BUILD.gn
- 編譯目標(biāo):wallpaperextension
- 依賴(lài)的部件:window_manager
- bundle.json路徑:base/theme/wallpaper_mgr/bundle.json.
整改方法:
將被依賴(lài)的外部部件添加到bundle.json中的deps:components字段中,如上述例子中,需要將”input”和”window_manager”添加到bundle.json中
- third_deps_bundle_not_add
錯(cuò)誤原因:
BUILD.gn中依賴(lài)了三方部件,但是部件bundle.json中沒(méi)有添加該三方部件
具體日志:
[OHOS INFO] WARNING: //base/security/device_auth/services:deviceauth_service depend part //third_party/cJSON:cjson, need set part deps cjson info to /home/XXX/workspace/chipset_single_frame/vendor_baltimore_musl/base/security/device_auth/bundle.json.
或
Exception: //base/security/device_auth/services:deviceauth_service depend part //third_party/cJSON:cjson, need set part deps cjson info to /home/XXX/workspace/chipset_single_frame/vendor_baltimore_musl/base/security/device_auth/bundle.json.
解讀:
該日志代表該模塊(BUILD.gn)里面依賴(lài)的三方部件,沒(méi)有在部件bundle.json中的third_party中聲明,需要在bundle.json聲明。
- BUILD.gn路徑:base/security/device_auth/services
- 編譯目標(biāo):deviceauth_service
- 依賴(lài)的三方部件:cjson
- bundle.json路徑:vendor_baltimore_musl/base/security/device_auth/bundle.json
整改方法:
將被依賴(lài)的三方部件添加到bundle.json中的deps:third_party字段中,如上述例子中,需要將 “cjson” 添加到bundle.json中。