1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 00:17:11 -07:00

GITHUB-382: Expose Project.collect() to gather dependencies in the build file.

Fixes https://github.com/cbeust/kobalt/issues/382
This commit is contained in:
Cedric Beust 2017-04-03 10:58:40 -07:00
parent 570f9a0bb7
commit 789c969a9b

View file

@ -128,6 +128,18 @@ open class Project(
return result
}
/**
* @return a list of the transitive dependencies (absolute paths to jar files) for the given dependencies.
* Can be used for example as `collect(compileDependencies)`.
*/
@Directive
fun collect(dependencies: List<IClasspathDependency>) : List<String> {
return Kobalt.context?.dependencyManager?.transitiveClosure(dependencies)?.map { it.jarFile.get() }
?.map { it.absolutePath}
?: emptyList()
}
override fun toString() = "[Project $name]"
}