Skip to content

build: make bootstrap record (and possibly remove) the presets it created - #1322

Open
gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:build/make_bootstrap_record_and_possibly_remove_the_presets_it_created
Open

gennaroprota wants to merge 1 commit into
cppalliance:developfrom
gennaroprota:build/make_bootstrap_record_and_possibly_remove_the_presets_it_created

Conversation

@gennaroprota

Copy link
Copy Markdown
Collaborator

Bootstrap wrote a preset to CMakeUserPresets.json for every configuration it set up, but kept no record of which presets were its own creation, so it could not tell them from the ones a user wrote, and never removed any: the file, and the run configurations generated from it, only grew with time.

Bootstrap now marks each preset it writes, and a new --remove-preset option drops a marked preset during a run. A preset without a marker is taken as the user's and is never removed.

Changes

  • Build:
    • Each preset bootstrap writes carries a marker in its vendor map, where a CMake preset keeps tool-specific data, under the key mrdocs.com/bootstrap/1.0. On Windows, it sits beside the Visual Studio settings bootstrap already wrote there. Of the ways the issue lists to keep the record, this one keeps it in the presets file itself, so it cannot drift from the presets it describes.
    • The new option --remove-preset NAME, repeatable once per preset, drops the named presets from CMakeUserPresets.json as part of an ordinary run. The run configurations that run generates then leave them out, through the pruning the generators already did for presets missing from the file. A preset without the marker, a name with no preset, and the preset the run sets up are each reported and left in place.
    • --remove-preset is read from the command line rather than stored in InstallOptions, because every InstallOptions field set on the command line is saved into the generated "Bootstrap Update" and "Bootstrap Refresh" run configurations and replayed on each refresh, and a removal is a one-off action.
  • Tests: New tests in utils/bootstrap/tests/test_presets.py cover the marker, including beside the Visual Studio settings, and each outcome of a removal: a marked preset, a hand-written one, the one the run sets up, an unknown name, a repeated name, a dry run, and a missing presets file. A test in utils/bootstrap/tests/test_installer.py checks that the installer forwards the option and reports each preset it removed.
  • Breaking changes: None, but presets written by an earlier bootstrap carry no marker, so they count as the user's, and cannot be removed with the new option, until bootstrap sets each of them up again.

Testing

The new tests run as part of the utils-bootstrap-tests ctest and the bootstrap coverage job in CI. Dropping the marker, or setting it before the Windows settings replace the vendor map, makes the marker tests fail.

Documentation

The option's description is in utils/bootstrap/src/core/option_help.py, and the generated bootstrap options partial is regenerated from it, including the note about presets from earlier versions.

Fixes #1296.

…ated

Bootstrap wrote a preset to CMakeUserPresets.json for every
configuration it set up, but kept no record of which presets were its
own creation, so it could not tell them from the ones a user wrote, and
never removed any: the file, and the run configurations generated from
it, only grew with time.

Mark each preset bootstrap writes in its `vendor` map, where a CMake
preset keeps tool-specific data, and add a `--remove-preset` option,
which drops a marked preset during a run.

A preset without a marker is taken as the user's and is never removed.

Fixes cppalliance#1296.
@github-actions

Copy link
Copy Markdown
Contributor

🧾 Changes by Scope

Scope Lines Δ% Lines Δ Lines + Lines - Files Δ Files + Files ~ Files ↔ Files -
🔧 Toolchain 55% 143 142 1 4 - 4 - -
🔧 Toolchain Tests 45% 116 116 - 2 - 2 - -
📄 Docs <1% 1 1 - 1 - 1 - -
Total 100% 260 259 1 7 - 7 - -

Legend: Files + (added), Files ~ (modified), Files ↔ (renamed), Files - (removed)

🔝 Top Files

  • utils/bootstrap/src/presets/generator.py (Toolchain): 115 lines Δ (+115 / -0)
  • utils/bootstrap/tests/test_presets.py (Toolchain Tests): 105 lines Δ (+105 / -0)
  • utils/bootstrap/src/installer.py (Toolchain): 11 lines Δ (+10 / -1)

Generated by 🚫 dangerJS against ccd9a17

@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://1322.mrdocs.prtest2.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-09-24 13:45:03 UTC

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

build: nothing records which presets bootstrap created, so old ones never go away

2 participants