This skill should be used when the user asks to "编译 OpenHarmony", "build OpenHarmony", "编译完整代码", "执行编译", "编译 OpenHarmony 代码", "快速编译", "跳过gn编译", "fast-build", "编译测试", "编译测试用例", "build ace_engine_test", "编译 sdk", "编译 SDK", "build sdk", "build SDK", "编译 ohos-sdk", "编译测试列表", "build test list", "按列表编译测试", "编译指定测试", or mentions building the full OpenHarmony system, fast rebuild, test compilation, SDK compilation, or building tests from a target list. Handles complete build process including build execution, success verification, and failure log analysis with primary focus on out/{product}/build.log.
This skill provides comprehensive support for building the complete OpenHarmony codebase, including build execution, result verification, and error log analysis.
OpenHarmony uses the build.sh script located in the root directory for building. The build process requires:
./build.sh in OpenHarmony root directoryout/ in OpenHarmony rootAlways execute builds from the OpenHarmony root directory. To find the root directory from any location in the tree:
# Method 1: Find directory containing .gn file
find_root() {
local current_dir="$(pwd)"
while [[ ! -f "$current_dir/.gn" ]]; do
current_dir="$(dirname "$current_dir")"
if [[ "$current_dir" == "/" ]]; then
echo "Error: OpenHarmony root not found (no .gn file)"
return 1
fi
done
echo "$current_dir"
}
# Navigate to root
cd "$(find_root)"
Full build for product (recommended command with cache enabled):
./build.sh --export-para PYCACHE_ENABLE:true --product-name rk3568 --ccache
Build specific component:
./build.sh --export-para PYCACHE_ENABLE:true --product-name rk3568 --build-target ace_engine --ccache
Build with specific target:
./build.sh --export-para PYCACHE_ENABLE:true --product-name <product> --build-target <target> --ccache
Common product names: rk3568, ohos-sdk, rk3588
Common build targets: ohos (default if omitted), ace_engine, ace_engine_test, unittest
IMPORTANT: SDK build has a special output directory structure.
Build OpenHarmony SDK:
./build.sh --export-para PYCACHE_ENABLE:true --product-name ohos-sdk --ccache
**SDK buil...