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

Gradle: support build cache #146

Closed
sdavids opened this issue Sep 5, 2018 · 5 comments
Closed

Gradle: support build cache #146

sdavids opened this issue Sep 5, 2018 · 5 comments

Comments

@sdavids
Copy link

sdavids commented Sep 5, 2018

Please support Gradle build cache.

https://docs.gradle.org/current/userguide/build_cache.html#sec:task_output_caching_details
https://guides.gradle.org/using-build-cache/

@sdavids sdavids changed the title Gradle: support task output caching Gradle: support build cache Sep 5, 2018
@uschindler
Copy link
Member

Hi,
the forbidden task has no outputs (yet), so it can't be cached. This may change once we produce reports as a file on disk, but that's not yet possible. See issue #134.
The task is currently only run if the inputs change, so there won't be any speedup for normal builds. The extension by the build cache is that the input is used as a key for a cache, so if you revert your changes to code, the same results like before the change can be implied. But to report the failures from cache, forbidden needs to save the outputs somewhere.

@hakanai
Copy link

hakanai commented Mar 29, 2019

I started wondering whether forbidden-apis could be modified to run as a javac plugin so that it necessarily ran as part of producing the classfiles, which would then mean that the cache would only contain already-checked code. 🤔

@uschindler uschindler mentioned this issue Jan 9, 2020
@uschindler
Copy link
Member

This is resolved by #155: As the task has currently no output, there's no need to cache anything. The "fake" output was removed by #159 and upToDateWhen was fixed to work consistently with other check tasks.

Once we add output files, we will declare them as output and we can enable caching.

@sebersole
Copy link

FWIW, using 3.2, it is not my experience that these tasks are skipped when sources/classes do not change. That could be because I spawn multiple tasks rather than relying on the task created by the plugin.

I added a "fake" output to work around this.

I'll dig into your code and see how you configured that.

@sebersole
Copy link

Just changing outputs I gave the task worked. From

task.classesDirs = project.sourceSets.main.output.classesDirs
task.classpath = project.sourceSets.main.compileClasspath + project.sourceSets.main.runtimeClasspath

to

task.classesDirs = project.sourceSets.main.output
task.classpath = configurations.runtimeClasspath + configurations.compileClasspath

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

No branches or pull requests

4 participants