Files
vystem/docs/vybuild/modules.md
2026-05-27 19:34:54 +02:00

47 lines
1.9 KiB
Markdown

# Modules
## Introduction
Modules are the backbone of VyBuild. They allow you to precisely describe the build process of your project. They are JSON files with a very strict but clear syntax.
## Syntax
Modules can be executed as root module (called from command line) or submodule (called from another module).
A module is made of several fields indexed in a dictionnary. Here is an example:
``` json
{
"version":"0.1",
"root_folder":"...",
"run_context":"...",
"name":"...",
"global_uuid":[
...
],
"global_vars":{
...
},
"actions":[
...
]
}
```
### Mandatory fields
Each module has 5 mandatory fields:
- `version`: a string indicating the version of VyBuild JSON syntax. It must be set to the current version of the VyBuild JSON syntax, which is currently `0.1`
- `root_folder`: a string indicating the working folder of this module, all relative paths must be accessible in this folder. You can use variables in this field (see [variables docs](variables.md)). The path indicated in this field should always be absolute for maximum reliability
- `run_context`: a string indicating in which context this module can be executed. Possible values are:
- `both`: the module can be executed as root module and submodule
- `root`: the module can only be executed as root module
- `sub`: the module can only be executed as submodule
- `name`: a string indicating the name that will be displayed in VyBuild call tree
- `actions`: a list of actions (see [actions docs](actions.md)) to execute in the module
### Optional fields for root module
Modules called from the command line can include the following optional fields :
- `global_uuid`: a list of string giving variables names that will be filled with random UUIDs v4 as each build. They can be used as regular variables
- `global_vars`: a dictionnary of string to string entries, associating variables names to their contents. For more informations, see [variables docs](variables.md)