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

GH-392: Make collect() return both File and id.

Fixes https://github.com/cbeust/kobalt/issues/392
This commit is contained in:
Cedric Beust 2017-04-07 12:28:22 -07:00
parent 5ae20fb253
commit e19b3472a7

View file

@ -128,14 +128,16 @@ open class Project(
return result
}
class Dep(val File: File, val id: String)
/**
* @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<File> {
return Kobalt.context?.dependencyManager?.transitiveClosure(dependencies)?.map { it.jarFile.get() }
?: emptyList()
fun collect(dependencies: List<IClasspathDependency>) : List<Dep> {
return (Kobalt.context?.dependencyManager?.transitiveClosure(dependencies) ?: emptyList())
.map { Dep(it.jarFile.get(), it.id) }
}
override fun toString() = "[Project $name]"