Skip to content

Add Develocity SetDevelocityProjectId and SetDevelocityServer recipes - #8311

Merged
timtebeek merged 5 commits into
mainfrom
set-develocity-project-id
Jul 22, 2026
Merged

Add Develocity SetDevelocityProjectId and SetDevelocityServer recipes#8311
timtebeek merged 5 commits into
mainfrom
set-develocity-project-id

Conversation

@timtebeek

@timtebeek timtebeek commented Jul 22, 2026

Copy link
Copy Markdown
Member

As part of the Develocity server migration, each project's develocity configuration in settings.gradle(.kts) must declare a projectId (and, for stragglers, point at the new server) so build scans are associated with the correct project on the new server.

This adds two focused recipes under org.openrewrite.gradle.plugins, alongside the existing Develocity recipes:

  • SetDevelocityProjectId — inserts projectId = "<value>" right after the server assignment in the develocity {} block when absent, updates it when it differs, and no-ops when already set.
  • SetDevelocityServer — sets/updates server = "<value>" (inserted as the first statement when absent); useful for migrating builds between Develocity servers.

Both share a package-private Develocity helper (block traversal + string-property upsert) and handle both the Kotlin (settings.gradle.kts) and Groovy (settings.gradle) DSLs, including Groovy's implicit-return on a closure's last statement.

Example (settings.gradle.kts):

develocity {
    server = "https://community.develocity.cloud/"
    projectId = "openrewrite"
    // ...
}

SetDevelocityProjectId has already been run across the OpenRewrite org repositories to add projectId = "openrewrite" to each settings file.

Adds a recipe that sets `projectId` in the `develocity` block of a
Gradle settings file, inserting it after the `server` assignment when
absent or updating it when it differs. Handles both the Kotlin and
Groovy settings DSLs.

This supports the Develocity server migration where each project's
build scans must now declare `projectId = "openrewrite"`.
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jul 22, 2026
This was referenced Jul 22, 2026
Aligns with the other Develocity recipes (AddDevelocityGradlePlugin,
RemoveDevelocityConfiguration, MigrateGradleEnterpriseToDevelocity),
which live in org.openrewrite.gradle.plugins.
Extracts the develocity-block traversal and property upsert into a
package-private Develocity helper, and adds SetDevelocityServer to set
or update the `server` in a Gradle settings file's `develocity` block.
Declare displayName/description as initialized final fields so Lombok
generates the getters, matching EnableDevelocityBuildCache.
@timtebeek timtebeek changed the title Add SetDevelocityProjectId recipe Add Develocity SetDevelocityProjectId and SetDevelocityServer recipes Jul 22, 2026
@timtebeek
timtebeek merged commit 433cf7d into main Jul 22, 2026
1 check passed
@timtebeek
timtebeek deleted the set-develocity-project-id branch July 22, 2026 15:41
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Jul 22, 2026
timtebeek added a commit to openrewrite/rewrite-rewrite that referenced this pull request Jul 22, 2026
* Keep Develocity build scan config consistent in recipe best practices

Add SetDevelocityServer and SetDevelocityProjectId to
OpenRewriteRecipeBestPractices so every OpenRewrite recipe project's
settings.gradle(.kts) points at community.develocity.cloud with
projectId "openrewrite".

Depends on openrewrite/rewrite#8311 (introduces these recipes); the
build stays red until that is merged and released.

* Regenerate recipes.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant