Kotlin Gradle Plugin: Provide serialized list of compiler arguments in compilation tasks
This commit is contained in:
+5
-1
@@ -19,7 +19,11 @@ package org.jetbrains.kotlin.gradle.dsl
|
|||||||
import groovy.lang.Closure
|
import groovy.lang.Closure
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
|
|
||||||
interface KotlinCompile<T : KotlinCommonOptions> : Task {
|
interface CompilerArgumentAware {
|
||||||
|
val serializedCompilerArguments: List<String>
|
||||||
|
}
|
||||||
|
|
||||||
|
interface KotlinCompile<T : KotlinCommonOptions> : Task, CompilerArgumentAware {
|
||||||
val kotlinOptions: T
|
val kotlinOptions: T
|
||||||
|
|
||||||
fun kotlinOptions(fn: T.() -> Unit) {
|
fun kotlinOptions(fn: T.() -> Unit) {
|
||||||
|
|||||||
+8
-1
@@ -52,9 +52,16 @@ const val ANNOTATIONS_PLUGIN_NAME = "org.jetbrains.kotlin.kapt"
|
|||||||
const val KOTLIN_BUILD_DIR_NAME = "kotlin"
|
const val KOTLIN_BUILD_DIR_NAME = "kotlin"
|
||||||
const val USING_EXPERIMENTAL_INCREMENTAL_MESSAGE = "Using experimental kotlin incremental compilation"
|
const val USING_EXPERIMENTAL_INCREMENTAL_MESSAGE = "Using experimental kotlin incremental compilation"
|
||||||
|
|
||||||
abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractCompile() {
|
abstract class AbstractKotlinCompile<T : CommonCompilerArguments>() : AbstractCompile(), CompilerArgumentAware {
|
||||||
abstract protected fun populateCompilerArguments(): T
|
abstract protected fun populateCompilerArguments(): T
|
||||||
|
|
||||||
|
override val serializedCompilerArguments: List<String>
|
||||||
|
get() {
|
||||||
|
val arguments = populateCompilerArguments()
|
||||||
|
arguments.setupCommonCompilerArgs()
|
||||||
|
return ArgumentUtils.convertArgumentsToStringList(arguments)
|
||||||
|
}
|
||||||
|
|
||||||
// indicates that task should compile kotlin incrementally if possible
|
// indicates that task should compile kotlin incrementally if possible
|
||||||
// it's not possible when IncrementalTaskInputs#isIncremental returns false (i.e first build)
|
// it's not possible when IncrementalTaskInputs#isIncremental returns false (i.e first build)
|
||||||
var incremental: Boolean = false
|
var incremental: Boolean = false
|
||||||
|
|||||||
Reference in New Issue
Block a user