-
_load()
源码:
def _load(self):
self._run_phase(BuildPhase.LOAD)
if self.args_dict.get('fast_rebuild', None) and not self.args_dict.get('fast_rebuild').arg_value:
self.loader.run()
调用_run_phase()解析LOAD阶段的参数。
如果存在fast_rebuild参数,则跳过随后的loader过程。
执行loader的run(),进行加载。
LOAD阶段的参数如下:
参数名称 | 说明 | 默认值 |
strict-mode | 严格模式,检查每个阶段的生成,以提前中止可能的错误。 | false |
scalable-build | 可扩展构建,选择是否从预加载生成的parts.json文件读取信息 | false |
build-example | 构建实例,选择是否从subsystem_config_example.json读取 | false |
build-platform-name | 编译平台的名称 | phone |
build-xts | 是否编译xts子系统下的组件 | false |
ignore-api-check | 忽略api检查,跳过部分子系统检查。 | 空 |
load-test-config | 加载test配置,选择是否从bundle.json中加载test字段 | true |
skip-partlist-check | 跳过子系统和组件检查 | false |
-
解析参数
-
-
-
strict-mode:resolve_strict_mode()
-
-
调用preloader和loader的outputs.check_outputs(),如果存在错误,则抛出异常。
-
-
-
scalable-build:resolve_scalable_build()
-
-
loader中注册scalable_build的参数
-
-
-
build-example:resolve_build_example()
-
-
loader中注册build_example的参数
-
-
-
build-platform-name:resolve_build_platform_name()
-
-
loader中注册build_platform_name的参数
-
-
-
build-xts:resolve_build_xts()
-
-
loader中注册build_xts的参数,如果gn_args参数中指定了build_xts的值,则使用该值。
-
-
-
ignore-api-check:resolve_ignore_api_check()
-
-
如果为true,则loader中注册ignore_api_check的参数,否则,将参数值设为xts、common、developertest
-
-
-
load-test-config:resolve_load_test_config()
-
-
loader中注册load_test_config的参数
-
-
-
skip-partlist-check:resolve_skip_partlist_check()
-
-
loader中注册skip_partlist_check的参数
-
-
服务
-
load阶段的run()代码如下:
def run(self):
self.__post_init__()
self._execute_loader_args_display()
self._check_parts_config_info()
self._generate_subsystem_configs()
self._generate_target_platform_parts()
self._generate_system_capabilities()
self._generate_stub_targets()
self._generate_platforms_part_by_src()
self._generate_target_gn()
self._generate_phony_targets_build_file()
self._generate_required_parts_targets()
self._generate_required_parts_targets_list()
self._generate_src_flag()
self._generate_auto_install_part()
self._generate_platforms_list()
self._generate_part_different_info()
self._generate_infos_for_testfwk()
self._check_product_part_feature()
self._generate_syscap_files()
-
-
-
__post_init__()
-
-
调用流程
init结束后,在out/rk3568/build_configs生成一系列的文件,包括几个部分:
- 子系统信息subsystem_info目录
out/rk3568/
├── build_configs
│ └── subsystem_info
│ ├── no_src_subsystem_info.json
│ ├── src_subsystem_info.json
│ └── subsystem_build_config.json
- 平台信息platforms_info
out/rk3568
├── build_configs
│ ├── component_override_map.json
│ ├── platforms_info
│ │ ├── all_parts.json
│ │ └── toolchain_to_variant.json
- 组件覆盖信息component_override_map.json
- 部件信息parts_info
out/rk3568/build_configs/parts_info/
├── hisysevent_configs.json
├── inner_kits_info.json
├── parts_deps.json
├── parts_info.json
├── parts_modules_info.json
├── parts_path_info.json
├── parts_targets.json
├── part_subsystem.json
├── parts_variants.json
├── path_to_parts.json
├── phony_target.json
└── subsystem_parts.json
- 所有子系统中各部件的gn
out/rk3568
├── build_configs
│ ├── ability
│ ├── account
│ ├── advertising
│ ├── ai
│ ├── applications
│ ├── arkcompiler
│ ├── arkui
│ ├── barrierfree
│ ├── bundlemanager
│ ├── common
│ ├── commonlibrary
│ ├── communication
│ ├── customization
│ ├── developtools
│ ├── deviceprofile
│ ├── device_rk3568
│ ├── distributeddatamgr
│ ├── distributedhardware
│ ├── filemanagement
│ ├── global
│ ├── graphic
│ ├── hdf
│ ├── hiviewdfx
│ ├── ide
│ ├── inputmethod
│ ├── iothardware
│ ├── kernel
│ ├── location
│ ├── mini_adapter
│ ├── msdp
│ ├── multimedia
│ ├── multimodalinput
│ ├── notification
│ ├── powermgr
│ ├── print
│ ├── product_rk3568
│ ├── request
│ ├── resourceschedule
│ ├── security
│ ├── sensors
│ ├── startup
│ ├── systemabilitymgr
│ ├── telephony
│ ├── testfwk
│ ├── theme
│ ├── thirdparty
│ ├── time
│ ├── updater
│ ├── usb
│ ├── useriam
│ ├── web
│ ├── window
│ ├── wpa_supplicant-2.9
│ ├── wukong
│ └── xts
子目录下的gn文件是根据bundle.json文件中build字段的值生成的,包含有ohos_part、ohos_inner_kits、ohos_part_test三个部分。
生成gn文件的功能位于源码文件build/hb/util/loader/load_ohos_build.py:
LoadBuildConfig._parsing_config()扫描所有的子系统,解析配置,按照模板生成gn文件。
-
-
-
_execute_loader_args_display()
-
-
加载参数并写入到日志文件
-
-
-
_check_parts_config_info()
-
-
检查parts_config_info信息
-
-
-
_generate_subsystem_configs()
-
-
打印信息。
-
-
-
_generate_target_platform_parts()
-
-
写入out/rk3568/build_configs/target_platforms_parts.json文件
-
-
-
_generate_system_capabilities()
-
-
写入out/rk3568/build_configs/phone_system_capabilities.json文件
-
-
-
_generate_stub_targets()
-
-
写入out/rk3568/build_configs/subsystem_info/phone-stub/zframework_stub_exists.gni文件
-
-
-
_generate_platforms_part_by_src()
-
-
写入out/rk3568/build_configs/platforms_parts_by_src.json文件
-
-
-
_generate_target_gn()
-
-
写入gn和gni文件
out/rk3568/build_configs/parts_list.gni
out/rk3568/build_configs/inner_kits_list.gni
out/rk3568/build_configs/system_kits_list.gni
out/rk3568/build_configs/parts_test_list.gni
out/rk3568/build_configs/BUILD.gn
-
-
-
_generate_phony_targets_build_file()
-
-
写入文件out/rk3568/build_configs/phony_targets/BUILD.gn
-
-
-
_generate_required_parts_targets()
-
-
写入文件out/rk3568/build_configs/required_parts_targets.json
-
-
-
_generate_required_parts_targets_list()
-
-
写入文件out/rk3568/build_configs/required_parts_targets_list.json
-
-
-
_generate_src_flag()
-
-
写入文件out/rk3568/build_configs/subsystem_info/parts_src_flag.json
-
-
-
_generate_auto_install_part()
-
-
写入文件out/rk3568/build_configs/auto_install_parts.json
-
-
-
_generate_platforms_list()
-
-
写入文件out/rk3568/build_configs/platforms_list.gni
-
-
-
_generate_part_different_info()
-
-
写入文件out/rk3568/build_configs/parts_different_info.json
-
-
-
_generate_infos_for_testfwk()
-
-
写入文件out/rk3568/build_configs/infos_for_testfwk.json
-
-
-
_check_product_part_feature()
-
-
检查所有部件的feature,读取文件out/preloader/rk3568/features.json进行核对,如果有错则抛出异常
-
-
-
_generate_syscap_files()
-
-
核对bundle.json中的syscap信息,写入三个文件:
out/preloader/rk3568/system/etc/SystemCapability.json
out/preloader/rk3568/system/etc/syscap.json
out/preloader/rk3568/system/etc/syscap.json
-
_pre_target_generate()
源码
def _pre_target_generate(self):
self._run_phase(BuildPhase.PRE_TARGET_GENERATE)
该阶段没有参数供解析