(minor) Separate the Gradle annotations from CompilerArgumentAware
This commit is contained in:
+15
-4
@@ -22,17 +22,14 @@ import org.jetbrains.kotlin.cli.common.arguments.CommonToolArguments
|
||||
import org.jetbrains.kotlin.compilerRunner.ArgumentUtils
|
||||
|
||||
interface CompilerArgumentAware<T : CommonToolArguments> {
|
||||
@get:Internal
|
||||
val serializedCompilerArguments: List<String>
|
||||
get() = ArgumentUtils.convertArgumentsToStringList(prepareCompilerArguments())
|
||||
|
||||
@get:Internal
|
||||
val defaultSerializedCompilerArguments: List<String>
|
||||
get() = createCompilerArgs()
|
||||
.also { setupCompilerArgs(it, defaultsOnly = true) }
|
||||
.let(ArgumentUtils::convertArgumentsToStringList)
|
||||
|
||||
@get:Input
|
||||
val filteredArgumentsMap: Map<String, String>
|
||||
get() = CompilerArgumentsGradleInput.createInputsMap(prepareCompilerArguments())
|
||||
|
||||
@@ -41,4 +38,18 @@ interface CompilerArgumentAware<T : CommonToolArguments> {
|
||||
}
|
||||
|
||||
internal fun <T : CommonToolArguments> CompilerArgumentAware<T>.prepareCompilerArguments() =
|
||||
createCompilerArgs().also { setupCompilerArgs(it) }
|
||||
createCompilerArgs().also { setupCompilerArgs(it) }
|
||||
|
||||
interface CompilerArgumentAwareWithInput<T : CommonToolArguments> : CompilerArgumentAware<T> {
|
||||
@get:Internal
|
||||
override val serializedCompilerArguments: List<String>
|
||||
get() = super.serializedCompilerArguments
|
||||
|
||||
@get:Internal
|
||||
override val defaultSerializedCompilerArguments: List<String>
|
||||
get() = super.defaultSerializedCompilerArguments
|
||||
|
||||
@get:Input
|
||||
override val filteredArgumentsMap: Map<String, String>
|
||||
get() = super.filteredArgumentsMap
|
||||
}
|
||||
+1
-1
@@ -14,7 +14,7 @@ import org.jetbrains.kotlin.gradle.tasks.*
|
||||
import java.io.File
|
||||
|
||||
@CacheableTask
|
||||
open class KaptTask : ConventionTask(), CompilerArgumentAware<K2JVMCompilerArguments> {
|
||||
open class KaptTask : ConventionTask(), CompilerArgumentAwareWithInput<K2JVMCompilerArguments> {
|
||||
|
||||
init {
|
||||
cacheOnlyIfEnabledForKotlin()
|
||||
|
||||
+2
-2
@@ -36,7 +36,7 @@ import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
|
||||
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
|
||||
import org.jetbrains.kotlin.compilerRunner.*
|
||||
import org.jetbrains.kotlin.gradle.dsl.*
|
||||
import org.jetbrains.kotlin.gradle.internal.CompilerArgumentAware
|
||||
import org.jetbrains.kotlin.gradle.internal.CompilerArgumentAwareWithInput
|
||||
import org.jetbrains.kotlin.gradle.internal.prepareCompilerArguments
|
||||
import org.jetbrains.kotlin.gradle.plugin.*
|
||||
import org.jetbrains.kotlin.gradle.utils.ParsedGradleVersion
|
||||
@@ -54,7 +54,7 @@ const val KOTLIN_BUILD_DIR_NAME = "kotlin"
|
||||
const val USING_INCREMENTAL_COMPILATION_MESSAGE = "Using Kotlin incremental compilation"
|
||||
const val USING_EXPERIMENTAL_JS_INCREMENTAL_COMPILATION_MESSAGE = "Using experimental Kotlin/JS incremental compilation"
|
||||
|
||||
abstract class AbstractKotlinCompileTool<T : CommonToolArguments>() : AbstractCompile(), CompilerArgumentAware<T> {
|
||||
abstract class AbstractKotlinCompileTool<T : CommonToolArguments>() : AbstractCompile(), CompilerArgumentAwareWithInput<T> {
|
||||
// TODO: deprecate and remove
|
||||
@get:Internal
|
||||
var compilerJarFile: File? = null
|
||||
|
||||
Reference in New Issue
Block a user