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

app.cash.exhaustive.gradle.ExhaustivePlugin.kt Maven / Gradle / Ivy

The newest version!
package app.cash.exhaustive.gradle

import org.gradle.api.provider.Provider
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilerPluginSupportPlugin
import org.jetbrains.kotlin.gradle.plugin.SubpluginArtifact
import org.jetbrains.kotlin.gradle.plugin.SubpluginOption

class ExhaustivePlugin : KotlinCompilerPluginSupportPlugin {
  override fun getCompilerPluginId() = "app.cash.exhaustive"

  override fun getPluginArtifact() = SubpluginArtifact(
    "app.cash.exhaustive",
    "exhaustive-compiler",
    exhaustiveVersion
  )

  override fun isApplicable(kotlinCompilation: KotlinCompilation<*>): Boolean {
    return kotlinCompilation.target.project.plugins.hasPlugin(ExhaustivePlugin::class.java)
  }

  override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider> {
    kotlinCompilation.dependencies {
      compileOnly("app.cash.exhaustive:exhaustive-annotation:$exhaustiveVersion")
    }
    return kotlinCompilation.target.project.provider { emptyList() }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy