Interface KotlinDependencyHandler
-
- All Implemented Interfaces:
-
org.jetbrains.kotlin.gradle.plugin.HasProject
public interface KotlinDependencyHandler implements HasProject
Represents a DSL for managing the dependencies of Kotlin entities that implement a HasKotlinDependencies interface.
-
-
Method Summary
Modifier and Type Method Description abstract Dependencyapi(Object dependencyNotation)Adds an apimodule dependency to this entity.abstract ExternalModuleDependencyapi(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)Adds an apimodule dependency to this entity.ExternalModuleDependencyapi(String dependencyNotation, Action<ExternalModuleDependency> configure)Adds an apimodule dependency to this entity.abstract <T extends Dependency> Tapi(T dependency, Function1<T, Unit> configure)Adds an apidependency to this entity.<T extends Dependency> Tapi(T dependency, Action<T> configure)Adds an apidependency to this entity.abstract Dependencyimplementation(Object dependencyNotation)Adds an implementationmodule dependency to this entity.abstract ExternalModuleDependencyimplementation(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)Adds an implementationmodule dependency to this entity.ExternalModuleDependencyimplementation(String dependencyNotation, Action<ExternalModuleDependency> configure)Adds an implementationmodule dependency to this entity.abstract <T extends Dependency> Timplementation(T dependency, Function1<T, Unit> configure)Adds an implementationdependency to this entity.<T extends Dependency> Timplementation(T dependency, Action<T> configure)Adds an implementationdependency to this entity.abstract DependencycompileOnly(Object dependencyNotation)Adds a compileOnlymodule dependency to this entity.abstract ExternalModuleDependencycompileOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)Adds a compileOnlymodule dependency to this entity.ExternalModuleDependencycompileOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)Adds a compileOnlymodule dependency to this entity.abstract <T extends Dependency> TcompileOnly(T dependency, Function1<T, Unit> configure)Adds a compileOnlydependency to this entity.<T extends Dependency> TcompileOnly(T dependency, Action<T> configure)Adds a compileOnlydependency to this entity.abstract DependencyruntimeOnly(Object dependencyNotation)Adds a runtimeOnlymodule dependency to this entity.abstract ExternalModuleDependencyruntimeOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)Adds a runtimeOnlymodule dependency to this entity.ExternalModuleDependencyruntimeOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)Adds a runtimeOnlymodule dependency to this entity.abstract <T extends Dependency> TruntimeOnly(T dependency, Function1<T, Unit> configure)Adds a runtimeOnlydependency to this entity.<T extends Dependency> TruntimeOnly(T dependency, Action<T> configure)Adds a runtimeOnlydependency to this entity.ExternalModuleDependencykotlin(String simpleModuleName)Creates a dependency to an official Kotlin library with the same version that is configured in KotlinTopLevelExtensionConfig.coreLibrariesVersion. abstract ExternalModuleDependencykotlin(String simpleModuleName, String version)Creates a dependency to an official Kotlin library. ProjectDependencyproject(String path, String configuration)Creates a Gradle project dependency. abstract ProjectDependencyproject(Map<String, Object> notation)Creates a Gradle project dependency. abstract Dependencynpm(String name, String version)Creates a dependency on the NPM module. abstract Dependencynpm(String name, File directory)Creates a dependency on the NPM module. abstract Dependencynpm(File directory)Creates a dependency on the NPM module. abstract DependencydevNpm(String name, String version)Creates a dependency to a NPM module that is added to devDependencies. abstract DependencydevNpm(String name, File directory)Creates a dependency to a NPM module that is added to devDependencies. abstract DependencydevNpm(File directory)Creates a dependency to a NPM module that is added to devDependencies. abstract DependencyoptionalNpm(String name, String version)Creates a dependency to a NPM module that is added to optionalDependencies. abstract DependencyoptionalNpm(String name, File directory)Creates a dependency to a NPM module that is added to optionalDependencies. abstract DependencyoptionalNpm(File directory)Creates a dependency to a NPM module that is added to optionalDependencies. abstract DependencypeerNpm(String name, String version)Creates a dependency to a NPM module that is added to peerDependencies. -
-
Method Detail
-
api
abstract Dependency api(Object dependencyNotation)
Adds an
apimodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
api
abstract ExternalModuleDependency api(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds an
apimodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- Additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
api
ExternalModuleDependency api(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds an
apimodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- Additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
api
abstract <T extends Dependency> T api(T dependency, Function1<T, Unit> configure)
Adds an
apidependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
api
<T extends Dependency> T api(T dependency, Action<T> configure)
Adds an
apidependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
implementation
abstract Dependency implementation(Object dependencyNotation)
Adds an
implementationmodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
implementation
abstract ExternalModuleDependency implementation(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds an
implementationmodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- Additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
implementation
ExternalModuleDependency implementation(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds an
implementationmodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
implementation
abstract <T extends Dependency> T implementation(T dependency, Function1<T, Unit> configure)
Adds an
implementationdependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
implementation
<T extends Dependency> T implementation(T dependency, Action<T> configure)
Adds an
implementationdependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
compileOnly
abstract Dependency compileOnly(Object dependencyNotation)
Adds a
compileOnlymodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
compileOnly
abstract ExternalModuleDependency compileOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds a
compileOnlymodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- Additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
compileOnly
ExternalModuleDependency compileOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds a
compileOnlymodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- Additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
compileOnly
abstract <T extends Dependency> T compileOnly(T dependency, Function1<T, Unit> configure)
Adds a
compileOnlydependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
compileOnly
<T extends Dependency> T compileOnly(T dependency, Action<T> configure)
Adds a
compileOnlydependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
runtimeOnly
abstract Dependency runtimeOnly(Object dependencyNotation)
Adds a
runtimeOnlymodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
runtimeOnly
abstract ExternalModuleDependency runtimeOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds a
runtimeOnlymodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- Additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
runtimeOnly
ExternalModuleDependency runtimeOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds a
runtimeOnlymodule dependency to this entity.- Parameters:
dependencyNotation- The module dependency notation, as per DependencyHandler.create.configure- Additional configuration for the created module dependency.- Returns:
The module dependency, or
nullif dependencyNotation is a provider.
-
runtimeOnly
abstract <T extends Dependency> T runtimeOnly(T dependency, Function1<T, Unit> configure)
Adds a
runtimeOnlydependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
runtimeOnly
<T extends Dependency> T runtimeOnly(T dependency, Action<T> configure)
Adds a
runtimeOnlydependency to this entity.- Parameters:
dependency- The dependency to add.configure- Additional configuration for the dependency.- Returns:
The added dependency.
-
kotlin
ExternalModuleDependency kotlin(String simpleModuleName)
Creates a dependency to an official Kotlin library with the same version that is configured in KotlinTopLevelExtensionConfig.coreLibrariesVersion.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jvmMain"].dependencies { implementation(kotlin("stdlib")) }The official Kotlin dependencies are always part of the "org.jetbrains.kotlin" group and the module name always has prefix: "kotlin-".
- Parameters:
simpleModuleName- The Kotlin module name that follows after the "kotlin-" prefix.
-
kotlin
abstract ExternalModuleDependency kotlin(String simpleModuleName, String version)
Creates a dependency to an official Kotlin library.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jvmMain"].dependencies { implementation(kotlin("stdlib", "2.0.0")) }The official Kotlin dependencies are always part of the "org.jetbrains.kotlin" group and the module name always has prefix: "kotlin-".
- Parameters:
simpleModuleName- The Kotlin module name followedthat follows after the "kotlin-" prefix.version- dependency version ornullto use the version defined in KotlinTopLevelExtensionConfig.coreLibrariesVersion.
-
project
ProjectDependency project(String path, String configuration)
Creates a Gradle project dependency.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jvmMain"].dependencies { implementation(project(":my-library", "customLibraryConfiguration")) }- Parameters:
path- The project pathconfiguration- The optional target configuration in the project
-
project
abstract ProjectDependency project(Map<String, Object> notation)
Creates a Gradle project dependency.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jvmMain"].dependencies { implementation(project(mapOf("path" to ":project-a", "configuration" to "someOtherConfiguration"))) }- Parameters:
notation- Project notation described in DependencyHandler.
-
npm
abstract Dependency npm(String name, String version)
Creates a dependency on the NPM module.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(npm("is-odd-even", "1.0.0")) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
name- The NPM dependency nameversion- The NPM dependency version
-
npm
abstract Dependency npm(String name, File directory)
Creates a dependency on the NPM module.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(npm("is-odd-even", project.file("npm/is-odd-even"))) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
name- The NPM dependency namedirectory- The directory where dependency files are located (See NPM directory keyword)
-
npm
abstract Dependency npm(File directory)
Creates a dependency on the NPM module. The name of the dependency is derived either from the
package.jsonfile located in the directory or the directory name itself.Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(npm(project.file("npm/is-odd-even"))) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
directory- The directory where dependency files are located (See NPM directory keyword)
-
devNpm
abstract Dependency devNpm(String name, String version)
Creates a dependency to a NPM module that is added to devDependencies.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(devNpm("is-odd-even", "1.1.0")) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
name- The NPM dependency nameversion- The NPM dependency version
-
devNpm
abstract Dependency devNpm(String name, File directory)
Creates a dependency to a NPM module that is added to devDependencies.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(devNpm("is-odd-even", project.file("npm/is-odd-even"))) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
name- The NPM dependency namedirectory- The directory where dependency files are located (See NPM directory keyword)
-
devNpm
abstract Dependency devNpm(File directory)
Creates a dependency to a NPM module that is added to devDependencies. The name of the dependency is derived either from the
package.jsonfile located in the directory or the directory name itself.Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(devNpm(project.file("npm/is-odd-even"))) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
directory- The directory where dependency files are located (See NPM directory keyword)
-
optionalNpm
abstract Dependency optionalNpm(String name, String version)
Creates a dependency to a NPM module that is added to optionalDependencies.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(optionalNpm("is-odd-even", "1.0.0")) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
name- The NPM dependency nameversion- The NPM dependency version
-
optionalNpm
abstract Dependency optionalNpm(String name, File directory)
Creates a dependency to a NPM module that is added to optionalDependencies.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(optionalNpm("is-odd-even", project.file("npm/is-odd-even"))) }Note: Only relevant for Kotlin entities targeting only KotlinPlatformType.js or KotlinPlatformType.wasm!
- Parameters:
name- The NPM dependency namedirectory- The directory where dependency files are located (See NPM directory keyword)
-
optionalNpm
abstract Dependency optionalNpm(File directory)
Creates a dependency to a NPM module that is added to optionalDependencies. The name of the dependency is derived either from the
package.jsonfile located in the directory or the directory name itself.Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(optionalNpm(project.file("npm/is-odd-even"))) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
directory- The directory where dependency files are located (See NPM directory keyword)
-
peerNpm
abstract Dependency peerNpm(String name, String version)
Creates a dependency to a NPM module that is added to peerDependencies.
Note: The created dependency should be manually added to this entity using other methods from this DSL:
kotlin.sourceSets["jsMain"].dependencies { implementation(peerNpm("is-odd-even", "1.0.0")) }This is only relevant for Kotlin entities that target only KotlinPlatformType.js or KotlinPlatformType.wasm.
- Parameters:
name- The NPM dependency nameversion- The NPM dependency version
-
-
-
-