Scripts/lom/src/main/kotlin/io/gitlab/jfronny/scripts/LomExtension.kt
JFronny b427d9e1ab
All checks were successful
ci/woodpecker/push/gradle Pipeline was successful
ci/woodpecker/push/pages Pipeline was successful
fix: compare loaderKind values
2024-03-21 13:26:56 +01:00

36 lines
999 B
Kotlin

package io.gitlab.jfronny.scripts
import org.gradle.api.Project
import org.gradle.api.provider.Property
import java.util.*
interface LomExtension {
val loaderKind: Property<LoaderKind>
val minecraftVersion: Property<String>
val loaderVersion: Property<String>
val yarnBuild: Property<String>
fun yarn(yarnBuild: String) {
this.yarnBuild.set(Objects.requireNonNull(yarnBuild))
}
fun mojmap() {
yarnBuild.set(null)
}
fun check(proj: Project) {
yarnBuild.finalizeValue()
minecraftVersion.finalizeValue()
loaderVersion.finalizeValue()
loaderKind.finalizeValue()
}
fun copyFrom(ext: LomExtension) {
if (loaderKind.get() != ext.loaderKind.get()) {
throw IllegalArgumentException("Cannot copy from a config meant for a different loader")
}
yarnBuild.set(ext.yarnBuild)
minecraftVersion.set(ext.minecraftVersion)
loaderVersion.set(ext.loaderVersion)
}
}