diff --git a/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/HasKotlinDependencies.kt b/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/HasKotlinDependencies.kt index d31f668f329..0bd026226aa 100644 --- a/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/HasKotlinDependencies.kt +++ b/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/HasKotlinDependencies.kt @@ -10,8 +10,9 @@ import org.gradle.api.artifacts.Dependency import org.gradle.api.artifacts.ExternalModuleDependency import org.gradle.api.artifacts.ProjectDependency import org.gradle.util.ConfigureUtil +import java.io.File -interface KotlinDependencyHandler : KotlinNpmDependencyHandler { +interface KotlinDependencyHandler { fun api(dependencyNotation: Any): Dependency? fun api(dependencyNotation: String, configure: ExternalModuleDependency.() -> Unit): ExternalModuleDependency fun api(dependency: T, configure: T.() -> Unit): T @@ -52,6 +53,112 @@ interface KotlinDependencyHandler : KotlinNpmDependencyHandler { project(listOf("path", "configuration").zip(listOfNotNull(path, configuration)).toMap()) fun project(notation: Map): ProjectDependency + + @Deprecated("Declaring NPM dependency without version is forbidden") + fun npm(name: String): Dependency + + fun npm( + name: String, + version: String, + generateKotlinExternals: Boolean + ): Dependency + + fun npm( + name: String, + version: String + ): Dependency = npm( + name = name, + version = version, + generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS + ) + + fun npm( + name: String, + directory: File, + generateKotlinExternals: Boolean + ): Dependency + + fun npm( + name: String, + directory: File + ): Dependency = npm( + name = name, + directory = directory, + generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS + ) + + fun npm( + directory: File, + generateKotlinExternals: Boolean + ): Dependency + + fun npm( + directory: File + ): Dependency = npm( + directory = directory, + generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS + ) + + fun devNpm( + name: String, + version: String + ): Dependency + + fun devNpm( + name: String, + directory: File + ): Dependency + + fun devNpm( + directory: File + ): Dependency + + fun optionalNpm( + name: String, + version: String, + generateKotlinExternals: Boolean + ): Dependency + + fun optionalNpm( + name: String, + version: String + ): Dependency = optionalNpm( + name = name, + version = version, + generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS + ) + + fun optionalNpm( + name: String, + directory: File, + generateKotlinExternals: Boolean + ): Dependency + + fun optionalNpm( + name: String, + directory: File + ): Dependency = optionalNpm( + name = name, + directory = directory, + generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS + ) + + fun optionalNpm( + directory: File, + generateKotlinExternals: Boolean + ): Dependency + + fun optionalNpm( + directory: File + ): Dependency = optionalNpm( + directory = directory, + generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS + ) + + fun peerNpm( + name: String, + version: String + ): Dependency } interface HasKotlinDependencies { diff --git a/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinNpmDependencyHandler.kt b/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinNpmDependencyHandler.kt deleted file mode 100644 index f8b95978372..00000000000 --- a/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinNpmDependencyHandler.kt +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. - * 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.plugin - -import org.gradle.api.artifacts.Dependency -import java.io.File - -interface KotlinNpmDependencyHandler { - @Deprecated("Declaring NPM dependency without version is forbidden") - fun npm(name: String): Dependency - - fun npm( - name: String, - version: String, - generateKotlinExternals: Boolean - ): Dependency - - fun npm( - name: String, - version: String - ): Dependency = npm( - name = name, - version = version, - generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS - ) - - fun npm( - name: String, - directory: File, - generateKotlinExternals: Boolean - ): Dependency - - fun npm( - name: String, - directory: File - ): Dependency = npm( - name = name, - directory = directory, - generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS - ) - - fun npm( - directory: File, - generateKotlinExternals: Boolean - ): Dependency - - fun npm( - directory: File - ): Dependency = npm( - directory = directory, - generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS - ) - - fun devNpm( - name: String, - version: String - ): Dependency - - fun devNpm( - name: String, - directory: File - ): Dependency - - fun devNpm( - directory: File - ): Dependency - - fun optionalNpm( - name: String, - version: String, - generateKotlinExternals: Boolean - ): Dependency - - fun optionalNpm( - name: String, - version: String - ): Dependency = optionalNpm( - name = name, - version = version, - generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS - ) - - fun optionalNpm( - name: String, - directory: File, - generateKotlinExternals: Boolean - ): Dependency - - fun optionalNpm( - name: String, - directory: File - ): Dependency = optionalNpm( - name = name, - directory = directory, - generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS - ) - - fun optionalNpm( - directory: File, - generateKotlinExternals: Boolean - ): Dependency - - fun optionalNpm( - directory: File - ): Dependency = optionalNpm( - directory = directory, - generateKotlinExternals = DEFAULT_GENERATE_KOTLIN_EXTERNALS - ) - - fun peerNpm( - name: String, - version: String - ): Dependency -} - -const val DEFAULT_GENERATE_KOTLIN_EXTERNALS = true \ No newline at end of file diff --git a/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/NpmConstants.kt b/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/NpmConstants.kt new file mode 100644 index 00000000000..1a9fb97f25f --- /dev/null +++ b/libraries/tools/kotlin-gradle-plugin-api/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/NpmConstants.kt @@ -0,0 +1,8 @@ +/* + * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * 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.plugin + +const val DEFAULT_GENERATE_KOTLIN_EXTERNALS = true \ No newline at end of file