Add a new root of <...>.dsl.KotlinCompile hierarchy in API
This new interface uses a more general type for its kotlinOptions, KotlinCommonToolOptions rather than KotlinCommonOptions. This is needed for the Kotlin/Native task to implement a common interface with the other Kotlin compilation tasks.
This commit is contained in:
+24
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
|
||||||
|
* that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.gradle.dsl
|
||||||
|
|
||||||
|
import groovy.lang.Closure
|
||||||
|
import org.gradle.api.Task
|
||||||
|
import org.gradle.api.tasks.Internal
|
||||||
|
|
||||||
|
interface KotlinCompile<out T : KotlinCommonOptions> : Task {
|
||||||
|
@get:Internal
|
||||||
|
val kotlinOptions: T
|
||||||
|
|
||||||
|
fun kotlinOptions(fn: T.() -> Unit) {
|
||||||
|
kotlinOptions.fn()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun kotlinOptions(fn: Closure<*>) {
|
||||||
|
fn.delegate = kotlinOptions
|
||||||
|
fn.call()
|
||||||
|
}
|
||||||
|
}
|
||||||
-15
@@ -18,21 +18,6 @@ package org.jetbrains.kotlin.gradle.dsl
|
|||||||
|
|
||||||
import groovy.lang.Closure
|
import groovy.lang.Closure
|
||||||
import org.gradle.api.Task
|
import org.gradle.api.Task
|
||||||
import org.gradle.api.tasks.Internal
|
|
||||||
|
|
||||||
interface KotlinCompile<T : KotlinCommonOptions> : Task {
|
|
||||||
@get:Internal
|
|
||||||
val kotlinOptions: T
|
|
||||||
|
|
||||||
fun kotlinOptions(fn: T.() -> Unit) {
|
|
||||||
kotlinOptions.fn()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun kotlinOptions(fn: Closure<*>) {
|
|
||||||
fn.delegate = kotlinOptions
|
|
||||||
fn.call()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KotlinJsCompile : KotlinCompile<KotlinJsOptions>
|
interface KotlinJsCompile : KotlinCompile<KotlinJsOptions>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user