Conversation
- Add .gersemirc configuration (indent: 2, line_length: 80) - Add cmake/gersemi_definitions.cmake with custom function stubs - Update scripts/check-cmake-format.sh to use gersemi - Update scripts/setup-dev.sh to install gersemi instead of cmakelang - Update scripts/python-format-checks.sh to remove .cmake-format.py - Update .github/skills/formatting-and-linting.md to reference gersemi - Remove .cmake-format.py configuration file - Reformat all CMake files with gersemi Agent-Logs-Url: https://github.com/microsoft/CCF/sessions/1db57858-d495-453c-b63c-a69a8b6fc2bc Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/CCF/sessions/1db57858-d495-453c-b63c-a69a8b6fc2bc Co-authored-by: achamayou <4016369+achamayou@users.noreply.github.com>
|
@copilot is there a way to tweak gersemi settings so as to minimise the reformatting of our cmake? |
I tested all available gersemi settings against the original cmake-format output. The current config (
The bulk of the diff (~714 of 1120 lines) is in the root The |
|
@copilot how does the run time compare between gersemi and cmake-format on the repo? |
Benchmarked both on the repo's 22 CMake files (5 runs each, median wall-clock):
gersemi is ~15–25× faster, largely because it processes all files in one Python process while the old script spawned a new cmake-format process per file. Even comparing single-batch invocations, gersemi is ~15× faster. |
That's quite a bit quicker, arguably real time. What do you think @eddyashton? |
Replaces
cmake-format(cmakelang, pinned at 0.6.11) withgersemias the CMake file formatter.New files
.gersemirc— formatter config: 2-space indent, 80-char line length,favour-inliningcmake/gersemi_definitions.cmake— stub definitions for custom CCF commands (add_ccf_app,add_e2e_test,add_picobench, etc.) and third-party Corrosion commands so gersemi understands their keyword argument structureModified scripts
scripts/check-cmake-format.sh— swapscmake-formatforgersemi --check/gersemi -i, replaces the per-file loop with a single batch invocation, addsset -o pipefailscripts/setup-dev.sh—pip install cmakelang→pip install gersemiscripts/python-format-checks.sh— removes.cmake-format.pyfrom black's file listRemoved
.cmake-format.py— 250-line cmake-format config, superseded by.gersemircReformatted
All CMake files under
cmake/,samples/,src/,tests/, and rootCMakeLists.txthave been reformatted by gersemi. Changes are whitespace/layout only.One benign warning remains:
_messageis flagged as unknown because it's CMake's internal save of the originalmessage()builtin when overridden in the rootCMakeLists.txt. This is expected and does not affect formatting.