mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
Add <kobalt-compiler-version> and -repo to settings.
This commit is contained in:
parent
7bea179d69
commit
e51664edea
4 changed files with 27 additions and 7 deletions
|
@ -4,6 +4,7 @@ import com.beust.kobalt.TaskResult
|
|||
import com.beust.kobalt.api.*
|
||||
import com.beust.kobalt.internal.ICompilerAction
|
||||
import com.beust.kobalt.internal.JvmCompiler
|
||||
import com.beust.kobalt.internal.KobaltSettings
|
||||
import com.beust.kobalt.kotlin.ParentLastClassLoader
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.beust.kobalt.maven.dependency.FileDependency
|
||||
|
@ -32,14 +33,13 @@ class KotlinCompiler @Inject constructor(
|
|||
val files: KFiles,
|
||||
val dependencyManager: DependencyManager,
|
||||
val executors: KobaltExecutors,
|
||||
val settings: KobaltSettings,
|
||||
val jvmCompiler: JvmCompiler) {
|
||||
companion object {
|
||||
val KOTLIN_VERSION = "1.0.0"
|
||||
}
|
||||
|
||||
val compilerAction = object: ICompilerAction {
|
||||
override fun compile(projectName: String?, info: CompilerActionInfo): TaskResult {
|
||||
log(1, " Kotlin compiling " + Strings.pluralizeAll("file", info.sourceFiles.size))
|
||||
val version = settings.kobaltCompilerVersion
|
||||
log(1, " Kotlin $version compiling " + Strings.pluralizeAll("file", info.sourceFiles.size))
|
||||
val cp = compilerFirst(info.dependencies.map {it.jarFile.get()})
|
||||
val infoDir = info.directory
|
||||
val outputDir = if (infoDir != null) {
|
||||
|
@ -134,7 +134,8 @@ class KotlinCompiler @Inject constructor(
|
|||
otherClasspath: List<String>, sourceFiles: List<String>, outputDir: File, args: List<String>) : TaskResult {
|
||||
|
||||
val executor = executors.newExecutor("KotlinCompiler", 10)
|
||||
val compilerDep = dependencyManager.create("org.jetbrains.kotlin:kotlin-compiler-embeddable:$KOTLIN_VERSION")
|
||||
val compilerVersion = settings.kobaltCompilerVersion
|
||||
val compilerDep = dependencyManager.create("org.jetbrains.kotlin:kotlin-compiler-embeddable:$compilerVersion")
|
||||
val deps = dependencyManager.transitiveClosure(listOf(compilerDep))
|
||||
|
||||
// Force a download of the compiler dependencies
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.beust.kobalt.api.*
|
|||
import com.beust.kobalt.api.annotation.Directive
|
||||
import com.beust.kobalt.internal.BaseJvmPlugin
|
||||
import com.beust.kobalt.internal.JvmCompilerPlugin
|
||||
import com.beust.kobalt.internal.KobaltSettings
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.beust.kobalt.maven.dependency.FileDependency
|
||||
import com.beust.kobalt.misc.KFiles
|
||||
|
@ -18,7 +19,7 @@ import javax.inject.Singleton
|
|||
|
||||
@Singleton
|
||||
class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val dependencyManager: DependencyManager,
|
||||
override val configActor: ConfigActor<KotlinConfig>)
|
||||
val settings: KobaltSettings, override val configActor: ConfigActor<KotlinConfig>)
|
||||
: BaseJvmPlugin<KotlinConfig>(configActor), IDocContributor, IClasspathContributor, ICompilerContributor, IBuildConfigContributor {
|
||||
|
||||
companion object {
|
||||
|
@ -93,7 +94,7 @@ class KotlinPlugin @Inject constructor(val executors: KobaltExecutors, val depen
|
|||
}
|
||||
|
||||
private fun getKotlinCompilerJar(name: String): String {
|
||||
val id = "org.jetbrains.kotlin:$name:${KotlinCompiler.KOTLIN_VERSION}"
|
||||
val id = "org.jetbrains.kotlin:$name:${settings.kobaltCompilerVersion}"
|
||||
val dep = dependencyManager.create(id)
|
||||
val result = dep.jarFile.get().absolutePath
|
||||
return result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue