mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
getDependencies returns transitive closure.
This commit is contained in:
parent
eb623b7d9c
commit
5958bf0c5d
1 changed files with 10 additions and 6 deletions
|
@ -3,6 +3,7 @@ package com.beust.kobalt.internal.remote
|
||||||
import com.beust.kobalt.Args
|
import com.beust.kobalt.Args
|
||||||
import com.beust.kobalt.kotlin.BuildFile
|
import com.beust.kobalt.kotlin.BuildFile
|
||||||
import com.beust.kobalt.kotlin.BuildFileCompiler
|
import com.beust.kobalt.kotlin.BuildFileCompiler
|
||||||
|
import com.beust.kobalt.maven.DependencyManager
|
||||||
import com.beust.kobalt.maven.IClasspathDependency
|
import com.beust.kobalt.maven.IClasspathDependency
|
||||||
import com.beust.kobalt.maven.MavenDependency
|
import com.beust.kobalt.maven.MavenDependency
|
||||||
import com.beust.kobalt.misc.KobaltExecutors
|
import com.beust.kobalt.misc.KobaltExecutors
|
||||||
|
@ -22,7 +23,8 @@ import java.nio.file.Paths
|
||||||
* The response is a GetDependenciesData.
|
* The response is a GetDependenciesData.
|
||||||
*/
|
*/
|
||||||
class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
|
class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
|
||||||
val buildFileCompilerFactory: BuildFileCompiler.IFactory, val args: Args) : ICommand {
|
val buildFileCompilerFactory: BuildFileCompiler.IFactory, val args: Args,
|
||||||
|
val dependencyManager: DependencyManager) : ICommand {
|
||||||
override val name = "getDependencies"
|
override val name = "getDependencies"
|
||||||
override fun run(sender: ICommandSender, received: JsonObject) {
|
override fun run(sender: ICommandSender, received: JsonObject) {
|
||||||
val buildFile = BuildFile(Paths.get(received.get("buildFile").asString), "GetDependenciesCommand")
|
val buildFile = BuildFile(Paths.get(received.get("buildFile").asString), "GetDependenciesCommand")
|
||||||
|
@ -44,13 +46,15 @@ class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
|
||||||
return DependencyData(d.id, scope, dep.jarFile.get().absolutePath)
|
return DependencyData(d.id, scope, dep.jarFile.get().absolutePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun allDeps(l: List<IClasspathDependency>) = dependencyManager.transitiveClosure(l)
|
||||||
|
|
||||||
info.projects.forEach { project ->
|
info.projects.forEach { project ->
|
||||||
val allDependencies =
|
val allDependencies =
|
||||||
project.compileDependencies.map { toDependencyData(it, "compile") } +
|
allDeps(project.compileDependencies).map { toDependencyData(it, "compile") } +
|
||||||
project.compileProvidedDependencies.map { toDependencyData(it, "provided") } +
|
allDeps(project.compileProvidedDependencies).map { toDependencyData(it, "provided") } +
|
||||||
project.compileRuntimeDependencies.map { toDependencyData(it, "runtime") } +
|
allDeps(project.compileRuntimeDependencies).map { toDependencyData(it, "runtime") } +
|
||||||
project.testDependencies.map { toDependencyData(it, "testCompile") } +
|
allDeps(project.testDependencies).map { toDependencyData(it, "testCompile") } +
|
||||||
project.testProvidedDependencies.map { toDependencyData(it, "testProvided") }
|
allDeps(project.testProvidedDependencies).map { toDependencyData(it, "testProvided") }
|
||||||
|
|
||||||
projects.add(ProjectData(project.name!!, allDependencies))
|
projects.add(ProjectData(project.name!!, allDependencies))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue