From ef45e5b7fd45db4ffe52537ce4f911443b791944 Mon Sep 17 00:00:00 2001 From: Licious17 Date: Wed, 15 Sep 2021 15:24:49 +0100 Subject: [PATCH] Updated to Kotlin 1.5.30, Annotations 22.0.0 and Coroutines 1.5.2 --- build.gradle | 86 -------------- build.gradle.kts | 106 ++++++++++++++++++ gradle.properties | 18 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../net/shadowfacts/forgelin/Forgelin.kt | 2 +- src/main/resources/mcmod.info | 10 +- 6 files changed, 124 insertions(+), 100 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 07b3fd9..0000000 --- a/build.gradle +++ /dev/null @@ -1,86 +0,0 @@ -buildscript { - repositories { - maven { url = 'https://files.minecraftforge.net/maven' } - jcenter() - mavenCentral() - } - dependencies { - classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.+', changing: true - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}" - } -} - -plugins { - id "maven" - id "com.github.johnrengelman.shadow" version "5.2.0" -} - -apply plugin: "kotlin" -apply plugin: 'net.minecraftforge.gradle' - -version = mod_version - -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 - -minecraft { - mappings channel: 'stable', version: '39-1.12' -} - -sourceSets.main.resources { srcDir 'src/generated/resources' } - -repositories { - jcenter() - mavenCentral() -} - -dependencies { - minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2855' - compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlin_version - compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk7", version: kotlin_version - compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jdk8", version: kotlin_version - compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlin_version - compile group: "org.jetbrains", name: "annotations", version: annotations_version - compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-core", version: coroutines_version - compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-jdk8", version: coroutines_version -} - -jar { - manifest { - attributes "FMLCorePlugin": "net.shadowfacts.forgelin.preloader.ForgelinPlugin", - "FMLCorePluginContainsFMLMod": "true" - } -} - -shadowJar { - classifier = "" - dependencies { - include(dependency("org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}")) - include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}")) - include(dependency("org.jetbrains.kotlin:kotlin-stdlib-jdk8:${kotlin_version}")) - include(dependency("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}")) - include(dependency("org.jetbrains:annotations:${annotations_version}")) - include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutines_version}")) - include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${coroutines_version}")) - } - manifest { - attributes "FMLCorePlugin": "net.shadowfacts.forgelin.preloader.ForgelinPlugin", - "FMLCorePluginContainsFMLMod": "true" - } -} - -tasks.build.dependsOn shadowJar - -artifacts { - archives shadowJar -} - -reobf { - shadowJar { - } -} - -tasks.reobfShadowJar.mustRunAfter shadowJar -tasks.build.dependsOn reobfShadowJar - -jar.finalizedBy('reobfJar') \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..9261623 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,106 @@ +import net.minecraftforge.gradle.userdev.UserDevExtension + +val modName: String by ext.properties +val modGroup: String by ext.properties +val modVersion: String by ext.properties +val mcVersion: String by ext.properties +val mcpChannel: String by ext.properties +val mcpVersion: String by ext.properties +val forgeVersion: String by ext.properties +val repositoryLink: String by ext.properties +val kotlinVersion: String by ext.properties +val annotationsVersion: String by ext.properties +val coroutinesVersion: String by ext.properties +val modDescription: String = "Kotlin helper library for Minecraft Forge." + +buildscript { + repositories { + mavenCentral() + maven(url = "https://maven.minecraftforge.net/") + } + dependencies { + classpath("net.minecraftforge.gradle:ForgeGradle:5.1.+") { + isChanging = true + } + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30") + } +} + +plugins { + java + kotlin("jvm") version "1.5.30" + id("net.kyori.blossom") version "1.3.0" + id("com.github.johnrengelman.shadow") version "7.0.0" +} + +apply(plugin = "net.minecraftforge.gradle") + +version = modVersion +group = modGroup + +java.sourceCompatibility = JavaVersion.VERSION_1_8 +java.targetCompatibility = JavaVersion.VERSION_1_8 + +configure { + + mappings(mcpChannel, mcpVersion) + +} + +repositories { + mavenCentral() +} + +val minecraft by configurations + +dependencies { + minecraft("net.minecraftforge:forge:$forgeVersion") + shadow("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion") + shadow("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion") + shadow("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion") + shadow("org.jetbrains:annotations:$annotationsVersion") + shadow("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion") + shadow("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$coroutinesVersion") +} + +blossom { + replaceTokenIn("src/main/kotlin/net/shadowfacts/forgelin/Forgelin.kt") + replaceToken("@version@", modVersion) +} + +tasks { + + shadowJar { + archiveBaseName.set(modName) + archiveClassifier.set("") + archiveVersion.set(modVersion) + configurations = listOf(project.configurations.shadow.get()) + + exclude("module-info.class", "META-INF/maven/**", "META-INF/proguard/**", "META-INF/versions/**") + + finalizedBy("reobfJar") + } + + artifacts { + archives(shadowJar) + shadow(shadowJar) + } + + processResources { + filesMatching("mcmod.info") { + expand( + "version" to modVersion, + "mcversion" to mcVersion, + "modname" to modName, + "modid" to modName.toLowerCase(), + "modname" to modName, + "link" to repositoryLink, + "description" to modDescription, + "authorList" to arrayOf("shadowfacts", "Licious" ) + ) + } + } + + + +} diff --git a/gradle.properties b/gradle.properties index b8e1c9a..f064c55 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,7 +1,11 @@ -mod_version = 1.9.0 -group = net.shadowfacts -archivesBaseName = Forgelin - -kotlin_version = 1.5.21 -annotations_version = 21.0.1 -coroutines_version = 1.5.0 +modGroup=net.shadowfacts +modVersion=1.9.1 +modName=Forgelin +mcVersion=1.12.2 +mcpChannel=stable +mcpVersion=39-1.12 +repositoryLink=https://github.com/Licious17/Forgelin +forgeVersion=1.12.2-14.23.5.2855 +kotlinVersion = 1.5.30 +annotationsVersion = 22.0.0 +coroutinesVersion = 1.5.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5dc530c..2f5e197 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip diff --git a/src/main/kotlin/net/shadowfacts/forgelin/Forgelin.kt b/src/main/kotlin/net/shadowfacts/forgelin/Forgelin.kt index 8b64de2..220dfc0 100644 --- a/src/main/kotlin/net/shadowfacts/forgelin/Forgelin.kt +++ b/src/main/kotlin/net/shadowfacts/forgelin/Forgelin.kt @@ -14,7 +14,7 @@ object Forgelin { const val MOD_ID = "forgelin" const val NAME = "Forgelin" - const val VERSION = "1.9.0" + const val VERSION = "@version@" @EventHandler fun onPreInit(event: FMLPreInitializationEvent) { diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 804751d..f856faa 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,14 +1,14 @@ [ { - "modid": "forgelin", - "name": "Shadowfacts' Forgelin", + "modid": "$modid", + "name": "$modname", "version": "$version", "mcversion": "$mcversion", - "description": "Kotlin helper library for Forge.", + "description": "$description", "credits": "Emberwalker, for the original Forgelin", - "url": "https://github.com/shadowfacts/Forgelin", + "url": "$link", "updateUrl": "", - "authorList": [ "shadowfacts" ], + "authorList": "$authorList", "screenshots": [] } ] \ No newline at end of file