diff --git a/build.gradle.kts b/build.gradle.kts index b8c6b9d4b..2cb1755d2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -3,7 +3,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import java.util.Date import java.text.SimpleDateFormat import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream -import java.util.UUID val mod_version: String by project val mc_version: String by project @@ -20,16 +19,14 @@ plugins { `maven-publish` id("net.minecraftforge.gradle") id("org.spongepowered.mixin") - id("org.parchmentmc.librarian.forgegradle") } configurations { - create("library") // non-mod libraries create("klibrary") // kotlin libs - get("implementation").extendsFrom(get("library"), get("klibrary")) + get("implementation").extendsFrom(get("klibrary")) } -data class GitInfo(val version: String, val count: String, val tag: String, val buildNumber: String) { +data class GitInfo(val version: String, val tag: String, val buildNumber: String) { // val tagIsVersion: Boolean get() = tag != "" && tag.matches(Regex("v[0-9]+\\.[0-9]\\.[0-9]")) val publishVersion: String get() { @@ -67,7 +64,7 @@ data class GitInfo(val version: String, val count: String, val tag: String, val } } -val gitVersion = getCommitVersion() ?: GitInfo("", "", "", "") +val gitVersion = getCommitVersion() ?: GitInfo("", "", "") version = gitVersion.modVersion group = "ru.dbotthepony" @@ -76,7 +73,6 @@ fun getCommitVersion(): GitInfo? { try { val versionStream = FastByteArrayOutputStream() val tagStream = FastByteArrayOutputStream() - val countStream = FastByteArrayOutputStream() val gotVersion = exec { commandLine("git", "rev-parse", "--short", "HEAD") @@ -84,27 +80,20 @@ fun getCommitVersion(): GitInfo? { standardOutput = versionStream }.exitValue == 0 - val gotCount = exec { - commandLine("git", "rev-list", "--count", "HEAD") - workingDir(".") - standardOutput = countStream - }.exitValue == 0 - val gotTag = exec { commandLine("git", "tag", "--points-at", "HEAD") workingDir(".") standardOutput = tagStream }.exitValue == 0 - if (!gotVersion || !gotCount || !gotTag) { + if (!gotVersion || !gotTag) { return null } val version = versionStream.array.copyOfRange(0, versionStream.length).toString(Charsets.UTF_8).trim() val tag = tagStream.array.copyOfRange(0, tagStream.length).toString(Charsets.UTF_8).trim() - val count = countStream.array.copyOfRange(0, countStream.length).toString(Charsets.UTF_8).trim() - return GitInfo(version, count, tag, System.getenv("BUILD_NUMBER") ?: "") + return GitInfo(version, tag, System.getenv("BUILD_NUMBER") ?: "") } catch(err: Throwable) { println("Error getting git version") println(err) @@ -147,8 +136,6 @@ dependencies { val jupiter_version: String by project val kotlin_version: String by project val kotlin_for_forge_version: String by project - val kotlin_coroutines_version: String by project - val kotlin_serialization_version: String by project val mixin_version: String by project minecraft("net.minecraftforge:forge:$mc_version-$forge_version") @@ -156,7 +143,6 @@ dependencies { implementation("thedarkcolour:kotlinforforge:$kotlin_for_forge_version") - fun library(notation: Any) { this.add("library", notation) } fun klibrary(notation: Any) { this.add("klibrary", notation) } val excludeKGroup = closureOf { @@ -165,9 +151,6 @@ dependencies { klibrary(create("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version", excludeKGroup)) klibrary(create("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version", excludeKGroup)) - klibrary(create("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version", excludeKGroup)) - klibrary(create("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$kotlin_coroutines_version", excludeKGroup)) - klibrary(create("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialization_version", excludeKGroup)) compileOnly("yalter.mousetweaks:MouseTweaks:2.23:api") annotationProcessor("org.spongepowered:mixin:${mixin_version}:processor") @@ -217,21 +200,26 @@ dependencies { configurations { getByName("dataImplementation").extendsFrom(getByName("implementation")) - getByName("library").resolutionStrategy.cacheChangingModulesFor(10, "minutes") } minecraft { - val use_parchment: String by project - - if (use_parchment.toBoolean()) { - mappings("parchment", parchment_version) - } else { - mappings("official", mc_version) - } + mappings("official", mc_version) accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg")) runs { + configureEach { + workingDirectory = project.file("run").absolutePath + + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property("forge.logging.markers", "REGISTRIES") + + // Log4j console level + property("forge.logging.console.level", "debug") + } + create("client") { mods { create(mod_id) { @@ -282,33 +270,11 @@ minecraft { } } -mixin { +/*mixin { add(sourceSets.main.get(), "$mod_id.refmap.json") config("$mod_id.mixins.json") config("$mod_id.ad_astra.mixins.json") -} - -minecraft.runs.all { - workingDirectory = project.file("run").absolutePath - - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property("forge.logging.markers", "REGISTRIES") - - // Log4j console level - property("forge.logging.console.level", "debug") - - lazyToken("minecraft_classpath") { - configurations["library"] - .copyRecursive() - .resolve() - .map { it.absolutePath } - .toMutableList() - .also { it.addAll(configurations["klibrary"].copyRecursive().resolve().map { it.absolutePath }) } - .joinToString(File.pathSeparator) - } -} +}*/ repositories { // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: @@ -383,7 +349,6 @@ fun org.gradle.jvm.tasks.Jar.attachManifest() { // Example configuration to allow publishing using the maven-publish plugin // This is the preferred method to reobfuscate your jar file tasks.jar.configure { - from(configurations["library"].map { if (it.isDirectory) it else zipTree(it) }) finalizedBy("reobfJar") attachManifest() archiveVersion.set(gitVersion.jarName) @@ -397,7 +362,6 @@ tasks { create("deobfJar", org.gradle.jvm.tasks.Jar::class.java) { archiveClassifier.set("deobf") - from(configurations["library"].map { if (it.isDirectory) it else zipTree(it) }) from(sourceSets.main.get().output) attachManifest() } diff --git a/settings.gradle.kts b/settings.gradle.kts index caa828904..4293ab440 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -31,15 +31,6 @@ buildscript { } } - maven(url = "https://maven.parchmentmc.org") { - name = "Parchment mappings" - - content { - includeGroup("org.parchmentmc") - includeGroup("org.parchmentmc.feather") - } - } - mavenCentral() } @@ -47,15 +38,11 @@ buildscript { val kotlin_version: String by settings val forge_gradle_version: String by settings val mixingradle_version: String by settings - val koremods_modlauncher_version: String by settings - val koremods_script_version: String by settings classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = forge_gradle_version) classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}") classpath("org.spongepowered:mixingradle:${mixingradle_version}") - classpath(group = "org.parchmentmc", name = "librarian", version = "1.+") - classpath(group = "org.gradle.toolchains", name = "foojay-resolver", version = "0.5.0") } }