diff --git a/client-mod/build.gradle b/client-mod/build.gradle deleted file mode 100644 index 61675a3b9..000000000 --- a/client-mod/build.gradle +++ /dev/null @@ -1,90 +0,0 @@ -plugins { - id 'fabric-loom' version '1.10-SNAPSHOT' - id 'com.gradleup.shadow' version '9.0.0-beta11' -} - -version = project.project_version -group = project.project_group - -base { - archivesName = "craft-engine-fabric-mod" -} - -sourceSets { - client { - compileClasspath += main.compileClasspath - runtimeClasspath += main.runtimeClasspath - } - main { - output.dir(client.output) - } -} - -shadowJar { - relocate('org.yaml', 'net.momirealms.craftengine.libraries.org.yaml') - configurations = [project.configurations.shadow] - archiveFileName = "${base.archivesName.get()}-${project.version}-shadow.jar" - from sourceSets.main.output - from sourceSets.client.output -} - -remapJar { - dependsOn shadowJar - inputFile = shadowJar.archiveFile - - destinationDirectory = file("$rootDir/target") - archiveFileName = "${base.archivesName.get()}-${project.version}.jar" -} - -loom { - mods { - "craft-engine-fabric-mod" { - sourceSet sourceSets.main - sourceSet sourceSets.client - } - } -} - -configurations { - shadow - implementation.extendsFrom(shadow) -} - -dependencies { - minecraft "com.mojang:minecraft:${project.latest_minecraft_version}" - mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - shadow 'org.yaml:snakeyaml:2.4' -} - -processResources { - inputs.property "version", project.version - inputs.property "minecraft_version", project.latest_minecraft_version - inputs.property "loader_version", project.loader_version - filteringCharset "UTF-8" - - filesMatching("fabric.mod.json") { - expand "version": project.version, - "minecraft_version": project.latest_minecraft_version, - "loader_version": project.loader_version - } -} - -def targetJavaVersion = 21 -tasks.withType(JavaCompile).configureEach { - it.options.encoding = "UTF-8" - if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) { - it.options.release.set(targetJavaVersion) - } -} - -java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion) - } - withSourcesJar() -} - -tasks.build.dependsOn \ No newline at end of file diff --git a/client-mod/build.gradle.kts b/client-mod/build.gradle.kts new file mode 100644 index 000000000..54a451fee --- /dev/null +++ b/client-mod/build.gradle.kts @@ -0,0 +1,95 @@ +plugins { + id("fabric-loom") version "1.10-SNAPSHOT" + id("com.gradleup.shadow") version "9.0.0-beta11" +} + +version = property("project_version")!! +group = property("project_group")!! +val project_version: String by project +val latest_minecraft_version: String by project +val loader_version: String by project + +base { + archivesName.set("craft-engine-fabric-mod") +} + +sourceSets { + create("client") { + compileClasspath += sourceSets.main.get().compileClasspath + runtimeClasspath += sourceSets.main.get().runtimeClasspath + } + main { + output.dir(sourceSets["client"].output) + } +} + +tasks.shadowJar { + relocate("org.yaml", "net.momirealms.craftengine.libraries.org.yaml") + configurations = listOf(project.configurations.getByName("shadow")) + archiveFileName.set("${base.archivesName.get()}-${project.version}-shadow.jar") + from(sourceSets.main.get().output) + from(sourceSets["client"].output) +} + +tasks.remapJar { + dependsOn(tasks.shadowJar) + inputFile.set(tasks.shadowJar.get().archiveFile) + + destinationDirectory.set(file("$rootDir/target")) + archiveFileName.set("${base.archivesName.get()}-${project.version}.jar") +} + +loom { + mods { + create("craft-engine-fabric-mod") { + sourceSet(sourceSets.main.get()) + sourceSet(sourceSets["client"]) + } + } +} + +dependencies { + minecraft("com.mojang:minecraft:${property("latest_minecraft_version")}") + mappings("net.fabricmc:yarn:${property("yarn_mappings")}:v2") + modImplementation("net.fabricmc:fabric-loader:${property("loader_version")}") + modImplementation("net.fabricmc.fabric-api:fabric-api:${property("fabric_version")}") + add("shadow", "org.yaml:snakeyaml:2.4") +} + +tasks.processResources { + inputs.property("version", project_version) + inputs.property("minecraft_version", latest_minecraft_version) + inputs.property("loader_version", loader_version) + + filteringCharset = "UTF-8" + + filesMatching("fabric.mod.json") { + expand( + "version" to project_version, + "minecraft_version" to latest_minecraft_version, + "loader_version" to loader_version + ) + } +} + +val targetJavaVersion = 21 +tasks.withType().configureEach { + options.encoding = "UTF-8" + if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible) { + options.release.set(targetJavaVersion) + } +} + +java { + val javaVersion = JavaVersion.toVersion(targetJavaVersion) + if (JavaVersion.current() < javaVersion) { + toolchain { + languageVersion.set(JavaLanguageVersion.of(targetJavaVersion)) + } + } + withSourcesJar() +} + +tasks.build { + dependsOn(tasks.shadowJar) +} \ No newline at end of file