Updated on 2024-11-21 GMT+08:00

Building with HarmonyOS

Build, test, and deploy a project with Hvigor.

To build with Hvigor, the executor needs to have at least 4 vCPUs and 8 GB of memory, or higher.

Build on GUI

Add Build with HarmonyOS, when configuring build actions. Set the parameters according to Table 1.

Table 1 Parameters for building with HarmonyOS

Parameter

Description

Action Name

Assign a custom name to the build action. The name can contain:

  • Letters, digits, hyphens (-), underscores (_), commas (,), semicolons (;), colons (:), periods (.), slashes (/), and parentheses.
  • 1 to 128 characters.

Tool Version

Currently, the default version HarmonyOS-API9 is supported.

Commands

Configure commands, or use the default ones. If you have special build requirements, enter your custom build script in the text box.

Build with Code

Modify the code in the BUILD block in Creating a YAML File for Your Code-based Build by referring to the following sample code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
version: 2.0 # The value must be 2.0.
steps:
  BUILD:
    - harmonyos:
        name: "HarmonyOS Build"
        inputs:
            command: |
                npm config set strict-ssl false
                npm config set registry=https://repo.huaweicloud.com/repository/npm/
                npm config set @ohos:registry=https://repo.harmonyos.com/npm/
                chmod +x hvigorw
                ./hvigorw clean assembleApp --no-daemon
Table 2 Parameters in the sample code

Parameter

Type

Description

command

String

Configure the HarmonyOS commands.