Skip to content

Instantly share code, notes, and snippets.

@mark-vieira
Created August 25, 2017 22:04
Show Gist options
  • Save mark-vieira/ad6ba9c6512cdd91acbdffce88e0653e to your computer and use it in GitHub Desktop.
Save mark-vieira/ad6ba9c6512cdd91acbdffce88e0653e to your computer and use it in GitHub Desktop.
Build cache plugin hack
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.internal.project.ProjectInternal
import org.gradle.caching.configuration.internal.BuildCacheConfigurationInternal
import org.gradle.caching.http.HttpBuildCache
class BuildCachePlugin implements Plugin<Project> {
@Override
void apply(Project project) {
def cacheConfig = ((ProjectInternal) project).services.get(BuildCacheConfigurationInternal)
cacheConfig.remote(HttpBuildCache) { HttpBuildCache cache ->
cache.enabled = true
cache.push = true
cache.url = 'http://localhost/cache/'
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment