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:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user