0
0
mirror of https://github.com/Wurst-Imperium/Wurst7.git synced 2024-09-20 01:12:13 +02:00

Update build.gradle

This commit is contained in:
Alexander01998 2024-06-17 15:06:19 +02:00
parent c03cf8ef28
commit c3d4bbf4a2

View File

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