app.softwork.kobol.gradle.KobolTask.kt Maven / Gradle / Ivy
package app.softwork.kobol.gradle
import org.gradle.api.*
import org.gradle.api.file.*
import org.gradle.api.provider.*
import org.gradle.api.tasks.*
import org.gradle.workers.*
import javax.inject.*
@CacheableTask
public abstract class KobolTask : DefaultTask() {
init {
group = "kobol"
}
@get:InputFiles
@get:SkipWhenEmpty
@get:IgnoreEmptyDirectories
@get:PathSensitive(PathSensitivity.RELATIVE)
public abstract val sources: ConfigurableFileCollection
@get:OutputDirectory
public abstract val outputFolder: DirectoryProperty
@get:Optional
@get:OutputDirectory
public abstract val sqlFolder: DirectoryProperty
@get:InputFiles
@get:Classpath
internal abstract val classpath: ConfigurableFileCollection
@get:Input
public abstract val pluginConfiguration: MapProperty>
@get:Inject
internal abstract val workerExecutor: WorkerExecutor
@TaskAction
internal fun generate() {
workerExecutor.classLoaderIsolation {
classpath.from([email protected])
}.submit(ExecuteKobol::class.java) {
inputFiles.setFrom(sources)
outputFolder.set([email protected])
sqlFolder.set([email protected])
config.set(pluginConfiguration)
}
}
}