diff --git a/build.gradle b/build.gradle index 0b10ef1af2..6e7e507735 100644 --- a/build.gradle +++ b/build.gradle @@ -11,13 +11,13 @@ plugins { def ENV = System.getenv() -sourceCompatibility = JavaVersion.VERSION_21 -targetCompatibility = JavaVersion.VERSION_21 - -archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +base { + archivesName = project.archives_base_name +} + repositories { // Add repositories to retrieve artifacts from in here. // You should only use this when depending on other mods because @@ -31,7 +31,7 @@ dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" - + // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" @@ -66,11 +66,14 @@ java { // if it is present. // If you remove this line, sources will not be generated. withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { from("LICENSE") { - rename { "${it}_${project.archivesBaseName}"} + rename { "${it}_${project.base.archivesName.get()}"} } } @@ -86,8 +89,9 @@ spotless { task moveDevLibs(dependsOn: [remapJar, remapSourcesJar]) { doLast { - ant.move(file:"${project.buildDir}/devlibs/${archivesBaseName}-${version}-dev.jar", tofile:"${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar") - ant.move(file:"${project.buildDir}/devlibs/${archivesBaseName}-${version}-sources.jar", tofile:"${project.buildDir}/libs/${archivesBaseName}-${version}-sources-dev.jar") + def archivesName = project.base.archivesName.get() as String + ant.move(file:"${project.buildDir}/devlibs/${archivesName}-${version}-dev.jar", tofile:"${project.buildDir}/libs/${archivesName}-${version}-dev.jar") + ant.move(file:"${project.buildDir}/devlibs/${archivesName}-${version}-sources.jar", tofile:"${project.buildDir}/libs/${archivesName}-${version}-sources-dev.jar") } } @@ -98,11 +102,12 @@ task github(dependsOn: moveDevLibs) { onlyIf { ENV.GITHUB_TOKEN } - + doLast { def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN as String) def repository = github.getRepository("Wurst-Imperium/Wurst-MCX2") def ghVersion = version.substring(0, version.indexOf("-")) + def archivesName = project.base.archivesName.get() as String def ghRelease = repository.getReleaseByTagName(ghVersion as String) if(ghRelease == null) { @@ -113,7 +118,7 @@ task github(dependsOn: moveDevLibs) { ghRelease.uploadAsset(remapJar.archiveFile.get().getAsFile(), "application/java-archive") ghRelease.uploadAsset(remapSourcesJar.archiveFile.get().getAsFile(), "application/java-archive") - ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar"), "application/java-archive") - ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesBaseName}-${version}-sources-dev.jar"), "application/java-archive") + ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesName}-${version}-dev.jar"), "application/java-archive") + ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesName}-${version}-sources-dev.jar"), "application/java-archive") } }