org.jetbrains.kotlin.gradle.plugin.mpp.KotlinDependencyConfigurationsHolder.kt Maven / Gradle / Ivy
/*
* Copyright 2010-2022 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.mpp
import org.gradle.api.Action
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.plugin.HasKotlinDependencies
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.utils.*
import javax.inject.Inject
internal abstract class KotlinDependencyConfigurationsHolder @Inject constructor(
val project: Project,
private val configurationNamesPrefix: String?,
) : HasKotlinDependencies {
override val apiConfigurationName: String
get() = lowerCamelCaseName(configurationNamesPrefix, API)
override val implementationConfigurationName: String
get() = lowerCamelCaseName(configurationNamesPrefix, IMPLEMENTATION)
override val compileOnlyConfigurationName: String
get() = lowerCamelCaseName(configurationNamesPrefix, COMPILE_ONLY)
override val runtimeOnlyConfigurationName: String
get() = lowerCamelCaseName(configurationNamesPrefix, RUNTIME_ONLY)
override fun dependencies(configure: KotlinDependencyHandler.() -> Unit): Unit =
DefaultKotlinDependencyHandler(this, project).run(configure)
override fun dependencies(configure: Action) =
dependencies { configure.execute(this) }
}