ohbuild

Automate OpenHarmony HAP building and signing workflows via hapbuild.py.

Updated Sep 29, 2023
One-click install
npx skills add https://github.com/eclipse-oniro-mirrors/napi_generator --skill ohbuild-eclipse-oniro-mirrors
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ohbuild
Source: https://github.com/eclipse-oniro-mirrors/napi_generator/tree/main/src/skills/ohhap
Command: npx skills add https://github.com/eclipse-oniro-mirrors/napi_generator --skill ohbuild-eclipse-oniro-mirrors

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the end-to-end process of building and signing OpenHarmony HAP applications, reducing manual setup and error-prone steps.

Core Features & Use Cases

  • Environment checks: verifies HarmonyOS CLT, OpenHarmony SDK, Node.js, and Hvigor versions.
  • Version validation: ensures project SDK version alignment with the installed SDK.
  • HAP build: compiles the main HAP and optional unit tests.
  • HAP signing: provisions signing, certificate generation, and validation steps.
  • Cleanup: removes temporary signing artifacts to keep the project clean.

Quick Start

Run python3 hapbuild.py build <project_dir> to build the HAP with default settings.

Frequently Asked Questions about ohbuild

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate OpenHarmony HAP building and signing in a single workflow?

Automate OpenHarmony HAP building and signing by running a single script that handles environment checks, SDK version validation, HAP compilation, and signature provisioning end-to-end. It executes the build and manages certificates automatically.

What environment checks are required before building an OpenHarmony HAP?

Before building an OpenHarmony HAP, the workflow verifies installed HarmonyOS CLT, OpenHarmony SDK, Node.js, and Hvigor versions to ensure the build environment meets project requirements and SDK versions align correctly.

How do I sign an OpenHarmony HAP after compilation?

Sign an OpenHarmony HAP after compilation through the integrated script, which provisions signing, handles certificate generation, performs signing validation, and cleans up temporary signing artifacts to maintain project hygiene.

Can I compile unit tests alongside my main OpenHarmony HAP build?

Yes, the OpenHarmony HAP build process supports compiling optional unit tests alongside the main application package, allowing developers to validate code functionality within the same automated build workflow.

How do I validate that my project SDK version aligns with the installed OpenHarmony SDK?

Validate project SDK version alignment automatically during the OpenHarmony HAP build process, which checks the project configuration against the installed SDK to prevent version mismatch errors before execution.