1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-25 07:57:12 -07:00

Send dependent projects in GetDependenciesCommand.

This commit is contained in:
Cedric Beust 2015-12-17 21:39:04 +04:00
parent 935a9caf39
commit 733c4b52b5
2 changed files with 15 additions and 3 deletions

View file

@ -3,7 +3,9 @@ package com.beust.kobalt.app.remote
import com.beust.kobalt.Args
import com.beust.kobalt.api.IClasspathDependency
import com.beust.kobalt.api.Project
import com.beust.kobalt.api.ProjectDescription
import com.beust.kobalt.app.BuildFileCompiler
import com.beust.kobalt.internal.JvmCompilerPlugin
import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.build.BuildFile
import com.beust.kobalt.internal.remote.CommandData
@ -55,7 +57,15 @@ class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
allDeps(project.compileDependencies).map { toDependencyData(it, "compile") }
val testDependencies = allDeps(project.testDependencies).map { toDependencyData(it, "testCompile") }
projectDatas.add(ProjectData(project.name, project.directory, compileDependencies, testDependencies,
@Suppress("UNCHECKED_CAST")
val pd = (project.projectProperties.get(JvmCompilerPlugin.DEPENDENT_PROJECTS)
as List<ProjectDescription>)
val dependentProjects = pd.filter { it.project.name == project.name }.flatMap {
it.dependsOn.map { it
.name
}}
projectDatas.add(ProjectData(project.name, project.directory, dependentProjects,
compileDependencies, testDependencies,
project.sourceDirectories, project.sourceDirectoriesTest))
}
log(1, "Returning BuildScriptInfo")
@ -70,7 +80,9 @@ class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
class DependencyData(val id: String, val scope: String, val path: String)
class ProjectData(val name: String, val directory: String, val compileDependencies: List<DependencyData>,
class ProjectData(val name: String, val directory: String,
val dependentProjects: List<String>,
val compileDependencies: List<DependencyData>,
val testDependencies: List<DependencyData>, val sourceDirs: Set<String>, val testDirs: Set<String>)
class GetDependenciesData(val projects: List<ProjectData>)

View file

@ -25,7 +25,7 @@ public class KobaltClient @Inject constructor() : Runnable {
try {
val socket = Socket("localhost", portNumber)
outgoing = PrintWriter(socket.outputStream, true)
val testBuildfile = Paths.get(SystemProperties.homeDir, "kotlin", "kobalt", "kobalt/src/Build.kt")
val testBuildfile = Paths.get(SystemProperties.homeDir, "java/testng/kobalt/src/Build.kt")
.toFile().absolutePath
val c : String = "{ \"name\":\"getDependencies\", \"buildFile\": \"$testBuildfile\"}"
outgoing!!.println(c)