Location>code7788 >text

Introduction to the Hvigor Mission of Honolulu Development

Popularity:758 ℃/2024-11-19 09:45:58

The compilation and build tool DevEco Hvigor (hereinafter referred to as Hvigor) is a TS-based implementation of the build task orchestration tool, which mainly provides a task management mechanism, including task registration and orchestration, engineering model management, configuration management and other key capabilities, to provide a dedicated process and configurable settings for building and testing applications.

DevEco Studio uses the build tool Hvigor to automate the execution and management of the build process, realizing the execution of the application/service build task flow and completing the HAP/APP build package.

Hvigor runs independently of DevEco Studio, which means that you can build applications from within DevEco Studio, from the command line tool, or from the integration server. The output of the build process will be the same whether you build the project from the command line tool or from DevEco Studio.

Understanding the mandate

Tasks are the basic unit of execution in the Hvigor build process. a task usually contains a piece of executable code processed by the compiler; a task can depend on multiple other tasks. the Hvigor task scheduling execution determines the timing of task execution by resolving the dependency relationship.

UP-TO-DATE

Task identifier, indicating that the task is not actually executed.Hvigor task incremental skip mechanism, in the second execution of the task to detect the task input and output conditions have not changed, then the task skips the execution to improve the efficiency of the build. For example

hvigor UP-TO-DATE ::PackageApp...

Finished

A task execution completion marker, indicating that the task has been executed. For example

hvigor Finished ::PackageApp... after 310 ms

Registration Tasks

Use the HvigorNode node object to register tasks.

  1. Edit the files under Project.
// Import the module
import { getNode, HvigorNode, HvigorTask } from '@ohos/hvigor';
  1. Write the task code.
// Get currenthvigorNodenode object (computing)
const node: HvigorNode = getNode(__filename);

// enrollmentTask
({
    name: 'customTask',
    run() {
        ('this is Task');
    }
});
  1. Execution of tasks.
    Use the hvigor command line tool to perform the task. For example

hvigorw customTask

  1. View the results of the task execution.
PS D:\SDAutoTestRunInfo\AppDemo\MyApplication > hvigorw customTask
this is Task
> hvigor Finished :: customTask... after 2 ms
> hvigor BUILD SUCCESSFUL in 2 s 211 ms