Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable build cache support #244

Closed
xvik opened this issue May 9, 2020 · 4 comments · Fixed by #258
Closed

Enable build cache support #244

xvik opened this issue May 9, 2020 · 4 comments · Fixed by #258

Comments

@xvik
Copy link

xvik commented May 9, 2020

Plugin version 4.0 lost gradle build cache support.

It was enabled in 3.0.0: https://github.com/spotbugs/spotbugs-gradle-plugin/blob/3.0.0/src/main/java/com/github/spotbugs/SpotBugsTask.java#L59

The fix is just to get back the @CacheableTask annotation on the SpotBugsTask.

Build cache can be verified as:

  1. Run spotbugs task with build cache enabled:
    gradlew spotbugsMain --build-cache
    task status will be SUCCESS (task executed)
  2. Do cleanup
    gradlew clean
  3. Run the same task with enabled cache:
    gradlew spotbugsMain --build-cache
    task status should be FROM_CACHE (task output taken from the cache without execution)
@DPUkyle
Copy link
Contributor

DPUkyle commented May 14, 2020

Please make sure this is well tested - simply slapping the @CacheableTask on a task does not make it "correct" in terms of inputs/outputs and relative path sensitivity.

I would like to help but it's a matter of finding time to do the work.

@DPUkyle
Copy link
Contributor

DPUkyle commented May 18, 2020

A colleague and I are starting work to add a regression test to ensure the task is correctly cacheable.

@DPUkyle
Copy link
Contributor

DPUkyle commented May 20, 2020

Note that in our testing we found the SpotBugsTask#projectName property has the ability to break cacheability.

Projects not setting rootProject.name = '...' in settings.gradle will inherit the name of the root folder as their projectName.

The workaround we took was to mark projectName as @Internal, not @Input. There are other approaches if the community does not find this acceptable.

@github-actions
Copy link

🎉 This issue has been resolved in version 4.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging a pull request may close this issue.

3 participants