build: make bootstrap record (and possibly remove) the presets it created - #1322
Open
gennaroprota wants to merge 1 commit into
Conversation
…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.
Contributor
🧾 Changes by Scope
🔝 Top Files
|
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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-presetoption drops a marked preset during a run. A preset without a marker is taken as the user's and is never removed.Changes
vendormap, where a CMake preset keeps tool-specific data, under the keymrdocs.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.--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-presetis read from the command line rather than stored inInstallOptions, because everyInstallOptionsfield 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.Testing
The new tests run as part of the
utils-bootstrap-testsctest and the bootstrap coverage job in CI. Dropping the marker, or setting it before the Windows settings replace thevendormap, 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.