Add missing DSL features to the MPP dependencies DSL
* Add DSL for project(...) with path and configuration
* Add DSL for e.g. api(someDependency) { /* ... */ }
* Add DSL for e.g. api(kotlin("stdlib"))
Issue #KT-26663 Fixed
This commit is contained in:
+35
-4
@@ -6,12 +6,43 @@
|
||||
package org.jetbrains.kotlin.gradle.plugin
|
||||
|
||||
import groovy.lang.Closure
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import org.gradle.api.artifacts.ExternalModuleDependency
|
||||
import org.gradle.api.artifacts.ProjectDependency
|
||||
import org.gradle.util.ConfigureUtil
|
||||
|
||||
interface KotlinDependencyHandler {
|
||||
fun api(dependencyNotation: Any)
|
||||
fun implementation(dependencyNotation: Any)
|
||||
fun compileOnly(dependencyNotation: Any)
|
||||
fun runtimeOnly(dependencyNotation: Any)
|
||||
fun api(dependencyNotation: Any): Dependency?
|
||||
fun api(dependencyNotation: String, configure: ExternalModuleDependency.() -> Unit): ExternalModuleDependency
|
||||
fun <T : Dependency> api(dependency: T, configure: T.() -> Unit): T
|
||||
fun api(dependencyNotation: String, configure: Closure<*>) = api(dependencyNotation) { ConfigureUtil.configure(configure, this) }
|
||||
fun <T : Dependency> api(dependency: T, configure: Closure<*>) = api(dependency) { ConfigureUtil.configure(configure, this) }
|
||||
|
||||
fun implementation(dependencyNotation: Any): Dependency?
|
||||
fun implementation(dependencyNotation: String, configure: ExternalModuleDependency.() -> Unit): ExternalModuleDependency
|
||||
fun <T : Dependency> implementation(dependency: T, configure: T.() -> Unit): T
|
||||
fun implementation(dependencyNotation: String, configure: Closure<*>) = implementation(dependencyNotation) { ConfigureUtil.configure(configure, this) }
|
||||
fun <T : Dependency> implementation(dependency: T, configure: Closure<*>) = implementation(dependency) { ConfigureUtil.configure(configure, this) }
|
||||
|
||||
fun compileOnly(dependencyNotation: Any): Dependency?
|
||||
fun compileOnly(dependencyNotation: String, configure: ExternalModuleDependency.() -> Unit): ExternalModuleDependency
|
||||
fun <T : Dependency> compileOnly(dependency: T, configure: T.() -> Unit): T
|
||||
fun compileOnly(dependencyNotation: String, configure: Closure<*>) = compileOnly(dependencyNotation) { ConfigureUtil.configure(configure, this) }
|
||||
fun <T : Dependency> compileOnly(dependency: T, configure: Closure<*>) = compileOnly(dependency) { ConfigureUtil.configure(configure, this) }
|
||||
|
||||
fun runtimeOnly(dependencyNotation: Any): Dependency?
|
||||
fun runtimeOnly(dependencyNotation: String, configure: ExternalModuleDependency.() -> Unit): ExternalModuleDependency
|
||||
fun <T : Dependency> runtimeOnly(dependency: T, configure: T.() -> Unit): T
|
||||
fun runtimeOnly(dependencyNotation: String, configure: Closure<*>) = runtimeOnly(dependencyNotation) { ConfigureUtil.configure(configure, this) }
|
||||
fun <T : Dependency> runtimeOnly(dependency: T, configure: Closure<*>) = runtimeOnly(dependency) { ConfigureUtil.configure(configure, this) }
|
||||
|
||||
fun kotlin(simpleModuleName: String): ExternalModuleDependency = kotlin(simpleModuleName, null)
|
||||
fun kotlin(simpleModuleName: String, version: String?): ExternalModuleDependency
|
||||
|
||||
fun project(path: String, configuration: String? = null): ProjectDependency =
|
||||
project(listOf("path", "configuration").zip(listOfNotNull(path, configuration)).toMap())
|
||||
|
||||
fun project(notation: Map<String, Any?>): ProjectDependency
|
||||
}
|
||||
|
||||
interface HasKotlinDependencies {
|
||||
|
||||
Reference in New Issue
Block a user