Skip to content

Commit ee41f34

Browse files
committed
docs: mise à jour de la documentation pour l'accès au BuildContext dans les plugins
1 parent 8b0ee58 commit ee41f34

3 files changed

Lines changed: 16 additions & 2 deletions

File tree

docs/ark_main_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ GUI shortcuts:
4343

4444
## Relationship to BuildContext
4545

46-
The fields in `ark.yml` are mapped directly to the `BuildContext` data structure passed to engines:
46+
The fields in `ark.yml` are mapped directly to the `BuildContext` data structure passed to engines and BC plugins:
4747

4848
| ark.yml field | BuildContext field |
4949
| :--- | :--- |

docs/dev_docs/ARK_BuildContext_v1.0.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ This document defines the data contract between ARK core and compilation engines
55
---
66

77
### **1. Definition**
8-
The `BuildContext` is a normalized data structure passed by ARK to an engine's `build_command` method.
8+
The `BuildContext` is a normalized data structure passed by ARK to:
9+
1. An engine's `build_command` method.
10+
2. BC (Before-Compilation) plugins via the `PreCompileContext`.
911

1012
- **Source Agnostic**: Engines do not read source files (`ark.yml`, lock files, etc.). They rely exclusively on this context.
1113
- **Reproducibility**: The context contains all project-level metadata required to generate a consistent build command, regardless of whether it was triggered from a live configuration or a lock file.

docs/how_to_create_a_bc_plugin.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,22 @@ Key properties and methods.
129129
- `root`: Path object pointant vers la racine du workspace.
130130
- `name`: Nom du dossier workspace.
131131
- `config`: Dictionnaire complet de configuration (`bcasl.yml`).
132+
- `build_context`: Objet `BuildContext` contenant les paramètres de compilation (si disponible).
132133
- `file_patterns`: Patterns d'inclusion définis.
133134
- `exclude_patterns`: Patterns d'exclusion définis.
134135
- `iter_files(include, exclude)`: Itérateur optimisé (respecte les exclusions par défaut).
135136

137+
Usage du BuildContext :
138+
```python
139+
def on_pre_compile(self, ctx: PreCompileContext) -> None:
140+
if ctx.build_context:
141+
# Accès au dossier de sortie défini dans ark.yml ou le verrou
142+
output_dir = ctx.build_context.output_dir
143+
...
144+
```
145+
146+
*Exemple concret : Le plugin **OutputCleaner** utilise `ctx.build_context.output_dir` pour vider le dossier de sortie avant la compilation.*
147+
136148
Usage simplifié :
137149
```python
138150
# Parcourt tous les fichiers du projet selon la config bcasl.yml

0 commit comments

Comments
 (0)