All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.javiersc.hubdle.project.extensions.apis.HubdleMinimalSourceSetConfigurableExtension.kt Maven / Gradle / Ivy

There is a newer version: 0.7.18
Show newest version
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
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy