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

app.softwork.kobol.gradle.KobolFirPluginTask.kt Maven / Gradle / Ivy

There is a newer version: 0.2.15
Show newest version
package app.softwork.kobol.gradle

import org.gradle.api.*
import org.gradle.api.file.*
import org.gradle.api.tasks.*
import org.gradle.api.tasks.PathSensitivity.*
import org.gradle.kotlin.dsl.dependencies
import org.gradle.workers.*
import javax.inject.*

@CacheableTask
public abstract class KobolFirPluginTask : DefaultTask() {
    init {
        group = "kobol"
    }

    @get:Internal
    internal val pluginConfiguration: String

    @get:Classpath
    internal val pluginClasspath: ConfigurableFileCollection = project.objects.fileCollection()

    init {
        val pluginConfiguration = project.configurations.dependencyScope("${name}Plugin")
        this.pluginConfiguration = pluginConfiguration.name
        project.dependencies {
            pluginConfiguration("app.softwork.kobol:intellij-env:$KOBOL_VERSION")
        }
        pluginClasspath.from(
            project.configurations.resolvable("${name}Classpath") {
                extendsFrom(project.configurations.getByName([email protected]))
            },
        )
    }

    public fun plugin(dependency: Any) {
        project.dependencies.add(pluginConfiguration, dependency)
    }

    @get:InputFiles
    @get:PathSensitive(RELATIVE)
    public abstract val sources: ConfigurableFileCollection

    @get:OutputDirectory
    public abstract val outputFolder: DirectoryProperty

    init {
        outputFolder.convention(project.layout.buildDirectory.dir("reports/kobol/plugins"))
    }

    @get:Inject
    internal abstract val workerExecutor: WorkerExecutor

    @TaskAction
    internal fun generateFlow() {
        workerExecutor.classLoaderIsolation {
            classpath.from(pluginClasspath)
        }.submit(FirKobolAction::class.java) {
            inputFiles.setFrom(sources)
            outputFolder.set([email protected])
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy