Skip to content

Commit c3d4bbf

Browse files
Update build.gradle
1 parent c03cf8e commit c3d4bbf

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

build.gradle

+16-11
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ plugins {
1111

1212
def ENV = System.getenv()
1313

14-
sourceCompatibility = JavaVersion.VERSION_21
15-
targetCompatibility = JavaVersion.VERSION_21
16-
17-
archivesBaseName = project.archives_base_name
1814
version = project.mod_version
1915
group = project.maven_group
2016

17+
base {
18+
archivesName = project.archives_base_name
19+
}
20+
2121
repositories {
2222
// Add repositories to retrieve artifacts from in here.
2323
// You should only use this when depending on other mods because
@@ -31,7 +31,7 @@ dependencies {
3131
minecraft "com.mojang:minecraft:${project.minecraft_version}"
3232
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
3333
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
34-
34+
3535
// Fabric API. This is technically optional, but you probably want it anyway.
3636
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
3737

@@ -66,11 +66,14 @@ java {
6666
// if it is present.
6767
// If you remove this line, sources will not be generated.
6868
withSourcesJar()
69+
70+
sourceCompatibility = JavaVersion.VERSION_21
71+
targetCompatibility = JavaVersion.VERSION_21
6972
}
7073

7174
jar {
7275
from("LICENSE") {
73-
rename { "${it}_${project.archivesBaseName}"}
76+
rename { "${it}_${project.base.archivesName.get()}"}
7477
}
7578
}
7679

@@ -86,8 +89,9 @@ spotless {
8689

8790
task moveDevLibs(dependsOn: [remapJar, remapSourcesJar]) {
8891
doLast {
89-
ant.move(file:"${project.buildDir}/devlibs/${archivesBaseName}-${version}-dev.jar", tofile:"${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar")
90-
ant.move(file:"${project.buildDir}/devlibs/${archivesBaseName}-${version}-sources.jar", tofile:"${project.buildDir}/libs/${archivesBaseName}-${version}-sources-dev.jar")
92+
def archivesName = project.base.archivesName.get() as String
93+
ant.move(file:"${project.buildDir}/devlibs/${archivesName}-${version}-dev.jar", tofile:"${project.buildDir}/libs/${archivesName}-${version}-dev.jar")
94+
ant.move(file:"${project.buildDir}/devlibs/${archivesName}-${version}-sources.jar", tofile:"${project.buildDir}/libs/${archivesName}-${version}-sources-dev.jar")
9195
}
9296
}
9397

@@ -98,11 +102,12 @@ task github(dependsOn: moveDevLibs) {
98102
onlyIf {
99103
ENV.GITHUB_TOKEN
100104
}
101-
105+
102106
doLast {
103107
def github = GitHub.connectUsingOAuth(ENV.GITHUB_TOKEN as String)
104108
def repository = github.getRepository("Wurst-Imperium/Wurst-MCX2")
105109
def ghVersion = version.substring(0, version.indexOf("-"))
110+
def archivesName = project.base.archivesName.get() as String
106111

107112
def ghRelease = repository.getReleaseByTagName(ghVersion as String)
108113
if(ghRelease == null) {
@@ -113,7 +118,7 @@ task github(dependsOn: moveDevLibs) {
113118

114119
ghRelease.uploadAsset(remapJar.archiveFile.get().getAsFile(), "application/java-archive")
115120
ghRelease.uploadAsset(remapSourcesJar.archiveFile.get().getAsFile(), "application/java-archive")
116-
ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesBaseName}-${version}-dev.jar"), "application/java-archive")
117-
ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesBaseName}-${version}-sources-dev.jar"), "application/java-archive")
121+
ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesName}-${version}-dev.jar"), "application/java-archive")
122+
ghRelease.uploadAsset(new File("${project.buildDir}/libs/${archivesName}-${version}-sources-dev.jar"), "application/java-archive")
118123
}
119124
}

0 commit comments

Comments
 (0)