skills/arkweb-build/SKILL.md
This skill should be used when the user asks to "编译 ArkWeb", "build ArkWeb", "执行 ArkWeb 编译", "验证 ArkWeb 构建", "排查 ArkWeb build.log", "分析 ArkWeb 编译失败", or mentions build_arkweb.sh, src/out/<product>/build.log, ArkWeb native or browser build targets, or incremental ArkWeb build verification. Handles command selection, incremental build execution, success verification, and build.log-first failure diagnosis for ArkWeb projects.
npx skillsauth add openharmonyinsight/openharmony-skills arkweb-buildInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill supports building ArkWeb projects through build_arkweb.sh, verifying the result, and diagnosing failures from src/out/<product>/build.log.
Requires a Linux build host with GNU coreutils and /proc available.
Use it when the user wants to:
ArkWeb wrapper roots usually look like arkweb_* directories in the current workspace and contain:
build_arkweb.shsrc/arkweb/build/build.shBuild commands must run from the wrapper root, not from src/.
Use this helper to find the root from anywhere inside the tree:
find_arkweb_root() {
local dir="${1:-$PWD}"
while [[ "$dir" != "/" ]]; do
if [[ -f "$dir/build_arkweb.sh" && -f "$dir/src/arkweb/build/build.sh" ]]; then
echo "$dir"
return 0
fi
dir="$(dirname "$dir")"
done
echo "ArkWeb root not found" >&2
return 1
}
For git status and diff, use the real worktree under src/:
git -C "$(find_arkweb_root)/src" status --short
Note: src and src/arkweb are different git repositories. The arkweb repo lives under src/, but change diagnosis must inspect the two repos separately.
If the caller already provides workflow or build configuration, do not replace it with defaults:
context.automation.buildCommandscontext.automation.verifyCommandscontext.automation.buildTargetcontext.automation.buildOutputDircontext.automation.buildTimeoutMinutesOnly fall back to the default commands below when that configuration is incomplete.
Default to incremental builds. Do not clean the tree unless the user explicitly asks for a clean build.
Never do these automatically:
git cleangit reset --hardrm -rf src/outgn cleanninja -t cleanBefore starting a build, always check whether the current product has been built before. Use the presence of src/out/<product>/build.log as the primary signal:
if [[ -f <arkweb-root>/src/out/rk3568_64/build.log ]]; then
echo "Incremental build path"
else
echo "First build path"
fi
If build.log does not exist yet, treat it as a first build unless the caller provides stronger evidence otherwise. The first build is usually much slower and should be called out explicitly before running it:
Primary default command:
cd <arkweb-root>
./build_arkweb.sh rk3568_64 -t w -A
The most common variations are listed in references/build-commands.md.
When the build fails, do not stop at extracting and reporting the error. The default expectation is to continue through root-cause analysis, make an allowed fix, and rerun the build to verify the result.
Allowed fixes:
BUILD.gn / .gni, ArkWeb-owned build scripts, or project configuration inside the current ArkWeb treeExplicitly forbidden changes:
<arkweb-root>/src/ohos_sdk/If the problem can only be bypassed by touching one of those forbidden areas, call that out explicitly as a constraint and switch to an in-project alternative such as:
To localize build failures faster, inspect what the developer changed before widening the search. Most build failures are introduced by the current patch, so starting from git usually gives a faster and more accurate path to a minimal fix.
ArkWeb trees often come with default dirty files that should not be treated as developer edits. Start with the bundled filter script:
bash <skill-dir>/scripts/show_relevant_changes.sh <arkweb-root>Filter rules built into the bundled script:
third_party/rust-toolchain/ directory by prefixthird_party/rust/chromium_crates_io/ directory by prefixsrc repo, also ignore these exact default-noise entries:
third_party/ohos_ndk/includes/ohos_adapter/screenlock_manager_adapter.h,
third_party/ohos_nweb_hap/hvigor/,
third_party/ohos_nweb_hap/signature/src/arkweb repo, also ignore this exact default-noise entry:
build/search_engines/prepopulated_engines.jsonIf more raw git detail is still needed, check these next:
git -C <arkweb-root>/src status --shortgit -C <arkweb-root>/src diff --statgit -C <arkweb-root>/src diff --cached --statgit -C <arkweb-root>/src/arkweb status --shortgit -C <arkweb-root>/src/arkweb diff --statgit -C <arkweb-root>/src/arkweb diff --cached --statbuild.log already points to a file, target, or symbol, inspect the matching path with git diffDiagnosis rules:
git changes do not explain the problemBefore choosing a rerun strategy, classify the failure stage from build.log:
pre-gn/sdk-lfs: SDK install, archive extraction, Git LFS pointer, missing package, gzip/tar/unzip errors before GN or Ninja. Fix assets or setup, then rerun the configured build command.gn-generation: ERROR at //..., Unable to load, bad BUILD.gn or .gni evaluation. Fix GN configuration, then rerun GN or the configured build command.ninja-graph-or-target: ninja: error: unknown target, missing build.ninja, or Ninja graph loading errors. Fix target selection or generated build graph, then rerun the configured target set.ninja-compile-link: compiler or linker failures after Ninja starts, such as FAILED:, fatal error:, undefined reference, multiple definition, ld.lld: error, or clang++: error.resource-or-terminated: explicit killed or OutOfMemory.resource-or-terminated-suspected: log tail still looks like Ninja progress, with no FAILED:, GN error, or Ninja target error. Treat this as a resource-pressure suspicion and inspect the latest snapshot before changing code.Single-command quick verification is only for ninja-compile-link. After fixing that root cause, first cd <arkweb-root>/src/out/<product> and rerun the failed compiler or linker command shown after the first FAILED: line when it is available in build.log. The command is emitted relative to the Ninja output directory, so running it from the wrapper root or src/ can fail incorrectly. If that command succeeds, switch back to the correct directory before broader verification: use <arkweb-root> for the full build_arkweb.sh command, or <arkweb-root>/src only when deliberately rerunning the same direct Ninja target set. Before that broader verification, still record a resource snapshot with scripts/capture_resource_snapshot.sh. Do not use single-command verification for pre-gn/sdk-lfs, gn-generation, or ninja-graph-or-target.
0 as success. Any non-zero exit, signal termination, or timeout is a failure.src/out/<product>/build.log, then immediately correlate it with recent developer changes from bash <skill-dir>/scripts/show_relevant_changes.sh <arkweb-root> so default dirty entries are filtered out first.src/out/<product>/build.log exists and tell the caller if this is likely a first build.build_arkweb.sh, capture it immediately before launching the build as the external baseline. For direct Ninja continuation, capture it immediately before the ninja command.-j 32, and then to -j 16 if pressure remains high.src/out/<product>/args.gn already exists and the user is clearly continuing the same incremental build, a direct ninja -C out/<product> <targets> rerun from src/ is acceptable. Reuse the same target set as the previous build, not a random single target. Do not switch to direct Ninja just to hide a build_arkweb.sh failure.ninja-compile-link failures, use the failed command and working directory shown by scripts/analyze_build_error.sh as a fast local check after fixing the issue. After that succeeds, record a new resource snapshot, then cd <arkweb-root> before rerunning the full configured build_arkweb.sh command; use <arkweb-root>/src only for an intentional direct Ninja target-set rerun.src/ohos_sdk/ and do not modify server files outside the project directory.git changes first and keep the repair minimal instead of editing unrelated files.The primary log is:
<arkweb-root>/src/out/<product>/build.log
Older logs are usually rotated to timestamped names when a new build starts.
Always inspect the log tail first:
tail -200 <arkweb-root>/src/out/<product>/build.log
If that is not enough, search for:
error:fatal errorundefined referencemultiple definitionERROR atNo such filecannot findkilledOutOfMemoryUse the bundled scripts:
scripts/analyze_build_error.sh for a structured summary, failure stage classification, first-error context, and failed Ninja command candidate. It accepts either <product> <arkweb-root> or <build.log> <arkweb-root>.scripts/find_recent_errors.sh for a quick recent-error scanscripts/inspect_build_state.sh to inspect available output directories and recent logsscripts/check_lfs_artifacts.sh to parse the relevant LFS attribute files, check required prebuilts, and detect missing files or LFS pointer filesscripts/capture_resource_snapshot.sh to record CPU and memory headroom before the Ninja phase, so silent build exits can be diagnosed as likely resource pressure. Its first argument is the product name; the ArkWeb root is the third argument in the labeled form or the second argument in the short form.scripts/show_relevant_changes.sh to filter expected dirty files and show the relevant git changes separately for the src repo and the src/arkweb repo
It uses git status --short -uall, prints ignored default dirty entries, and supports --show-all / --no-ignore when the full raw view is needed.In commands below, <skill-dir> means the directory containing this SKILL.md.
See:
A good build answer should include:
development
Run local code quality checks covering a subset of OpenHarmony gate CI (copyright, CodeArts C/C++) plus additional local checks (pylint/flake8, shellcheck/bashate, gn format). Use before committing to reduce gate failures. Triggers on: /oh-precommit-codecheck, "门禁检查", "门禁预检", "检查代码", "run codecheck", "check code quality", "lint my code", "代码检查", or after completing code implementation. WHEN to use: before git commit, before creating PR, after modifying C/C++/Python/Shell/GN files, when gate CI fails with codecheck defects, or when you want to preview what gate will flag.
development
OpenHarmony PR full lifecycle workflow. Five modes: - Commit: standardized commit with DCO sign-off and Issue linking - Create PR: commit + push to fork + create Issue + create PR on upstream - Fix Codecheck: fetch gate CI codecheck defects from a PR and auto-fix them - Review PR: fetch a PR's changes to local for code review - Fix Review: fetch unresolved review comments from a PR and auto-fix them Triggers on: /oh-pr-workflow, "提交代码", "创建PR", "提个PR", "commit", "修复告警", "修复门禁", "修复codecheck", "fix codecheck", "review pr", "review这个pr", "看下这个pr", "检视pr", "修复review", "修复检视意见", "fix review", or a GitCode PR URL with fix/review intent.
testing
分析 HM Desktop PRD 文档,提取需求信息、验证完整性、检查章节顺序(需求来源→需求背景→需求价值分析→竞品分析→需求描述)、检查 KEP 定义、检测需求冲突并生成结构化分析报告。适用于用户请求:(1) 分析或审查 PRD 文档, (2) 从需求中提取 KEP 列表, (3) 检查 PRD 完整性或一致性, (4) 将需求映射到模块架构, (5) 验证 PRD 格式合规性, (6) 验证竞品分析章节完整性。关键词:PRD分析, requirement extraction, KEP验证, completeness check, chapter order validation, 竞品分析检查, analyze PRD, 需求提取, 完整性检查, 章节顺序验证
development
基于 PRD 文档自动生成鸿蒙系统设计文档,包括架构设计文档和功能设计文档。生成前会分析 OpenHarmony 存量代码结构,确保与现有架构兼容。架构设计文档第2章必须为竞品方案分析,位于需求背景之后。适用于用户请求:(1) 生成架构设计文档, (2) 生成功能设计文档, (3) 从 PRD 生成设计文档, (4) 创建系统架构设计, (5) 编写功能规格说明, (6) 分析 OH 代码结构。关键词:architecture design, functional design, design doc, 竞品方案分析, OpenHarmony code analysis, 架构设计, 功能设计, 设计文档生成, OH代码分析, analyze codebase, competitor analysis