From e3dee44ad2e826879a53e3ea30cfe890508b907f Mon Sep 17 00:00:00 2001 From: Dmitry Zhuravlev Date: Wed, 29 Mar 2017 12:55:29 +0300 Subject: [PATCH] + Implement handling of profiles param. Will close cbeust/kobalt-intellij-plugin#73 --- .../com/beust/kobalt/app/remote/GetDependencyGraphHandler.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/kotlin/com/beust/kobalt/app/remote/GetDependencyGraphHandler.kt b/src/main/kotlin/com/beust/kobalt/app/remote/GetDependencyGraphHandler.kt index a17f5dc3..d6a47912 100644 --- a/src/main/kotlin/com/beust/kobalt/app/remote/GetDependencyGraphHandler.kt +++ b/src/main/kotlin/com/beust/kobalt/app/remote/GetDependencyGraphHandler.kt @@ -26,6 +26,7 @@ class GetDependencyGraphHandler : WebSocketListener { val PARAMETER_PROJECT_ROOT = "projectRoot" val PARAMETER_BUILD_FILE = "buildFile" + val PARAMETER_PROFILES = "profiles" var session: Session? = null @@ -44,6 +45,8 @@ class GetDependencyGraphHandler : WebSocketListener { errorMessage = errorMessage))) } + private fun findProfiles(map: Map>) = map[PARAMETER_PROFILES]?.getOrNull(0) + private fun findBuildFile(map: Map>) : BuildSources? { val projectRoot = map[PARAMETER_PROJECT_ROOT] val buildFile = map[PARAMETER_BUILD_FILE] @@ -61,6 +64,7 @@ class GetDependencyGraphHandler : WebSocketListener { override fun onWebSocketConnect(s: Session) { session = s val buildSources = findBuildFile(s.upgradeRequest.parameterMap) + val profiles = findProfiles(s.upgradeRequest.parameterMap) fun getInstance(cls: Class) : T = Kobalt.INJECTOR.getInstance(cls) @@ -84,6 +88,7 @@ class GetDependencyGraphHandler : WebSocketListener { try { val dependencyData = getInstance(RemoteDependencyData::class.java) val args = getInstance(Args::class.java) + args.profiles = profiles val allProjects = projectFinder.initForBuildFile(buildSources, args)