鸿蒙开发:OH编译构建分析 - 依赖关系检查

发布时间:2024年01月16日

背景

OHOS的编译构建系统是由sh脚本(或bat脚本),python脚本,Gn和Ninja工具组成的编译构建框架。总体编译构建流程是根据产品配置,生成具体依赖关系,然后使用Gn配置构建目标,通过Gn生成ninja文件,然后执行ninja生成二进制,最后打包生成镜像的过程。本篇主要涉及配置文件规则和编译初期的规则检查。

编译初期(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

简单解读(基本规则)

  • 编译构建的重要组成部分: OHOS的编译构建以下三个仓是编译构建重要的三个仓:

  • productdefine:产品配置仓,包含了基础部件的组成形态,主要看/produdctdefine/common/base目录下的文件

  • vendor:各厂家的产品仓,如大家最熟悉的/vendor/hihope/rk3568,编译命令指定–product-name来寻找对应的产品

  • build:编译构建仓,包括规范,检查工具,编译构建脚本等等,OHOS编译构建的核心仓

  • 关注重点

  • BUILD.gn:每个模块都对应一个BUILD.gn文件。可以使用提供的模板,也可以使用gn语法规则自定义编写。 例子: ? ohos_shared_library示例:

```html
    ```
    import("//build/ohos.gni")
    ohos_shared_library("helloworld") {
      sources = []
      include_dirs = []
      cflags = []
      cflags_c = []
      cflags_cc = []
      ldflags = []
      configs = []
      deps =[]  # 部件内模块依赖
    
      # 跨部件模块依赖定义,
      # 定义格式为 "部件名:模块名称"
      # 这里依赖的模块必须是依赖的部件声明在inner_kits中的模块
      external_deps = [
        "part_name:module_name",
      ]
    
      output_name = ""           # 可选,模块输出名
      output_extension = ""      # 可选,模块名后缀
      module_install_dir = ""    # 可选,缺省在/system/lib64或/system/lib下, 模块安装路径,模块安装路径,从system/,vendor/后开始指定
      relative_install_dir = ""  # 可选,模块安装相对路径,相对于/system/lib64或/system/lib;如果有module_install_dir配置时,该配置不生效
      install_images = []        # 可选,缺省值system,指定模块安装到那个分区镜像中,可以指定多个
    
      part_name = "" # 必选,所属部件名称
    }
    ```
    
    ```
    
    ? **_ohos_executable示例:_**
    
    ? ohos_executable模板属性和ohos_shared_library基本一致
    
    ? _注意:可执行模块(即ohos_executable模板定义的)默认是不安装的,如果要安装,需要指定install_enable = true_
    
    ? **_ohos_prebuilt_etc示例:_**
    

    
    ```html
    ```
    import("//build/ohos.gni")
    ohos_prebuilt_etc("etc_file") {
      source = "file"
      deps = []                 # 部件内模块依赖
      module_install_dir = ""   #可选,模块安装路径,从system/,vendor/后开始指定
      relative_install_dir = "" #可选,模块安装相对路径,相对于system/etc;如果有module_install_dir配置时,该配置不生效
      install_images = []       # 可选,缺省值system,指定模块安装到那个分区镜像中,可以指定多个
      part_name = ""            # 必选,所属部件名称
    }
    ```
    
    ```
    
    ? 更多详细的模板信息请参照[ 模块配置规则](https://gitee.com/openharmony/docs/tree/master/zh-cn/device-dev/subsystems/subsys-build-module.md#%E6%A8%A1%E5%9D%97%E9%85%8D%E7%BD%AE%E8%A7%84%E5%88%99)。
    
*   bundle.json:定义了子系统包含的部件。每个部件定义它所包含的模块目标component.build.sub_component,以及部件间交互的接口component.build.inner_kits,测试用例component.build.test_list。部件包含的模块目标component.build.sub_component是必须要说明的。原来老版本有ohos.build,后面全部整改为bundle.json
    

    
    ```json
    {
      "name": "@ohos/<component_name>",                 # HPM部件英文名称,格式"@组织/部件名称"
      "description": "xxxxxxxxxxxxxxxxxxx",             # 部件功能一句话描述
      "version": "3.1",                                 # 版本号,版本号与OpenHarmony版本号一致
      "license": "MIT",                                 # 部件License
      "publishAs": "code-segment",                      # HPM包的发布方式,当前默认都为code_segment
      "segment": {
        "destPath": ""
      },                                                # 发布类型为code_segment时为必填项,定义发布类型code_segment的代码还原路径(源码路径)
      "dirs": {},                                       # HPM包的目录结构,字段必填内容可以留空
      "scripts": {},                                    # HPM包定义需要执行的脚本,字段必填,值非必填
      "licensePath": "COPYING",
      "readmePath": {
         "en": "README.rst"
      },
      "component": {                                   # 部件属性
         "name": "<component_name>",                   # 部件名称
         "subsystem": "",                              # 部件所属子系统
         "syscap": [],                                 # 部件为应用提供的系统能力
         "features": [],                               # 部件对外的可配置特性列表,一般与build中的sub_component对应,可供产品配置
         "adapted_system_type": [],                    # 轻量(mini)小型(small)和标准(standard),可以是多个
         "rom": "xxxKB"                                # ROM基线,没有基线写当前值
         "ram": "xxxKB",                               # RAM基线,没有基线写当前值
         "deps": {
           "components": [],                         # 部件依赖的其他部件
           "third_party": []                         # 部件依赖的三方开源软件
         },
         "build": {                                    # 编译相关配置
           "sub_component": ["部件包含模块的gn目标"],  # 部件编译入口,新增模块在此处配置
           "inner_kits": [],                         # 部件间接口
           "test": []                                # 部件测试用例编译入口
         }
      }
    }
    
    ```
    
    新增部件的大致步骤就是在在部件目录中新建一个bundle.json,然后再在//vendor/{product_company}/{product-name}/config.json中添加对应的部件,直接添加到原有部件后即可。具体流程请参照编译构建指导的[ 配置规则](https://gitee.com/openharmony/docs/tree/master/zh-cn/device-dev/subsystems/subsys-build-all.md#%E9%85%8D%E7%BD%AE%E8%A7%84%E5%88%99)与[ 新增并编译不同配置](https://gitee.com/openharmony/docs/tree/master/zh-cn/device-dev/subsystems/subsys-build-all.md#%E6%96%B0%E5%A2%9E%E5%B9%B6%E7%BC%96%E8%AF%91%E4%B8%8D%E5%90%8C%E9%85%8D%E7%BD%AE),其中详细的介绍了如何添加一个模块、部件或者子系统。
    
*   vendor里的config.json:指明了产品名,产品厂商,产品设备,版本,要编译的系统类型,以及产品包含的子系统。
    

    
    ```json
    {
      "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":[""] }
        ]
      },
            ...
      ]
    }
    
    ```
    
    其他更详细内容请查看:[ build: Compilation and building framework and scripts | 编译构建框架和脚本 (gitee.com)](https://gitee.com/openharmony/build)

常见Q&A解读(错误处理)

常见七类问题:

  • subsystem_components

错误原因:

子系统配置清单中的子系统名和部件配置清单中的子系统名不一致;或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” 代表产品部件列表(config.json)配置的子系统名错误

“component”代表产品部件列表(config.json)配置的部件名错误

此类问题代表vendor\xxx\build\component_config\system\XXX\part_config.json 文件中配置的子系统名或者部件名错误,component 代表部件名配置错误, subsystem 代表子系统名配置错误

整改方法:

如果是子系统名配置错误,请排查 part_config.json中配置的子系统名是否在subsystem_config.json中有配置

OHOS的subsystem_config.json路径:build/subsystem_config.json

如果是部件名配置错误,请排查part_config.json文件中的部件名是否和该部件的bundle.json中的部件名配置一致

  • bundle_subsystem_error

错误原因:

bundle.json中定义的子系统名和子系统配置清单中的不一致

具体日志

登录后复制

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.

解读:

该问题代表bundle.json里的子系统名称配置和subsystem_config.json配置不一致,需要整改bundle.json的子系统名称

bundle.json路径:foundation/ability/ability_base/bundle.json

整改方法:

请检查本部件bundle.json中是否有配置子系统并且配置的子系统名与subsystem_config.json中一致,若不一致,请将bundle.json中的子系统名改为subsystem_config.json中的子系统名

  • gn_part_or_subsystem_error

错误原因:

BUILD.gn中定义的部件名或子系统名与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

解读:

该问题代表模块的BUILD.gn里面配置的子系统名或者部件名不准确,需要和部件bundle.json对齐

BUILD.gn路径:foundation/distributedhardware/distributed_audio/hdf_service/distributed_audio/hdi_service/audio/v1_0/BUILD.gn

编译目标:libaudio_manager_daudio_primary_service_1.0

整改方法:

将本部件下该模块BUILD.gn中的部件名与子系统名改为本部件bundle.json中的子系统名和部件名

如果已确认BUILD.gn和bundle.json中的子系统名和部件名一致,请再确认part_config.json中是否正确配置了该子系统名和部件名

part_config.json路径:(和编译命令中abi-type、device-type参数一致)

系统组件:

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

错误原因:

BUILD.gn中使用deps依赖了外部部件的模块

具体日志:

[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!!

解读:

该问题代表该模块通过deps依赖了部件外的模块,应该用external_deps依赖

BUILD.gn路径:foundation/distributedhardware/distributed_camera/services/channel/BUILD.gn

编译目标:distributed_camera_channel

deps中依赖的外部模块:foundation/distributedhardware/distributed_hardware_fwk/interfaces/inner_kits:libdhfwk_sdk

整改方法:

将该模块从deps转移到external_deps中

注:deps中使用的是"路径:模块名",而改到external_deps中是使用 “部件名:模块名” 的方式

  • external_deps_added_self_part_module

错误原因:

使用external_deps依赖了本部件的模块

具体日志:

[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

解读:

该日志代表该模块通过external_deps依赖了本部件模块,需要改成deps依赖

BUILD.gn路径:foundation/distributeddatamgr/preferences/frameworks/js/napi/preferences

external_deps中依赖的本部件:preferences

整改方法:

将该依赖从external_deps转移到deps中

  • external_deps_bundle_not_add

**错误原因:**BUILD.gn中外部依赖了其他部件的模块,但是bundle.json中没有添加这个部件

注:对于三方部件,如果BUILD.gn里面用的是deps依赖,那在bundle.json中需要加到third_party中,如果使用的是external_deps依赖的三方部件,那在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)里面依赖的外部部件,但没有在部件bundle.json声明,需要在bundle.json声明。

BUILD.gn路径:base/theme/wallpaper_mgr/frameworks/kits/extension/BUILD.gn

编译目标:wallpaperextension

依赖的部件:window_manager

bundle.json路径:base/theme/wallpaper_mgr/bundle.json.

整改方法:

将被依赖的外部部件添加到bundle.json中的deps:components字段中,如上述例子中,需要将”input”和”window_manager”添加到bundle.json中

  • third_deps_bundle_not_add

错误原因:

BUILD.gn中依赖了三方部件,但是部件bundle.json中没有添加该三方部件

具体日志:

[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)里面依赖的三方部件,没有在部件bundle.json中的third_party中声明,需要在bundle.json声明。

BUILD.gn路径:base/security/device_auth/services

编译目标:deviceauth_service

依赖的三方部件:cjson

bundle.json路径:vendor_baltimore_musl/base/security/device_auth/bundle.json

整改方法:

将被依赖的三方部件添加到bundle.json中的deps:third_party字段中,如上述例子中,需要将 “cjson” 添加到bundle.json中

文章来源:https://blog.csdn.net/2301_76813281/article/details/135634497
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。