diff --git a/buildSrc/src/main/groovy/com/uber/okbuck/OkBuckGradlePlugin.groovy b/buildSrc/src/main/groovy/com/uber/okbuck/OkBuckGradlePlugin.groovy index 89b837736..20a521cad 100644 --- a/buildSrc/src/main/groovy/com/uber/okbuck/OkBuckGradlePlugin.groovy +++ b/buildSrc/src/main/groovy/com/uber/okbuck/OkBuckGradlePlugin.groovy @@ -63,6 +63,7 @@ class OkBuckGradlePlugin implements Plugin { public static final String WRAPPER = "wrapper" public static final String BUCK_WRAPPER = "buckWrapper" public static final String DEFAULT_CACHE_PATH = ".okbuck/cache" + public static final String EXTRA_DEP_CACHE_PATH = ".okbuck/cache/extra" public static final String GROUP = "okbuck" public static final String BUCK_LINT = "buckLint" public static final String BUCK_LINT_LIBRARY = "buckLintLibrary" @@ -157,6 +158,13 @@ class OkBuckGradlePlugin implements Plugin { if (test.robolectric) { RobolectricUtil.download(project) } + + // Create extra dependency caches if needed + okbuckExt.extraDepCaches.each { String cacheName -> + Configuration extraConfiguration = project.configurations.maybeCreate("${cacheName}ExtraDepCache") + new DependencyCache(cacheName, project, "${EXTRA_DEP_CACHE_PATH}/${cacheName}", + Collections.singleton(extraConfiguration)) + } } // Configure okbuck task diff --git a/buildSrc/src/main/java/com/uber/okbuck/extension/OkBuckExtension.java b/buildSrc/src/main/java/com/uber/okbuck/extension/OkBuckExtension.java index 75749b10a..59fcf498d 100644 --- a/buildSrc/src/main/java/com/uber/okbuck/extension/OkBuckExtension.java +++ b/buildSrc/src/main/java/com/uber/okbuck/extension/OkBuckExtension.java @@ -66,6 +66,13 @@ public class OkBuckExtension { */ public boolean resourceUnion = true; + /** + * Additional dependency caches. + * Every entry will create a new configuration "entryDepCache" + * that can be used to fetch and cache dependencies. + */ + public Set extraDepCaches = new HashSet<>(); + public OkBuckExtension(Project project) { buckProjects = project.getSubprojects(); }