diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 943cb12..0000000 --- a/build.gradle +++ /dev/null @@ -1,129 +0,0 @@ -plugins { - id("fabric-loom") version "1.8-SNAPSHOT" - id("com.modrinth.minotaur") version "2.+" -} - -archivesBaseName = property("mod.name") -version = "${property("mod.version")}" + "+" + "${property("mod.version_name")}" -group = property("mod.maven_group") - -base { - archivesName = archivesBaseName -} - -repositories { - maven { url "https://maven.shedaniel.me/" } - maven { url "https://maven.terraformersmc.com/releases/" } -} - -dependencies { - minecraft "com.mojang:minecraft:${property('deps.minecraft')}" - mappings "net.fabricmc:yarn:${property('deps.yarn_mappings')}:v2" - modImplementation "net.fabricmc:fabric-loader:${property('deps.fabric_loader')}" - - modImplementation("me.shedaniel.cloth:cloth-config-fabric:${property('deps.cloth_config_version')}") - modImplementation("com.terraformersmc:modmenu:${property('deps.mod_menu_version')}") - - implementation "org.lwjgl:lwjgl-glfw:3.3.2" -} - -loom { - runConfigs.all { - ideConfigGenerated true // Run configurations are not created for subprojects by default - runDir "../../run" // Use a shared run folder and just create separate worlds - } -} - -def target = ">=${property("mod.min_target")}- <=${property("mod.max_target")}" - -processResources { - def expandProps = [ - 'version': project.version, - "minecraftVersion": target, - "javaVersion": project.property("deps.java") - ] - - filesMatching('fabric.mod.json') { - expand expandProps - } - - inputs.properties(expandProps) -} - -tasks.withType(JavaCompile).configureEach { - it.options.encoding = 'UTF-8' - - // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. - it.options.getRelease().set(project.property("deps.java") as Integer) -} - -java { - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. - withSourcesJar() - - def java = property("deps.java") == "9" ? JavaVersion.VERSION_1_9 : JavaVersion.VERSION_17 - - sourceCompatibility = java - targetCompatibility = java -} - -jar { - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} - } -} - -def collectJars = tasks.register("collectJars", Copy) { copy -> - - def task = tasks.named("remapJar") - - dependsOn(task) - - copy.from task - copy.into rootProject.buildDir.path + "/libs" -} - -// Set up assemble to depend on the collectJars task, so it gets run on build. -assemble { - dependsOn(collectJars) -} - -if (stonecutter.current.isActive) { - loom { - runConfigs.client { - ideConfigGenerated = true - vmArgs "-Dmixin.debug.export=true" - runDir "../../run" - } - } - - rootProject.tasks.register("buildActive") { - setGroup "project" - - dependsOn tasks.named("build") - } -} - - -modrinth { - token = System.getenv("MODRINTH_TOKEN") - projectId = "wayfix" - versionNumber = project.version - versionName = "v" + property("mod.version") + " [" + property("mod.version_name") + "]" - versionType = "release" - uploadFile = remapJar - gameVersions.addAll(property("publishing.supported_versions").split(",")) - loaders = ["fabric", "quilt"] - //featured = true - - dependencies { - required.project "cloth-config" - optional.project "modmenu" - } - - - def changes = rootProject.file("CHANGES.md").text - changelog = (property("deps.java") == "9" ? "# Requires Java 9+\n\n" : "") + changes + "" -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..7b52281 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,96 @@ +plugins { + id("fabric-loom") version "1.8-SNAPSHOT" + id("com.modrinth.minotaur") version "2.+" +} + +val modName = property("mod.name").toString() +version = "${property("mod.version")}" + "+" + "${property("mod.version_name")}" +group = property("mod.maven_group").toString() + + +base { + archivesName.set(modName) +} + +repositories { + maven("https://maven.shedaniel.me/") + maven("https://maven.terraformersmc.com/releases/") +} + +dependencies { + minecraft("com.mojang:minecraft:${property("deps.minecraft")}") + mappings("net.fabricmc:yarn:${property("deps.yarn_mappings")}:v2") + modImplementation("net.fabricmc:fabric-loader:${property("deps.fabric_loader")}") + + modImplementation("me.shedaniel.cloth:cloth-config-fabric:${property("deps.cloth_config_version")}") + modImplementation("com.terraformersmc:modmenu:${property("deps.mod_menu_version")}") + + implementation("org.lwjgl:lwjgl-glfw:3.3.2") +} + +loom { + decompilers { + get("vineflower").apply { // Adds names to lambdas - useful for mixins + options.put("mark-corresponding-synthetics", "1") + } + } + + runConfigs.all { + ideConfigGenerated(true) + vmArgs("-Dmixin.debug.export=true") + runDir = "../../run" + } +} + +val target = ">=${property("mod.min_target")}- <=${property("mod.max_target")}" + +tasks.processResources { + val expandProps = mapOf( + "version" to project.version, + "minecraftVersion" to target, + "javaVersion" to project.property("deps.java") + ) + + filesMatching("fabric.mod.json") { + expand(expandProps) + } + + inputs.properties(expandProps) +} + +java { + withSourcesJar() + + val javaVersion = if (project.property("deps.java") == "9") JavaVersion.VERSION_1_9 else JavaVersion.VERSION_17 + + sourceCompatibility = javaVersion + targetCompatibility = javaVersion +} + +tasks.register("buildAndCollect") { + group = "build" + from(tasks.remapJar.get().archiveFile) + into(rootProject.layout.buildDirectory.file("libs")) + dependsOn("build") +} + + +modrinth { + token.set(System.getenv("MODRINTH_TOKEN")) + projectId.set("wayfix") + versionNumber.set(version.toString()) + versionName.set("v$version") + versionType.set("release") + uploadFile.set(tasks.remapJar) + gameVersions.addAll(property("publishing.supported_versions").toString().split(",")) + loaders.addAll("fabric", "quilt") + //featured = true + + dependencies { + required.project("cloth-config") + optional.project("modmenu") + } + + val changes = rootProject.file("CHANGES.md").readText() + changelog = if (project.property("deps.java") == "9") "# Requires Java 9+\n\n$changes" else changes +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle deleted file mode 100755 index a5700ed..0000000 --- a/settings.gradle +++ /dev/null @@ -1,22 +0,0 @@ -pluginManagement { - repositories { - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - - gradlePluginPortal() - maven { url("https://maven.kikugie.dev/snapshots") } - } -} - -plugins { - id "dev.kikugie.stonecutter" version "0.5-beta.3" -} - -stonecutter { - create(rootProject) { - versions("1.16.5", "1.19", "1.19.3", "1.20.6") - vcsVersion = "1.19.3" - }; -} diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100755 index 0000000..08149d2 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,26 @@ +pluginManagement { + repositories { + maven("https://maven.fabricmc.net/") + + gradlePluginPortal() + maven("https://maven.kikugie.dev/snapshots") + } +} + +plugins { + id("dev.kikugie.stonecutter") version "0.5-beta.3" +} + +stonecutter { + kotlinController = true + centralScript = "build.gradle.kts" + + shared { + versions("1.16.5", "1.19", "1.19.3", "1.20.6") + vcsVersion = "1.19.3" + } + + create(rootProject) +} + +rootProject.name = "WayFix" \ No newline at end of file diff --git a/stonecutter.gradle b/stonecutter.gradle deleted file mode 100644 index 0238171..0000000 --- a/stonecutter.gradle +++ /dev/null @@ -1,16 +0,0 @@ -plugins { - id "dev.kikugie.stonecutter" -} -stonecutter.active "1.20.6" /* [SC] DO NOT EDIT */ - -stonecutter.registerChiseled tasks.register("chiseledBuild", stonecutter.chiseled) { - setGroup "project" - ofTask "build" -} - -stonecutter.registerChiseled tasks.register("chiseledModrinth", stonecutter.chiseled) { - setGroup "project" - ofTask "modrinth" -} - -stonecutter.debug false diff --git a/stonecutter.gradle.kts b/stonecutter.gradle.kts new file mode 100644 index 0000000..8ac44d1 --- /dev/null +++ b/stonecutter.gradle.kts @@ -0,0 +1,14 @@ +plugins { + id("dev.kikugie.stonecutter") +} +stonecutter active "1.20.6" /* [SC] DO NOT EDIT */ + +stonecutter registerChiseled tasks.register("chiseledBuild", stonecutter.chiseled) { + group = "project" + ofTask("buildAndCollect") +} + +stonecutter registerChiseled tasks.register("chiseledModrinth", stonecutter.chiseled) { + group = "project" + ofTask("modrinth") +}