Add Jabel to compile for java 8 but using newer features, fix the ClickBox colors and update gradle

This commit is contained in:
Username404-59 2021-05-15 12:49:00 +02:00
parent ce9f1c83dd
commit 4805e81dbe
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
4 changed files with 12 additions and 6 deletions

View File

@ -87,7 +87,7 @@ subprojects {
}
}
val javaVer: String = "11"
val javaVer: String = "8"
val kotlinVer = rootProject.property("kotlin_stdlib_version").toString() + ".0"
val mcBase: String = rootProject.architectury.minecraft.dropLast(2)
allprojects {
@ -103,9 +103,13 @@ allprojects {
**/
apply(plugin = "java")
apply(plugin = "architectury-plugin")
java {
sourceCompatibility = JavaVersion.VERSION_11
}
dependencies {
implementation(kotlin("stdlib-jdk8", kotlinVer))
implementation(kotlin("reflect", kotlinVer))
annotationProcessor("com.github.bsideup.jabel:jabel-javac-plugin:0.3.0")
}
tasks {
withType(ShadowJar::class) {
@ -126,7 +130,7 @@ allprojects {
withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
with(kotlinOptions) {
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xlambdas=indy")
jvmTarget = javaVer
jvmTarget = if (javaVer.toInt() < 10) "1.$javaVer" else javaVer
languageVersion = "1.5"
apiVersion = rootProject.property("kotlin_stdlib_version").toString()
}
@ -134,7 +138,9 @@ allprojects {
withType(JavaCompile::class) {
with(options) {
encoding = "UTF-8"
release.set(javaVer.toInt()); isFork = true
isFork = true
// The following lines are required for Jabel:
compilerArgs.addAll(listOf("-Xplugin:jabel", "--release", javaVer))
}
}
withType(net.fabricmc.loom.task.RemapJarTask::class) {

View File

@ -20,5 +20,5 @@ annotation class ButtonInfo(
}; enum class Category(val translationKey: String, val categoryColor: Colors) {
MISC("snowy.clickbox.misc", Colors.BLUE),
RISKY("snowy.clickbox.risky", Colors.RED);
init { ClickGui.components.add(ClickBox(y = 0.0, name = TranslatableComponent(translationKey))) }
init { ClickGui.components.add(ClickBox(y = 0.0, name = TranslatableComponent(translationKey), color = categoryColor)) }
}

View File

@ -1,7 +1,7 @@
{
"required": true,
"package": "fr.username404.snowygui.mixins",
"compatibilityLevel": "JAVA_11",
"compatibilityLevel": "JAVA_8",
"client": [
"KeysAccessor",
"KeyMappings",

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists