From b3237fe53d4ff838984d65954772cf77588644ae Mon Sep 17 00:00:00 2001 From: nea Date: Sat, 3 Jun 2023 14:56:10 +0200 Subject: Add auto hotswap installer --- build.gradle.kts | 66 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 22 deletions(-) (limited to 'build.gradle.kts') diff --git a/build.gradle.kts b/build.gradle.kts index a5a28d3..276d26c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,23 +28,6 @@ compileTestKotlin.kotlinOptions { jvmTarget = "17" } -loom { - clientOnlyMinecraftJar() - accessWidenerPath.set(project.file("src/main/resources/firmament.accesswidener")) - runs { - removeIf { it.name != "client" } - named("client") { - property("devauth.enabled", "true") - property("fabric.log.level", "info") - property("firmament.debug", "true") - /* - vmArg("-XX:+AllowEnhancedClassRedefinition") - vmArg("-XX:HotswapAgent=fatjar") - */ - } - } -} - repositories { maven("https://maven.terraformersmc.com/releases/") maven("https://maven.shedaniel.me") @@ -59,6 +42,17 @@ repositories { includeGroup("com.unascribed") } } + ivy("https://github.com/HotswapProjects/HotswapAgent/releases/download") { + patternLayout { + artifact("[revision]/[artifact]-[revision].[ext]") + } + content { + includeGroup("virtual.github.hotswapagent") + } + metadataSources { + artifact() + } + } maven("https://server.bbkr.space/artifactory/libs-release") maven("https://repo.nea.moe/releases") mavenLocal() @@ -72,6 +66,10 @@ val transInclude by configurations.creating { isTransitive = true } +val hotswap by configurations.creating { + isVisible = false +} + val nonModImplentation by configurations.creating { extendsFrom(shadowMe) configurations.implementation.get().extendsFrom(this) @@ -82,6 +80,9 @@ dependencies { "minecraft"(libs.minecraft) "mappings"("net.fabricmc:yarn:${libs.versions.yarn.get()}:v2") + // Hotswap Dependency + hotswap(libs.hotswap) + // Fabric dependencies modImplementation(libs.fabric.loader) modImplementation(libs.fabric.kotlin) @@ -123,22 +124,46 @@ dependencies { version = rootProject.property("mod_version").toString() group = rootProject.property("maven_group").toString() +loom { + clientOnlyMinecraftJar() + accessWidenerPath.set(project.file("src/main/resources/firmament.accesswidener")) + runs { + removeIf { it.name != "client" } + named("client") { + property("devauth.enabled", "true") + property("fabric.log.level", "info") + property("firmament.debug", "true") + + vmArg("-ea") + vmArg("-XX:+AllowEnhancedClassRedefinition") + vmArg("-XX:HotswapAgent=external") + vmArg("-javaagent:${hotswap.resolve().single().absolutePath}") + } + } +} + tasks.withType { options.encoding = "UTF-8" options.release.set(17) } +tasks.jar { + destinationDirectory.set(layout.buildDirectory.dir("badjars")) + archiveClassifier.set("slim") +} + tasks.shadowJar { configurations = listOf(shadowMe) - archiveClassifier.set("dev-thicc") + archiveClassifier.set("") relocate("io.github.moulberry.repo", "moe.nea.firmament.deps.repo") } tasks.remapJar { + destinationDirectory.set(layout.buildDirectory.dir("badjars")) injectAccessWidener.set(true) inputFile.set(tasks.shadowJar.flatMap { it.archiveFile }) dependsOn(tasks.shadowJar) - archiveClassifier.set("thicc") + archiveClassifier.set("dev") } tasks.processResources { @@ -151,9 +176,6 @@ tasks.processResources { filesMatching("**/fabric.mod.json") { expand(*replacements.toTypedArray()) } - filesMatching("**/lang/*.json") { - // flattenJson(this) - } from(tasks.scanLicenses) } -- cgit