From 5d11395b7c2b1c297dc153fd8cc2976fcc1b4b0e Mon Sep 17 00:00:00 2001 From: Dmitry Zhuravlev Date: Fri, 14 Apr 2017 17:18:16 +0300 Subject: [PATCH] + server should send buildFileClasspath to plugin. close #410 --- .../src/main/kotlin/com/beust/kobalt/api/Kobalt.kt | 1 + .../com/beust/kobalt/app/remote/RemoteDependencyData.kt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt index 527d35b2..5a1d952c 100644 --- a/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt +++ b/modules/kobalt-plugin-api/src/main/kotlin/com/beust/kobalt/api/Kobalt.kt @@ -68,6 +68,7 @@ class Kobalt { fun addBuildFileClasspath(dep: String) { val dependencyManager = Kobalt.INJECTOR.getInstance(DependencyManager::class.java) + //FIXME buildFileClasspath collection never becomes clear! each synchronization will add the same dependencies to it buildFileClasspath.add(dependencyManager.create(dep)) } diff --git a/src/main/kotlin/com/beust/kobalt/app/remote/RemoteDependencyData.kt b/src/main/kotlin/com/beust/kobalt/app/remote/RemoteDependencyData.kt index bd1914ac..3f6a2a31 100644 --- a/src/main/kotlin/com/beust/kobalt/app/remote/RemoteDependencyData.kt +++ b/src/main/kotlin/com/beust/kobalt/app/remote/RemoteDependencyData.kt @@ -2,6 +2,7 @@ package com.beust.kobalt.app.remote import com.beust.kobalt.Args import com.beust.kobalt.api.IClasspathDependency +import com.beust.kobalt.api.Kobalt import com.beust.kobalt.api.Project import com.beust.kobalt.app.BuildFileCompiler import com.beust.kobalt.internal.DynamicGraph @@ -46,6 +47,8 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v val buildFileCompiler = buildFileCompilerFactory.create(buildSources, pluginInfo) val projectResult = buildFileCompiler.compileBuildFiles(args) + val buildFileDependencies = Kobalt.buildFileClasspath.map {toDependencyData(it, "compile")} + val pluginDependencies = projectResult.pluginUrls.map { File(it.toURI()) }.map { DependencyData(it.name, "compile", it.absolutePath) } @@ -176,7 +179,7 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v }) } - return GetDependenciesData(projectDatas, allTasks, pluginDependencies, findProjectResult.buildContentRoots, + return GetDependenciesData(projectDatas, allTasks, pluginDependencies, buildFileDependencies, findProjectResult.buildContentRoots, projectResult.taskResult.errorMessage) } @@ -202,6 +205,7 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v class GetDependenciesData(val projects: List = emptyList(), val allTasks: Collection = emptySet(), val pluginDependencies: List = emptyList(), + val buildFileDependencies: List = emptyList(), val buildContentRoots: List = emptyList(), val errorMessage: String?) { companion object {