Buildship API to modify settings gradle file

Is there an API present to programatically modify settings.gradle file? Namely the value?

Use case: sample project is imported which may have various states: initial, intermediate, complete for example. Project name should reflect the state of the project hence project name in the settings.gradle file (if present) should be modified as well.

You can write a settings plugin that modifies the root project name. Here’s a PoC implementation in the settings.gradle file:

class CustomPlugin implements Plugin<Settings> {
    void apply(Settings s) { = "custom-project-name"

apply plugin: CustomPlugin

(Note: I don’t recommend having complex code in the settings.gradle file. The content should be refactored to a separate plugin)