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 Dependency
api(Object dependencyNotation)
Adds an api
module dependency to this entity.abstract ExternalModuleDependency
api(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds an api
module dependency to this entity.ExternalModuleDependency
api(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds an api
module dependency to this entity.abstract <T extends Dependency> T
api(T dependency, Function1<T, Unit> configure)
Adds an api
dependency to this entity.<T extends Dependency> T
api(T dependency, Action<T> configure)
Adds an api
dependency to this entity.abstract Dependency
implementation(Object dependencyNotation)
Adds an implementation
module dependency to this entity.abstract ExternalModuleDependency
implementation(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds an implementation
module dependency to this entity.ExternalModuleDependency
implementation(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds an implementation
module dependency to this entity.abstract <T extends Dependency> T
implementation(T dependency, Function1<T, Unit> configure)
Adds an implementation
dependency to this entity.<T extends Dependency> T
implementation(T dependency, Action<T> configure)
Adds an implementation
dependency to this entity.abstract Dependency
compileOnly(Object dependencyNotation)
Adds a compileOnly
module dependency to this entity.abstract ExternalModuleDependency
compileOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds a compileOnly
module dependency to this entity.ExternalModuleDependency
compileOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds a compileOnly
module dependency to this entity.abstract <T extends Dependency> T
compileOnly(T dependency, Function1<T, Unit> configure)
Adds a compileOnly
dependency to this entity.<T extends Dependency> T
compileOnly(T dependency, Action<T> configure)
Adds a compileOnly
dependency to this entity.abstract Dependency
runtimeOnly(Object dependencyNotation)
Adds a runtimeOnly
module dependency to this entity.abstract ExternalModuleDependency
runtimeOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds a runtimeOnly
module dependency to this entity.ExternalModuleDependency
runtimeOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds a runtimeOnly
module dependency to this entity.abstract <T extends Dependency> T
runtimeOnly(T dependency, Function1<T, Unit> configure)
Adds a runtimeOnly
dependency to this entity.<T extends Dependency> T
runtimeOnly(T dependency, Action<T> configure)
Adds a runtimeOnly
dependency to this entity.ExternalModuleDependency
kotlin(String simpleModuleName)
Creates a dependency to an official Kotlin library with the same version that is configured in KotlinTopLevelExtensionConfig.coreLibrariesVersion. abstract ExternalModuleDependency
kotlin(String simpleModuleName, String version)
Creates a dependency to an official Kotlin library. ProjectDependency
project(String path, String configuration)
Creates a Gradle project dependency. abstract ProjectDependency
project(Map<String, Object> notation)
Creates a Gradle project dependency. abstract Dependency
npm(String name, String version)
Creates a dependency on the NPM module. abstract Dependency
npm(String name, File directory)
Creates a dependency on the NPM module. abstract Dependency
npm(File directory)
Creates a dependency on the NPM module. abstract Dependency
devNpm(String name, String version)
Creates a dependency to a NPM module that is added to devDependencies. abstract Dependency
devNpm(String name, File directory)
Creates a dependency to a NPM module that is added to devDependencies. abstract Dependency
devNpm(File directory)
Creates a dependency to a NPM module that is added to devDependencies. abstract Dependency
optionalNpm(String name, String version)
Creates a dependency to a NPM module that is added to optionalDependencies. abstract Dependency
optionalNpm(String name, File directory)
Creates a dependency to a NPM module that is added to optionalDependencies. abstract Dependency
optionalNpm(File directory)
Creates a dependency to a NPM module that is added to optionalDependencies. abstract Dependency
peerNpm(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
api
module dependency to this entity.- Parameters:
dependencyNotation
- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
null
if dependencyNotation is a provider.
-
api
abstract ExternalModuleDependency api(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds an
api
module 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
null
if dependencyNotation is a provider.
-
api
ExternalModuleDependency api(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds an
api
module 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
null
if dependencyNotation is a provider.
-
api
abstract <T extends Dependency> T api(T dependency, Function1<T, Unit> configure)
Adds an
api
dependency 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
api
dependency 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
implementation
module dependency to this entity.- Parameters:
dependencyNotation
- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
null
if dependencyNotation is a provider.
-
implementation
abstract ExternalModuleDependency implementation(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds an
implementation
module 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
null
if dependencyNotation is a provider.
-
implementation
ExternalModuleDependency implementation(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds an
implementation
module 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
null
if dependencyNotation is a provider.
-
implementation
abstract <T extends Dependency> T implementation(T dependency, Function1<T, Unit> configure)
Adds an
implementation
dependency 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
implementation
dependency 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
compileOnly
module dependency to this entity.- Parameters:
dependencyNotation
- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
null
if dependencyNotation is a provider.
-
compileOnly
abstract ExternalModuleDependency compileOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds a
compileOnly
module 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
null
if dependencyNotation is a provider.
-
compileOnly
ExternalModuleDependency compileOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds a
compileOnly
module 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
null
if dependencyNotation is a provider.
-
compileOnly
abstract <T extends Dependency> T compileOnly(T dependency, Function1<T, Unit> configure)
Adds a
compileOnly
dependency 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
compileOnly
dependency 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
runtimeOnly
module dependency to this entity.- Parameters:
dependencyNotation
- The module dependency notation, as per DependencyHandler.create.- Returns:
The module dependency, or
null
if dependencyNotation is a provider.
-
runtimeOnly
abstract ExternalModuleDependency runtimeOnly(String dependencyNotation, Function1<ExternalModuleDependency, Unit> configure)
Adds a
runtimeOnly
module 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
null
if dependencyNotation is a provider.
-
runtimeOnly
ExternalModuleDependency runtimeOnly(String dependencyNotation, Action<ExternalModuleDependency> configure)
Adds a
runtimeOnly
module 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
null
if dependencyNotation is a provider.
-
runtimeOnly
abstract <T extends Dependency> T runtimeOnly(T dependency, Function1<T, Unit> configure)
Adds a
runtimeOnly
dependency 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
runtimeOnly
dependency 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 ornull
to 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.json
file 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.json
file 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.json
file 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
-
-
-
-