Fix @Input

This commit is contained in:
shedaniel
2021-01-27 09:17:45 +08:00
parent f20c27a2c8
commit 1ab03ecdea
2 changed files with 11 additions and 1 deletions

View File

@@ -73,6 +73,7 @@ jar {
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = ['-Xjvm-default=compatibility']
}
}

View File

@@ -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<Transformer>()
@@ -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()