背景
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