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

Fixes for the IDEA plug-in.

This commit is contained in:
Cedric Beust 2015-12-01 13:58:25 -08:00
parent 732f17b7b7
commit f227ce9698
2 changed files with 4 additions and 18 deletions

View file

@ -8,14 +8,12 @@ import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.PluginProperties import com.beust.kobalt.api.PluginProperties
import com.beust.kobalt.api.Project import com.beust.kobalt.api.Project
import com.beust.kobalt.internal.PluginInfo import com.beust.kobalt.internal.PluginInfo
import com.beust.kobalt.internal.build.VersionFile
import com.beust.kobalt.maven.DependencyManager import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.misc.KFiles import com.beust.kobalt.misc.KFiles
import com.beust.kobalt.misc.KobaltExecutors import com.beust.kobalt.misc.KobaltExecutors
import com.beust.kobalt.misc.log import com.beust.kobalt.misc.log
import com.beust.kobalt.plugin.kotlin.kotlinCompilePrivate import com.beust.kobalt.plugin.kotlin.kotlinCompilePrivate
import com.google.inject.assistedinject.Assisted import com.google.inject.assistedinject.Assisted
import rx.subjects.PublishSubject
import java.io.File import java.io.File
import java.net.URL import java.net.URL
import java.nio.file.Paths import java.nio.file.Paths
@ -35,8 +33,6 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
fun create(@Assisted("buildFiles") buildFiles: List<BuildFile>, pluginInfo: PluginInfo) : BuildFileCompiler fun create(@Assisted("buildFiles") buildFiles: List<BuildFile>, pluginInfo: PluginInfo) : BuildFileCompiler
} }
val observable = PublishSubject.create<List<Project>>()
private val SCRIPT_JAR = "buildScript.jar" private val SCRIPT_JAR = "buildScript.jar"
fun compileBuildFiles(args: Args): List<Project> { fun compileBuildFiles(args: Args): List<Project> {
@ -115,12 +111,6 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
* - the source code for the modified Build.kt (after profiles are applied) * - the source code for the modified Build.kt (after profiles are applied)
* - the URL's of all the plug-ins that were found. * - the URL's of all the plug-ins that were found.
*/ */
private fun parseBuildFile(context: KobaltContext, buildFile: BuildFile) : ParsedBuildFile { private fun parseBuildFile(context: KobaltContext, buildFile: BuildFile) =
// Parse the build file so we can generate preBuildScript and buildScript from it. ParsedBuildFile(buildFile, context, buildScriptUtil, dependencyManager, files)
with(ParsedBuildFile(buildFile, context, buildScriptUtil, dependencyManager, files)) {
// Notify possible listeners (e.g. KobaltServer) we now have all the projects
observable.onNext(projects)
return this
}
}
} }

View file

@ -30,12 +30,8 @@ class GetDependenciesCommand @Inject constructor(val executors: KobaltExecutors,
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")
val scriptCompiler = buildFileCompilerFactory.create(listOf(buildFile), pluginInfo) val scriptCompiler = buildFileCompilerFactory.create(listOf(buildFile), pluginInfo)
scriptCompiler.observable.subscribe { val projects = scriptCompiler.compileBuildFiles(args)
projects -> if (projects.size > 0) { sender.sendData(toData(projects))
sender.sendData(toData(projects))
}
}
scriptCompiler.compileBuildFiles(args)
} }
private fun toData(projects: List<Project>) : CommandData { private fun toData(projects: List<Project>) : CommandData {