# ohos_gn_path_deps_modify **Repository Path**: jokerxd-liu/ohos_gn_path_deps_modify ## Basic Information - **Project Name**: ohos_gn_path_deps_modify - **Description**: There are to many path deps in BUILD.gn & bundle.json in OHOS. When we move a folder to a new path, it takes us a lot of time to switch the path in our modules. So we write this script to deal with it - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-05-13 - **Last Updated**: 2022-08-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # OHOS中对公共基础类库路径依赖修改 # 1. 修改规则 ## 标准系统 - config中 { "//utils/native/base:utils_config" } => { "//commonlibrary/c_utils/base:utils_config" } - include_dir中 { "//utils/native/base/include" } => { "//commonlibrary/c_utils/base/include" } - deps中 { "//utils/native/base:utils" } => external_deps { "c_utils:utils" } - deps中 { "//utils/native/base:utilsbase" } => external_deps { "c_utils:utilsbase" } - public_deps中 { "//utils/native/base:utilsbase" } => public_deps { "//commonlibrary/c_utils/base:utilsbase" } - external_deps中 { "utils_base:utils" } => { "c_utils:utils" } - 将deps修改为external_deps的理由为遵守编译构建原则:**部件间依赖使用external_deps** ## 小型系统 - "utils/native/lite" => "commonlibrary/utils_lite" - 大部分小型系统的编译构建文件架构较老,无法使用external_deps。因此这里不做deps=>external_deps的切换 # 2. 脚本使用 脚本严格执行修改规则,能**覆盖90%的场景**,个别**特殊场景**需要各子系统**自行判断、修改及验证**。 ## 标准系统 - 编辑c_utils_switch.py 修改pwd为目标仓路径,修改gnpath为工程prebuilts下gn所在位置。 ``` ''' Please set the target path, default is current path. ''' pwd = os.getcwd() ''' Please reset the path of gn. You can always find it at "//prebuilts/build-tools/linux-x86/bin/gn", if you have download the project of OpenHarmony and excute command "./build/prebuilts_download.sh" ''' gnpath = "" ``` - 执行脚本 ``` python3 c_utils_switch.py ``` ## 小型系统 - 编辑utils_lite_switch.py 修改pwd为目标仓路径,修改gnpath为工程prebuilts下gn所在位置。 ``` ''' Please set the target path, default is current path. ''' pwd = os.getcwd() ''' Please reset the path of gn. You can always find it at "//prebuilts/build-tools/linux-x86/bin/gn", if you have download the project of OpenHarmony and excute command "./build/prebuilts_download.sh" ''' gnpath = "" ``` - 执行脚本 ``` python3 utils_lite_switch.py ```