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

io.github.tassiluca.scalaextras.ScalaExtrasExtension.kt Maven / Gradle / Ivy

There is a newer version: 2.1.6
Show newest version
package io.github.tassiluca.scalaextras

import org.gradle.api.Project
import org.gradle.api.provider.Property

/**
 * The plugin extension.
 * @param project the project to apply the extension to.
 */
open class ScalaExtrasExtension(private val project: Project) {

    internal val qa = QAExtension()
    internal var options: Set = emptySet()

    /** The set of additional compiler options. */
    fun additionalCompilerOptions(options: Set) {
        this.options = options
    }

    /** DSL entry point for quality assurance configurations. */
    fun qa(apply: QAExtension.() -> Unit) = qa.apply()

    /** The quality assurance extension. */
    inner class QAExtension {
        internal val scalafmtConfiguration = ScalafmtConfiguration(project)
        internal val scalafixConfiguration = ScalafixConfiguration(project)

        /** Whether to treat all warnings as errors. */
        val allWarningsAsErrors: Property = project.objects.property(Boolean::class.java)
            .apply { convention(true) }

        /** DSL entry point for scalafmt configuration. */
        fun scalafmt(apply: ScalafmtConfiguration.() -> Unit) {
            scalafmtConfiguration.apply()
        }

        /** DSL entry point for scalafix configuration. */
        fun scalafix(apply: ScalafixConfiguration.() -> Unit) {
            scalafixConfiguration.apply()
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy