Automatically detects modified files and intelligently compiles the ability_runtime component, supporting multi-target compilation and automatic retry.
Quick Start
Automatically Detect and Compile (Recommended)
python3 scripts/helper.py
Compile a Specific Service
# SO 名称(推荐)
python3 scripts/helper.py --target libupms # UriPermissionManager
python3 scripts/helper.py --target abilityms # AbilityManagerService
python3 scripts/helper.py --target appms # AppManagerService
Full Path
python3 scripts/helper.py --target
//foundation/ability/ability_runtime/services/uripermmgr:libupms
### 编译多个服务
```bash
python3 scripts/helper.py --target libupms abilityms appms
Whole Repository Compilation
python3 scripts/helper.py --target full
Workflow
1. 切换到项目根目录(包含 build.py)
2. 检测修改文件 → git status --short
3. 过滤无关文件 → 排除 .claude/, build/, out/, *.md 等
4. 推断编译目标 → 统计每个服务的修改文件数
5. 智能决策 →
• 目标数量 > 5 → 使用整仓编译
• 目标数量 > 1 → 一起编译多个目标
• 目标数量 = 1 → 编译单个目标
6. 执行编译 → hb build ability_runtime -i --build-target <TARGET>
7. 处理结果 → 成功或失败(支持智能重试)
Parameter Overview
| Parameter | Description | Default Value |
|---|---|---|
--target |
Compilation target (supports multiple) | auto |
--type |
Compilation type (-i function code / -t test suite) |
-i |
--fast |
Enable fast compilation (--fast-rebuild) |
false |
--max-retries |
Maximum retry count | 3 |
--auto-retry |
Enable automatic retry mode | false |
Supported Compilation Targets
abilityms- AbilityManagerService (services/abilitymgr)appms- AppManagerService (services/appmgr)libupms- UriPermissionManager (services/uripermmgr)dataobsms- DataObserverManager (services/dataobsmgr)quickfixmgr- QuickFix Manager (services/quickfixmgr)auto- Automatically detect modified files and infer the compilation targetfull- Compile the entire ability_runtime component
Automatically Ignored Files
The following files and directories will not be detected as modifications requiring compilation:
.claude/,.hvigor/,build/,out/,.git/services/dialog_ui/ams_system_dialog/.hvigor/local.properties*.mdDocumentation files
Usage Requirements
Conditions That Must Be Met:
- Must be run in the ability_runtime Git repository
- The project root directory must contain the build.py file
- The hb command must be available in PATH
Known Limitations:
- Whole repository compilation (
--target full) takes a long time (10-30 minutes) - The first compilation requires downloading dependency packages
- Compilation cache is disabled when ccache is not installed
Detailed Documentation
- API Reference: references/api.md - Complete API, parameter descriptions, and technical details
- Usage Examples: references/examples.md - Common usage scenarios and practical cases
- Workflow: references/workflow.md - Detailed workflow and algorithm descriptions
Core Scripts
- scripts/helper.py - Compilation script implementation