Hvigor supports flexible customization of build modes. When you create a project, DevEco Studio automatically creates the debug, release, and test build modes. Although the project-level build-profile.json5 configuration file does not specify the test mode, this mode is automatically used when the test framework is used to start a test.
To set Build Mode on the GUI, click the
icon in the upper right corner.

There are three built-in options: <Default>, debug, and release.
If you have defined additional build modes in the build-profile.json5 file, the corresponding options are displayed in the Build Mode drop-down list.
hvigorw --mode module -p product=default -p module=entry@default -p buildMode=release assembleHap
hvigorw --mode module -p product=default -p module=entry@default -p debuggable=false assembleHap
The default build mode is release for building APP Packs and debug for building HAPs, HSPs, or HARs.
Hvigor supports custom build modes. Use the buildOption field to declare build options, and the buildModeBinder field to bind target, buildOption, and buildMode.
Project-level build-profile.json5 file:
Parameter | Type | Mandatory | Description | |
|---|---|---|---|---|
buildModeSet | Object array | No | Build mode set. Multiple build modes can be configured. | |
name | String | Yes | Name of the build mode. There are three built-in build modes, which do not require explicit configuration.
| |
buildOption | Object | No | Configuration used by the build mode. For details, see Project-level buildOption. | |
products | Object array | No | Product category. Multiple products can be configured. For details, see Configuring Multiple Targets and Products. | |
buildOption | Object | No | Build configuration of the product. For details, see Project-level buildOption. NOTE: The buildOption settings specified for a product take precedence over those defined in buildMode. This means that, if the same buildOption is specified in both places, the configuration set for the product has a higher priority. | |
Module-level build-profile.json5 file
Parameter | Type | Mandatory | Description | ||
|---|---|---|---|---|---|
buildOption | Object | No | Configuration used by the build mode. For details, see Module-level buildOption. The name, debuggable, and copyFrom fields cannot be configured. | ||
buildOptionSet | Object array | No | Build option set, which defines available build options. | ||
name | String | Yes | Name of buildOption. The buildOptionSet configuration has a higher priority than the top-level standalone buildOption configuration in the file. NOTE:
| ||
copyFrom | String | No | Name of a predefined build option in the same module to copy from. This enables you to replicate an existing build option in the same module and then override its settings as needed. NOTE:
| ||
buildModeBinder | Object array | No | Mapping between the target and buildOption for a build mode. | ||
buildModeName | String | Yes | Build mode for the mapping to be created. NOTE:
| ||
mappings | Object array | No | Array that manages the binding of build options to targets. | ||
targetName | String | Yes | Target to be bound. NOTE: The value must be selected within the module. | ||
buildOptionName | String | Yes | Name of the build option to be bound. NOTE: The value must be selected within the module. | ||
targets | config | buildOption | Object | No | Configuration used by the build mode, which takes precedence over buildOptionSet. For details, see Module-level buildOption. Note that the name, debuggable, and copyFrom fields cannot be configured. |