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

com.autonomousapps.subplugin.RedundantJvmPlugin.kt Maven / Gradle / Ivy

There is a newer version: 2.0.2
Show newest version
package com.autonomousapps.subplugin

import com.autonomousapps.extension.Behavior
import com.autonomousapps.internal.RedundantSubPluginOutputPaths
import com.autonomousapps.tasks.ComputeAdviceTask
import com.autonomousapps.tasks.DetectRedundantJvmPluginTask
import org.gradle.api.Project
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskProvider
import org.gradle.kotlin.dsl.property
import org.gradle.kotlin.dsl.register

class RedundantJvmPlugin(
  private val project: Project,
  private val computeAdviceTask: TaskProvider,
  private val redundantPluginsBehavior: Provider
) {

  private val outputPaths = RedundantSubPluginOutputPaths(project)
  private val javaSource = project.objects.property().convention(false)
  private val kotlinSource = project.objects.property().convention(false)

  fun configure() {
    val detectRedundantJvmPlugin = project.tasks.register("detectRedundantJvmPlugin") {
      hasJava.set(javaSource)
      hasKotlin.set(kotlinSource)
      redundantPluginsBehavior.set([email protected])
      output.set(outputPaths.pluginJvmAdvicePath)
    }

    computeAdviceTask.configure {
      redundantJvmPluginReport.set(detectRedundantJvmPlugin.flatMap { it.output })
    }
  }

  internal fun withJava(java: Provider) {
    javaSource.set(java)
  }

  internal fun withKotlin(kotlin: Provider) {
    kotlinSource.set(kotlin)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy