Skip to content

Instantly share code, notes, and snippets.

@joyoyoyoyoyo
Forked from matthiasbalke/helper.gradle
Created July 31, 2019 11:22
Show Gist options
  • Select an option

  • Save joyoyoyoyoyo/e6ad6a3609f35af902f07d845263514e to your computer and use it in GitHub Desktop.

Select an option

Save joyoyoyoyoyo/e6ad6a3609f35af902f07d845263514e to your computer and use it in GitHub Desktop.
Gradle resolveDependencies Task
// found here: http://jdpgrailsdev.github.io/blog/2014/10/28/gradle_resolve_all_dependencies.html
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->
subProject.buildscript.configurations.each { configuration ->
resolveConfiguration(configuration)
}
subProject.configurations.each { configuration ->
resolveConfiguration(configuration)
}
}
}
}
void resolveConfiguration(configuration) {
if (isResolveableConfiguration(configuration)) {
configuration.resolve()
}
}
boolean isResolveableConfiguration(configuration) {
def nonResolveableConfigurations = ['apiElements', 'implementation',
'runtimeElements', 'runtimeOnly',
'testImplementation', 'testRuntimeOnly',
'generatedImplementation', 'generatedRuntimeOnly']
if (nonResolveableConfigurations.contains(configuration.getName())) {
return false
}
return true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment