Skip to content

Instantly share code, notes, and snippets.

@skhatri
Created December 21, 2011 12:12
Show Gist options
  • Save skhatri/1505804 to your computer and use it in GitHub Desktop.
Save skhatri/1505804 to your computer and use it in GitHub Desktop.
Gradle Dependency Task configuration
package com.mybuild
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
class AddDependencyTask extends DefaultTask {
def libMap
@TaskAction
void addLibrariesInBulk() {
libMap.each { groupName, dependencySet ->
dependencySet.each {
def fileName = "${it}.lib.properties"
project.file(fileName).eachLine {
project.dependencies.add(groupName, it)
}
}
}
}
}
task addlibs(type: LibProviderTask)
configure(addlibs) {
libMap = ['compile':["compile", "gwt", "web"], 'testCompile' : ["test"]]
}
dependencies {
project.addlibs.execute()
groovy 'org.codehaus.groovy:groovy-all:1.8.2'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment