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

org.danilopianini.kotlinqa.KotlinQAExtension.kt Maven / Gradle / Ivy

Go to download

Automated Quality Assurance configuration for Kotlin Projects built with Gradle

There is a newer version: 0.73.0
Show newest version
package org.danilopianini.kotlinqa

import java.io.File
import org.gradle.api.Project
import org.gradle.api.provider.Property
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.property

/**
 * Gradle extension for the Kotlin QA Plugin.
 */
open class KotlinQAExtension(project: Project) {

    /**
     * The folder where the Detekt configuration will be generated.
     */
    val workingDirectory: Property = project.objects.property().apply {
        set(project.layout.buildDirectory.asFile.map { File(it, "kotlinqa") })
    }

    /**
     * The name of the generated Detekt configuration file.
     */
    val detektConfigurationFileName: Property = project.objects.property().apply {
        set("detekt.yml")
    }

    /**
     * The generated Detekt configuration file. Read only, use [workingDirectory] and [detektConfigurationFileName]
     * to change the value of this property.
     */
    val detektConfigurationFile: Provider = workingDirectory.flatMap { workDir ->
        detektConfigurationFileName.map { fileName ->
            project.file("${workDir.absolutePath}${slash}$fileName")
        }
    }

    private companion object {
        private val slash: String = File.separator
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy