Update kotlin & kotlinx-datetime and make the constructor parameters of Macro.kt variables instead of values

This commit is contained in:
Username404 2021-05-27 18:45:26 +02:00
parent 5609e7d224
commit 6f5817389d
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
4 changed files with 14 additions and 12 deletions

View File

@ -10,7 +10,7 @@ buildscript {
} }
plugins { plugins {
kotlin("jvm") version "1.5.0" kotlin("jvm") version "1.5.20-M1"
id("com.github.johnrengelman.shadow") version "7.0.0" apply false id("com.github.johnrengelman.shadow") version "7.0.0" apply false
id("architectury-plugin") version "[3.0.100, 3.3[" id("architectury-plugin") version "[3.0.100, 3.3["
id("dev.architectury.loom") version "0.7.2.110" apply false id("dev.architectury.loom") version "0.7.2.110" apply false
@ -27,7 +27,12 @@ architectury {
minecraft = rootProject.property("minecraft") as String minecraft = rootProject.property("minecraft") as String
} }
val javaVer: String = "8"
val kotlinVer: String by rootProject
val kotlinBaseVer = kotlinVer.substring(0..2)
val mcBase: String = rootProject.architectury.minecraft.dropLast(2)
val kotlinX: String = "org.jetbrains.kotlinx" val kotlinX: String = "org.jetbrains.kotlinx"
subprojects { subprojects {
group = rootProject.group.toString() group = rootProject.group.toString()
lateinit var mappingsDep: Dependency lateinit var mappingsDep: Dependency
@ -42,9 +47,9 @@ subprojects {
val shadowC by configurations.creating val shadowC by configurations.creating
repositories { maven(url = "https://jitpack.io"); mavenCentral() } repositories { maven(url = "https://jitpack.io"); mavenCentral() }
dependencies { dependencies {
implementation("$kotlinX:kotlinx-coroutines-core:1.5.0-RC") implementation("$kotlinX:kotlinx-coroutines-core:$kotlinBaseVer.0-RC")
listOf( listOf(
"$kotlinX:kotlinx-datetime:0.2.0", "$kotlinX:kotlinx-datetime:0.2.1",
"com.typesafe:config:1.4.1", "com.typesafe:config:1.4.1",
"io.github.config4k:config4k:0.4.2", "io.github.config4k:config4k:0.4.2",
"org.jetbrains:annotations:20.1.0" "org.jetbrains:annotations:20.1.0"
@ -130,9 +135,6 @@ subprojects {
} }
} }
val javaVer: String = "8"
val kotlinVer = rootProject.property("kotlin_stdlib_version").toString() + ".0"
val mcBase: String = rootProject.architectury.minecraft.dropLast(2)
allprojects { allprojects {
/** configurations.all { /** configurations.all {
resolutionStrategy { resolutionStrategy {
@ -166,7 +168,7 @@ allprojects {
freeCompilerArgs = listOf("-Xjvm-default=all", "-Xlambdas=indy") freeCompilerArgs = listOf("-Xjvm-default=all", "-Xlambdas=indy")
jvmTarget = if (javaVer.toInt() < 10) "1.$javaVer" else javaVer jvmTarget = if (javaVer.toInt() < 10) "1.$javaVer" else javaVer
languageVersion = "1.5" languageVersion = "1.5"
apiVersion = rootProject.property("kotlin_stdlib_version").toString() apiVersion = kotlinBaseVer
} }
} }
withType(JavaCompile::class) { withType(JavaCompile::class) {

View File

@ -7,8 +7,8 @@ import fr.username404.snowygui.gui.feature.ButtonInfo.Companion.Type
@Ignored @Ignored
@ButtonInfo(Category.MACROS, kind = Type.CLICK) @ButtonInfo(Category.MACROS, kind = Type.CLICK)
data class Macro( data class Macro(
@Expose @JvmField private val command: String, @Expose @JvmField var command: String,
@Expose override val title: String = command @Expose override var title: String = command
): ButtonImpl() { ): ButtonImpl() {
override fun execAction() = Minecraft.getInstance().player!!.chat("/$command") override fun execAction() = Minecraft.getInstance().player!!.chat("/$command")
} }

View File

@ -6,7 +6,7 @@ repositories {
val serializationVer: String by rootProject val serializationVer: String by rootProject
dependencies { dependencies {
forge("net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.property("forge_version")}.+") forge("net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.property("forge_version")}.+")
implementation("thedarkcolour:kotlinforforge:${rootProject.property("kotlinforforge")}.0") implementation("thedarkcolour:kotlinforforge:${rootProject.property("kotlinforforge")}")
implementation(project(path = ":common")) { isTransitive = false } implementation(project(path = ":common")) { isTransitive = false }
add("developmentForge", project(path = ":common")) { isTransitive = false } add("developmentForge", project(path = ":common")) { isTransitive = false }
shadowC("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVer") { isTransitive = false } // Needed for kotlinx-datetime shadowC("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVer") { isTransitive = false } // Needed for kotlinx-datetime

View File

@ -9,8 +9,8 @@ org.gradle.vfs.watch=true
minecraft=1.16.5 minecraft=1.16.5
forge_version=36.1 forge_version=36.1
kotlinforforge=1.12 kotlinforforge=1.12.0
kotlin_stdlib_version=1.5 kotlinVer=1.5.0
serializationVer=1.2.1 serializationVer=1.2.1
fabric_loader_version=0.11.3 fabric_loader_version=0.11.3
fabric_language_kotlin=1.6.0+kotlin.1.5.0 fabric_language_kotlin=1.6.0+kotlin.1.5.0