1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-27 00:38:11 -07:00

Merge pull request #374 from dmitry-zhuravlev/master

* download sources property propagation. relates to #372
This commit is contained in:
Cedric Beust 2017-04-03 09:47:44 -07:00 committed by GitHub
commit 1c27b9f1e4
4 changed files with 43 additions and 12 deletions

View file

@ -26,6 +26,7 @@ class GetDependencyGraphHandler : WebSocketListener {
val PARAMETER_PROJECT_ROOT = "projectRoot"
val PARAMETER_BUILD_FILE = "buildFile" // Deprecated
val PARAMETER_PROFILES = "profiles"
val PARAMETER_DOWNLOAD_SOURCES = "downloadSources"
var session: Session? = null
@ -46,6 +47,7 @@ class GetDependencyGraphHandler : WebSocketListener {
}
private fun findProfiles(map: Map<String, List<String>>) = map[PARAMETER_PROFILES]?.getOrNull(0)
private fun findDownloadSources(map: Map<String, List<String>>) = map[PARAMETER_DOWNLOAD_SOURCES]?.getOrNull(0)?.toBoolean() ?: false
private fun findBuildFile(map: Map<String, List<String>>) : BuildSources? {
val projectRoot = map[PARAMETER_PROJECT_ROOT]
@ -66,6 +68,7 @@ class GetDependencyGraphHandler : WebSocketListener {
val parameterMap = s.upgradeRequest.parameterMap
val buildSources = findBuildFile(parameterMap)
val profiles = findProfiles(parameterMap)
val downloadSources = findDownloadSources(s.upgradeRequest.parameterMap)
fun <T> getInstance(cls: Class<T>) : T = Kobalt.INJECTOR.getInstance(cls)
@ -91,6 +94,7 @@ class GetDependencyGraphHandler : WebSocketListener {
val args = getInstance(Args::class.java)
args.buildFile = buildSources.root.absolutePath
args.profiles = profiles
args.downloadSources = downloadSources
val projectResults = projectFinder.initForBuildFile(buildSources, args)