Skip to content

Fix Recipe to remove build cache configuration for Develocity#6465

Merged
timtebeek merged 16 commits intoopenrewrite:mainfrom
div-bargali:main
Jan 2, 2026
Merged

Fix Recipe to remove build cache configuration for Develocity#6465
timtebeek merged 16 commits intoopenrewrite:mainfrom
div-bargali:main

Conversation

@div-bargali
Copy link
Copy Markdown
Contributor

@div-bargali div-bargali commented Dec 26, 2025

What's changed?

Added a unit test that fails with the current recipe to remove Develocity Build Cache Configuration.

Edit - Added a boolean flag (optional) removeBuildCache to RemoveDevelocityConfiguration recipe. When passed as true, it adds the buildCache extension in the settings.gradle(.kts) file for removal.

What's your motivation?

Anything in particular you'd like reviewers to focus on?

Adding a test case that fails with the current implementation. Would like to contribute a fix that would remove the buildCache extension correctly.

Have you considered any alternatives or workarounds?

There are no workarounds.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Dec 26, 2025
@div-bargali div-bargali changed the title Recipe to remove build cache configuration for Develocity [WIP] Recipe to remove build cache configuration for Develocity Dec 26, 2025
@div-bargali
Copy link
Copy Markdown
Contributor Author

Hi Team,
Opening a PR to add unit test scenarios where the current recipe fails. Will capture the details in an issue.

@div-bargali
Copy link
Copy Markdown
Contributor Author

Fixes Issue - #6466

@timtebeek timtebeek marked this pull request as draft December 26, 2025 13:27
@div-bargali div-bargali changed the title [WIP] Recipe to remove build cache configuration for Develocity [WIP] Fix Recipe to remove build cache configuration for Develocity Dec 26, 2025
@div-bargali div-bargali changed the title [WIP] Fix Recipe to remove build cache configuration for Develocity Fix Recipe to remove build cache configuration for Develocity Dec 26, 2025
@div-bargali
Copy link
Copy Markdown
Contributor Author

Added the fix and updated the PR description to explain the fix.

I noticed that there is a composite recipe RemoveDevelocity that uses this recipe as well. (https://github.com/openrewrite/rewrite/blob/main/rewrite-gradle/src/main/resources/META-INF/rewrite/gradle.yml#L47)
Did not make any changes to it as I reckon it is best for users to explicitly pass the flag's value as true as there can be a case when Develocity's build cache is not configured through Gradle's buildCache extension but the extension is still present. Open to discuss on this.

@div-bargali div-bargali marked this pull request as ready for review December 26, 2025 13:58
div-bargali and others added 3 commits December 26, 2025 19:55
…moveDevelocityTest.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…moveDevelocityTest.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…moveDevelocityConfiguration.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@timtebeek timtebeek added recipe Requested Recipe gradle labels Jan 2, 2026
@timtebeek timtebeek moved this from In Progress to Ready to Review in OpenRewrite Jan 2, 2026
Copy link
Copy Markdown
Member

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the help here @div-bargali ! I've condensed your work a bit by overriding getVisitor and applying some other best practices like ListUtils.filter. Great to see this resolved.

@timtebeek timtebeek merged commit 4c85a22 into openrewrite:main Jan 2, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite Jan 2, 2026
@div-bargali
Copy link
Copy Markdown
Contributor Author

Thanks for the help here @div-bargali ! I've condensed your work a bit by overriding getVisitor and applying some other best practices like ListUtils.filter. Great to see this resolved.

Thanks @timtebeek. Glad I could help in contributing to the project!

@timtebeek
Copy link
Copy Markdown
Member

All good; after discussing with Shannon we've added a small update to further limit what's removed vs retained.

@div-bargali
Copy link
Copy Markdown
Contributor Author

All good; after discussing with Shannon we've added a small update to further limit what's removed vs retained.

Thanks for sharing @timtebeek . It makes sense to restrict removal of remote(HttpBuildCache) block, however I'd like to point out that I have seen Develocity's Build Cache being configured using the HTTP connector more often than the Develocity's connector.
Maybe in the future we can add an optional flag for users who want to also remove the HttpBuildCache's configuration after evaluation of any reported issue. Thanks!

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

Labels

gradle recipe Requested Recipe

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Recipe to remove build cache configuration for Develocity

3 participants