Interface KotlinDependencyHandler

    • Constructor Detail

    • Method Detail

      • 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 <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 <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 <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 or null 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 path
        configuration - 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 name
        version - 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 name
        directory - 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 name
        version - 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 name
        directory - 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 name
        version - 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 name
        directory - 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 name
        version - The NPM dependency version