
回复
在OpenHarmony编译构建中笔者经常遇到这样的场景——需要执行sh脚本完成某些操作。笔者将OpenHarmony BUILD.gn中执行脚本的方法分享如下:
1.能够把自定义的子系统加入OpenHarmony源码的编译构建,请参考:https://ost.51cto.com/posts/17750中关于自定义子系统的部分
import("//build/ohos.gni")
exec_script("install.sh")
# 脚本如果需要参数则写成
# path= rebase_path("//xxx/xxx/xxxx/libomxil_bellagio")
# exec_script("install.sh", [ "$path" ])
config("public_config") {
....
}
ohos_static_library("omxbase") {
....
}
2.添加脚本执行权限,在5.0.0/build/core/gn/ohos_exec_script_allowlist.gni中加入该BUILD.gn的路径即可
具体实现可以参考
https://gitee.com/openharmony/third_party_libnl