Resolve compiler classpath using 'kotlinCompilerClasspath' configuration
#KT-24675 fixed
This commit is contained in:
+7
@@ -7,3 +7,10 @@ buildscript {
|
|||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
+2
-2
@@ -8,9 +8,9 @@ buildscript {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
allprojects {
|
subprojects {
|
||||||
// for test with groovy
|
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+5
@@ -1 +1,6 @@
|
|||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
+6
-1
@@ -1,7 +1,7 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
@@ -10,6 +10,11 @@ buildscript {
|
|||||||
|
|
||||||
apply plugin: "kotlin"
|
apply plugin: "kotlin"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
compileKotlin {
|
compileKotlin {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
languageVersion = "1.0"
|
languageVersion = "1.0"
|
||||||
|
|||||||
+8
-1
@@ -1,9 +1,16 @@
|
|||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
jcenter()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
subprojects {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
}
|
||||||
+4
@@ -37,6 +37,7 @@ import java.util.concurrent.Callable
|
|||||||
import java.util.jar.Manifest
|
import java.util.jar.Manifest
|
||||||
|
|
||||||
internal const val PLUGIN_CLASSPATH_CONFIGURATION_NAME = "kotlinCompilerPluginClasspath"
|
internal const val PLUGIN_CLASSPATH_CONFIGURATION_NAME = "kotlinCompilerPluginClasspath"
|
||||||
|
internal const val COMPILER_CLASSPATH_CONFIGURATION_NAME = "kotlinCompilerClasspath"
|
||||||
val KOTLIN_DSL_NAME = "kotlin"
|
val KOTLIN_DSL_NAME = "kotlin"
|
||||||
val KOTLIN_JS_DSL_NAME = "kotlin2js"
|
val KOTLIN_JS_DSL_NAME = "kotlin2js"
|
||||||
val KOTLIN_OPTIONS_DSL_NAME = "kotlinOptions"
|
val KOTLIN_OPTIONS_DSL_NAME = "kotlinOptions"
|
||||||
@@ -337,6 +338,9 @@ internal abstract class AbstractKotlinPlugin(
|
|||||||
internal abstract fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String): KotlinSourceSetProcessor<*>
|
internal abstract fun buildSourceSetProcessor(project: Project, javaBasePlugin: JavaBasePlugin, sourceSet: SourceSet, kotlinPluginVersion: String): KotlinSourceSetProcessor<*>
|
||||||
|
|
||||||
override fun apply(project: Project) {
|
override fun apply(project: Project) {
|
||||||
|
project.configurations.create(COMPILER_CLASSPATH_CONFIGURATION_NAME).defaultDependencies {
|
||||||
|
it.add(project.dependencies.create("$KOTLIN_MODULE_GROUP:$KOTLIN_COMPILER_EMBEDDABLE:$kotlinPluginVersion"))
|
||||||
|
}
|
||||||
project.configurations.create(PLUGIN_CLASSPATH_CONFIGURATION_NAME).apply {
|
project.configurations.create(PLUGIN_CLASSPATH_CONFIGURATION_NAME).apply {
|
||||||
// todo: Consider removing if org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser stops using parent last classloader
|
// todo: Consider removing if org.jetbrains.kotlin.cli.jvm.plugins.PluginCliParser stops using parent last classloader
|
||||||
isTransitive = false
|
isTransitive = false
|
||||||
|
|||||||
+21
-3
@@ -42,12 +42,31 @@ const val USING_INCREMENTAL_COMPILATION_MESSAGE = "Using Kotlin incremental comp
|
|||||||
const val USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE = "Using experimental Kotlin/JS incremental compilation"
|
const val USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE = "Using experimental Kotlin/JS incremental compilation"
|
||||||
|
|
||||||
abstract class AbstractKotlinCompileTool<T : CommonToolArguments>() : AbstractCompile(), CompilerArgumentAwareWithInput<T> {
|
abstract class AbstractKotlinCompileTool<T : CommonToolArguments>() : AbstractCompile(), CompilerArgumentAwareWithInput<T> {
|
||||||
// TODO: deprecate and remove
|
private fun useCompilerClasspathConfigurationMessage(propertyName: String) {
|
||||||
|
project.logger.kotlinWarn(
|
||||||
|
"'$path.$propertyName' is deprecated and will be removed soon. " +
|
||||||
|
"Use '$COMPILER_CLASSPATH_CONFIGURATION_NAME' " +
|
||||||
|
"configuration for customizing compiler classpath."
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove
|
||||||
@get:Internal
|
@get:Internal
|
||||||
var compilerJarFile: File? = null
|
var compilerJarFile: File? = null
|
||||||
|
@Deprecated("Use $COMPILER_CLASSPATH_CONFIGURATION_NAME configuration")
|
||||||
|
set(value) {
|
||||||
|
useCompilerClasspathConfigurationMessage("compilerJarFile")
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: remove
|
||||||
@get:Internal
|
@get:Internal
|
||||||
var compilerClasspath: List<File>? = null
|
var compilerClasspath: List<File>? = null
|
||||||
|
@Deprecated("Use $COMPILER_CLASSPATH_CONFIGURATION_NAME configuration")
|
||||||
|
set(value) {
|
||||||
|
useCompilerClasspathConfigurationMessage("compilerClasspath")
|
||||||
|
field = value
|
||||||
|
}
|
||||||
|
|
||||||
@InputFiles
|
@InputFiles
|
||||||
@PathSensitive(PathSensitivity.RELATIVE)
|
@PathSensitive(PathSensitivity.RELATIVE)
|
||||||
@@ -60,8 +79,7 @@ abstract class AbstractKotlinCompileTool<T : CommonToolArguments>() : AbstractCo
|
|||||||
// a hack to remove compiler jar from the cp, will be dropped when compilerJarFile will be removed
|
// a hack to remove compiler jar from the cp, will be dropped when compilerJarFile will be removed
|
||||||
listOf(it) + findKotlinCompilerClasspath(project).filter { !it.name.startsWith("kotlin-compiler") }
|
listOf(it) + findKotlinCompilerClasspath(project).filter { !it.name.startsWith("kotlin-compiler") }
|
||||||
}
|
}
|
||||||
?: findKotlinCompilerClasspath(project).takeIf { it.isNotEmpty() }
|
?: project.configurations.getByName(COMPILER_CLASSPATH_CONFIGURATION_NAME).resolve().toList()
|
||||||
?: throw IllegalStateException("Could not find Kotlin Compiler classpath. Please specify $name.compilerClasspath")
|
|
||||||
|
|
||||||
protected abstract fun findKotlinCompilerClasspath(project: Project): List<File>
|
protected abstract fun findKotlinCompilerClasspath(project: Project): List<File>
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -38,9 +38,9 @@ private val KOTLIN_SCRIPT_RUNTIME_EXPECTED_CLASS = "kotlin.script.templates.Anno
|
|||||||
private val KOTLIN_SCRIPT_ANNOTATION_EXPECTED_CLASS = "kotlin.script.experimental.annotations.KotlinScript"
|
private val KOTLIN_SCRIPT_ANNOTATION_EXPECTED_CLASS = "kotlin.script.experimental.annotations.KotlinScript"
|
||||||
private val KOTLIN_JVM_SCRIPT_COMPILER_EXPECTED_CLASS = "kotlin.script.experimental.jvm.JvmScriptCompiler"
|
private val KOTLIN_JVM_SCRIPT_COMPILER_EXPECTED_CLASS = "kotlin.script.experimental.jvm.JvmScriptCompiler"
|
||||||
private val KOTLIN_REFLECT_EXPECTED_CLASS = "kotlin.reflect.full.KClasses"
|
private val KOTLIN_REFLECT_EXPECTED_CLASS = "kotlin.reflect.full.KClasses"
|
||||||
private val KOTLIN_MODULE_GROUP = "org.jetbrains.kotlin"
|
internal const val KOTLIN_MODULE_GROUP = "org.jetbrains.kotlin"
|
||||||
private val KOTLIN_GRADLE_PLUGIN = "kotlin-gradle-plugin"
|
private val KOTLIN_GRADLE_PLUGIN = "kotlin-gradle-plugin"
|
||||||
private val KOTLIN_COMPILER_EMBEDDABLE = "kotlin-compiler-embeddable"
|
internal const val KOTLIN_COMPILER_EMBEDDABLE = "kotlin-compiler-embeddable"
|
||||||
private val KOTLIN_STDLIB = "kotlin-stdlib"
|
private val KOTLIN_STDLIB = "kotlin-stdlib"
|
||||||
private val KOTLIN_SCRIPT_RUNTIME = "kotlin-script-runtime"
|
private val KOTLIN_SCRIPT_RUNTIME = "kotlin-script-runtime"
|
||||||
private val KOTLIN_SCRIPT_COMMON = "kotlin-scripting-common"
|
private val KOTLIN_SCRIPT_COMMON = "kotlin-scripting-common"
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ plugins {
|
|||||||
dependencies {
|
dependencies {
|
||||||
runtime(project(":kotlin-stdlib"))
|
runtime(project(":kotlin-stdlib"))
|
||||||
runtime(project(":kotlin-script-runtime"))
|
runtime(project(":kotlin-script-runtime"))
|
||||||
runtimeOnly(project(":kotlin-reflect"))
|
runtime(project(":kotlin-reflect"))
|
||||||
}
|
}
|
||||||
|
|
||||||
noDefaultJar()
|
noDefaultJar()
|
||||||
|
|||||||
Reference in New Issue
Block a user