com.javiersc.hubdle.project.extensions.apis.HubdleMinimalSourceSetConfigurableExtension.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hubdle-gradle-plugin Show documentation
Show all versions of hubdle-gradle-plugin Show documentation
Single entry point to configurate any kind of project
package com.javiersc.hubdle.project.extensions.apis
import com.javiersc.hubdle.project.extensions.HubdleDslMarker
import com.javiersc.kotlin.stdlib.capitalize
import org.gradle.api.Action
import org.gradle.api.NamedDomainObjectProvider
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
public abstract class HubdleMinimalSourceSetConfigurableExtension(project: Project) :
HubdleConfigurableExtension(project) {
override val project: Project
get() = super.project
internal open val targetName: String? = null
public abstract val main: NamedDomainObjectProvider
@HubdleDslMarker
public fun main(action: Action) {
lazyConfigurable { main.configure(action) }
}
public abstract val test: NamedDomainObjectProvider
@HubdleDslMarker
public fun test(action: Action) {
lazyConfigurable { test.configure(action) }
}
@HubdleDslMarker
public fun sourceSet(name: String, action: Action) {
lazyConfigurable {
configure { sourceSets.named(name, action::execute) }
}
}
internal fun calculateName(name: String): String =
if (targetName != null) "${targetName}${name.capitalize()}" else name
}