Skip to content

Improve task relocatability in Detekt and Protobuf plugins#49840

Closed
erichaagdev wants to merge 2 commits intospring-projects:mainfrom
erichaagdev:main
Closed

Improve task relocatability in Detekt and Protobuf plugins#49840
erichaagdev wants to merge 2 commits intospring-projects:mainfrom
erichaagdev:main

Conversation

@erichaagdev
Copy link
Copy Markdown
Contributor

Overview

This PR improves build cache relocatability by fixing cross-machine cache misses in the Detekt and Protobuf tasks. Previously, absolute paths were leaking into task inputs, causing unnecessary cache invalidation between different environments (e.g., CI servers vs. local developer machines).

Changes

  • Detekt: Configures the basePath on Detekt tasks to use a relative path from the root project. This prevents absolute paths from being used during analysis.
  • Protobuf: Clears the javaExecutablePath on the Protobuf extension. This prevents absolute Java installation paths from being tracked as task inputs. (Note: This is safe because protoc and grpc are configured to use native binaries rather than executable JARs).

Impact

Normalizing these inputs ensures both tasks are fully relocatable. This will maximize remote build cache hits and prevent duplicate work across environments.

References

Configures the `basePath` on Detekt tasks to use a relative path from
the root project. This prevents absolute paths from being used during
analysis, avoiding cross-machine build cache misses and ensuring the
task is fully relocatable.

See: detekt/detekt#7170

Signed-off-by: Eric Haag <ehaag@gradle.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 30, 2026
Clears the `javaExecutablePath` on the Protobuf extension. This prevents
absolute Java installation paths from being tracked as task inputs,
avoiding cross-machine build cache misses and ensuring the task is fully
relocatable. This is safe because `protoc` and `grpc` are configured
to use native binaries rather than executable JARs.

See: google/protobuf-gradle-plugin#785

Signed-off-by: Eric Haag <ehaag@gradle.com>
@wilkinsona
Copy link
Copy Markdown
Member

Thanks for the PR, Eric. I like the Kotlin change as that only affects our build. I don't think we should make the proposed change to the Protobuf plugin as that'll affect the builds of Boot's users and I don't think it's our place to do that. Could you please update your proposal to that effect? Can you also please use a branch other than main in your repo so that we can push changes to it prior to merging (for example, we'll want to switch the base branch to 3.5.x)?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Mar 30, 2026
@erichaagdev
Copy link
Copy Markdown
Contributor Author

Hi, @wilkinsona.

Yes, I can use a different branch name. Do you know if it's possible to rename it, or do I need to close & reopen a new PR?

Regarding the Protobuf plugin issue, I agree and will remove the changes.

However, the Spring Boot build is affected by this exact issue. I applied the changes to the wrong location by mistake. Should I reapply the changes to the Spring Boot build instead?

See here: https://ge.solutions-team.gradle.com/s/j3swlzmpiha2q/performance/build-cache?anchor=eyJpZCI6InJlbW90ZS1taXNzIn0&cacheDetails=remote-miss#remote-miss-4qtw4offgrkgg-0

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 30, 2026
@wilkinsona
Copy link
Copy Markdown
Member

wilkinsona commented Mar 30, 2026

Yes, I can use a different branch name. Do you know if it's possible to rename it, or do I need to close & reopen a new PR?

Frustratingly, I don't think it's possible. I think close and re-open is in order. If it's not too much trouble, two separate PRs would be ideal. One for Kotlin using 3.5.x as the base branch and one for Protobuf using main as the base branch.

Regarding the Protobuf plugin issue, I agree and will remove the changes.

Thanks.

Should I reapply the changes to the Spring Boot build instead?

Yes please.

@erichaagdev
Copy link
Copy Markdown
Contributor Author

New PR here: #49842

@wilkinsona wilkinsona removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Mar 30, 2026
@snicoll snicoll added the status: superseded An issue that has been superseded by another label Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: superseded An issue that has been superseded by another

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants