1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -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 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. * @return a list of the transitive dependencies (absolute paths to jar files) for the given dependencies.
* Can be used for example as `collect(compileDependencies)`. * Can be used for example as `collect(compileDependencies)`.
*/ */
@Directive @Directive
fun collect(dependencies: List<IClasspathDependency>) : List<File> { fun collect(dependencies: List<IClasspathDependency>) : List<Dep> {
return Kobalt.context?.dependencyManager?.transitiveClosure(dependencies)?.map { it.jarFile.get() } return (Kobalt.context?.dependencyManager?.transitiveClosure(dependencies) ?: emptyList())
?: emptyList() .map { Dep(it.jarFile.get(), it.id) }
} }
override fun toString() = "[Project $name]" override fun toString() = "[Project $name]"