tools: Don't use Distribution class in helpers

This commit is contained in:
Ilya Matveev
2017-03-29 10:47:06 +07:00
committed by ilmat192
parent d4ced1ba9b
commit 6dea5e5c79
7 changed files with 46 additions and 54 deletions
@@ -13,13 +13,17 @@ import org.jetbrains.kotlin.config.addKotlinSourceRoots
import java.util.*
import kotlin.reflect.KFunction
// TODO: Don't use reflection?
private fun maybeExecuteHelper(configuration: CompilerConfiguration) {
try {
val kClass = Class.forName("org.jetbrains.kotlin.konan.CompilerHelper0").kotlin
val kClass = Class.forName("org.jetbrains.kotlin.konan.Helper0").kotlin
val ctor = kClass.constructors.single() as KFunction<Runnable>
val distribution = Distribution(configuration)
val result = ctor.call(distribution)
val result = ctor.call(
distribution.dependenciesDir,
distribution.properties.properties,
distribution.dependencies
)
result.run()
} catch (notFound: ClassNotFoundException) {
// Just ignore, no helper.
@@ -4,24 +4,13 @@
//
package org.jetbrains.kotlin.konan
import org.jetbrains.kotlin.backend.konan.Distribution
import org.jetbrains.kotlin.backend.konan.TargetManager
import java.util.*
// Name it CompilerHelper0 so that it get loaded.
class CompilerHelper0Disabled(val distribution: Distribution) : Runnable {
class Helper0Disabled(val dependenciesDir: String,
val properties: Properties,
val dependencies: List<String>) : Runnable {
override fun run() {
println("Running helper with ${distribution.konanHome} ${distribution.target} ${TargetManager.host}")
}
}
//
// Example startup helper for Kotlin N stub generator. Compile to JAR and add it to
// Kotlin N classpath - it will get loaded and executed automatically.
//
// Name it InteropHelper0 so that it get loaded.
class InteropHelper0Disabled(val dependenciesRoot: String, val dependencies: List<String>) : Runnable {
override fun run() {
println("Running helper with $dependenciesRoot $dependencies")
println("Running helper for $dependenciesDir, $properties, $dependencies")
}
}