| 1 |
# Scripting |
| 2 |
|
| 3 |
Muon supports modules and small scripts written in meson. In order to |
| 4 |
facilitate this, various language features are enabled during module and script |
| 5 |
evaluation. |
| 6 |
|
| 7 |
## Evaluation Modes |
| 8 |
|
| 9 |
Muon's implementation of the meson language includes three evaluation modes: |
| 10 |
|
| 11 |
- `external`: Regular meson.build files external to muon's implementation are |
| 12 |
evaluated in this mode. |
| 13 |
- `internal`: Any meson file evaluated using `muon internal eval ...` is |
| 14 |
evaluated in the internal mode. |
| 15 |
- `extended`: A layering of internal on top of external, allows features from both |
| 16 |
modes to be used simultaneously. This is the mode that script modules execute |
| 17 |
in. |
| 18 |
|
| 19 |
Both `internal` and `extended` mode enable the same additional language features |
| 20 |
collectively referred to as *scripting mode*. The primary difference between the |
| 21 |
two modes lies in which functions may be called. In particular, most functions |
| 22 |
that require a project() or manipulate the build state in any way are not |
| 23 |
available in `internal` mode. |
| 24 |
|
| 25 |
## Scripting Mode |
| 26 |
|
| 27 |
Muon's scripting mode consists of several langauge features as well as |
| 28 |
additional functions and modules. |
| 29 |
|
| 30 |
This guide focuses on the language features. The additional functions and |
| 31 |
modules are documented in the [Muon Reference](https://docs.muon.build/reference). All |
| 32 |
functions, modules, and arguments are tagged with their availability in muon's |
| 33 |
different evaluation modes. |