From 1ab03ecdeaf5acd5d0262482ebef08d367d9592d Mon Sep 17 00:00:00 2001 From: shedaniel Date: Wed, 27 Jan 2021 09:17:45 +0800 Subject: [PATCH] Fix @Input --- build.gradle | 1 + .../me/shedaniel/architect/plugin/TransformingTask.kt | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 1d07a40..a7587d5 100644 --- a/build.gradle +++ b/build.gradle @@ -73,6 +73,7 @@ jar { compileKotlin { kotlinOptions { jvmTarget = "1.8" + freeCompilerArgs = ['-Xjvm-default=compatibility'] } } diff --git a/src/main/kotlin/me/shedaniel/architect/plugin/TransformingTask.kt b/src/main/kotlin/me/shedaniel/architect/plugin/TransformingTask.kt index 8500774..e2e7a42 100644 --- a/src/main/kotlin/me/shedaniel/architect/plugin/TransformingTask.kt +++ b/src/main/kotlin/me/shedaniel/architect/plugin/TransformingTask.kt @@ -8,6 +8,8 @@ import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.TaskAction import org.gradle.jvm.tasks.Jar import java.io.File +import java.io.ObjectOutputStream +import java.io.Serializable import java.nio.file.Files import java.nio.file.Path import java.nio.file.StandardCopyOption @@ -20,6 +22,7 @@ import kotlin.time.nanoseconds open class TransformingTask : Jar() { @InputFile val input: RegularFileProperty = GradleSupport.getFileProperty(project) + @Input val transformers = mutableListOf() @@ -107,6 +110,12 @@ fun Project.projectUniqueIdentifier(): String { return "architectury_inject_${name}_$id".filter { Character.isJavaIdentifierPart(it) } } -typealias Transformer = (project: Project, input: Path, output: Path) -> Unit +interface Transformer : Serializable { + operator fun invoke(project: Project, input: Path, output: Path) + + @JvmDefault + fun writeObject(s: ObjectOutputStream) { + } +} object TransformerStepSkipped : Throwable() \ No newline at end of file