Repository navigation
Commit 0af2b37
authored
CP-309867: Render the PowerShell cmdlet files from mustache templates (xapi-project#7313)
The PowerShell generator builds each cmdlet's C# file with sprintf, with
the fixed parts of the file mixed in among the code that works out the
variable parts. That makes it hard to see what a generated cmdlet looks
like, and hard to change it. It's also the only SDK generator here with
no tests.
This PR moves those fixed parts into mustache templates. The psd1,
destructor, HTTP action and ConvertTo-XenRef files already work this
way. It also adds golden-file tests for the new templates.
It's a refactor: the generated SDK doesn't change. A full generator run
from this branch is byte-identical to one from master: 413 files,
including all 402 cmdlet .cs files.
Testing
- The generated SDK is byte-identical to master's, checked by diffing a
full generator run from each.
- dune build @fmt, the sdk-gen build, dune test ocaml/sdk-gen/powershell
(7 tests) and ./quality-gate.sh pass on both commits.13 files changed
Lines changed: 1189 additions & 459 deletions
File tree
- ocaml/sdk-gen/powershell
- templates
- test_data
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
6 | 16 | | |
7 | 17 | | |
8 | 18 | | |
| |||
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
23 | | - | |
| 33 | + | |
24 | 34 | | |
25 | 35 | | |
26 | 36 | | |
| |||
0 commit comments