tools: Add dependecy download helpers

This patch adds 2 helpers to download dependencies for compiler and
stub generator during their execution.

They take list of external dependencies as a parameter and directory
where they must be located. Helpers check if these dependencies exist
in the given directory and download not existing ones.
This commit is contained in:
Ilya Matveev
2017-03-21 15:43:13 +07:00
committed by ilmat192
parent 4a716fbf30
commit fbc14becfc
20 changed files with 342 additions and 21 deletions
@@ -16,17 +16,15 @@ import kotlin.reflect.KFunction
private fun maybeExecuteHelper(configuration: CompilerConfiguration) {
try {
val kClass = Class.forName("org.jetbrains.kotlin.konan.Helper0").kotlin
val kClass = Class.forName("org.jetbrains.kotlin.konan.CompilerHelper0").kotlin
val ctor = kClass.constructors.single() as KFunction<Runnable>
val distribution = Distribution(configuration)
val target = TargetManager(configuration)
val result = ctor.call(
distribution.konanHome, TargetManager.host, target.current)
val result = ctor.call(distribution)
result.run()
} catch (notFound: ClassNotFoundException) {
// Just ignore, no helper.
} catch (e: Throwable) {
println(e.toString())
throw IllegalStateException("Cannot download dependencies.", e)
}
}