@@ -11,13 +11,13 @@ plugins {
11
11
12
12
def ENV = System . getenv()
13
13
14
- sourceCompatibility = JavaVersion . VERSION_21
15
- targetCompatibility = JavaVersion . VERSION_21
16
-
17
- archivesBaseName = project. archives_base_name
18
14
version = project. mod_version
19
15
group = project. maven_group
20
16
17
+ base {
18
+ archivesName = project. archives_base_name
19
+ }
20
+
21
21
repositories {
22
22
// Add repositories to retrieve artifacts from in here.
23
23
// You should only use this when depending on other mods because
@@ -31,7 +31,7 @@ dependencies {
31
31
minecraft " com.mojang:minecraft:${ project.minecraft_version} "
32
32
mappings " net.fabricmc:yarn:${ project.yarn_mappings} :v2"
33
33
modImplementation " net.fabricmc:fabric-loader:${ project.loader_version} "
34
-
34
+
35
35
// Fabric API. This is technically optional, but you probably want it anyway.
36
36
modImplementation " net.fabricmc.fabric-api:fabric-api:${ project.fabric_version} "
37
37
@@ -66,11 +66,14 @@ java {
66
66
// if it is present.
67
67
// If you remove this line, sources will not be generated.
68
68
withSourcesJar()
69
+
70
+ sourceCompatibility = JavaVersion . VERSION_21
71
+ targetCompatibility = JavaVersion . VERSION_21
69
72
}
70
73
71
74
jar {
72
75
from(" LICENSE" ) {
73
- rename { " ${ it} _${ project.archivesBaseName } " }
76
+ rename { " ${ it} _${ project.base.archivesName.get() } " }
74
77
}
75
78
}
76
79
@@ -86,8 +89,9 @@ spotless {
86
89
87
90
task moveDevLibs (dependsOn : [remapJar, remapSourcesJar]) {
88
91
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" )
91
95
}
92
96
}
93
97
@@ -98,11 +102,12 @@ task github(dependsOn: moveDevLibs) {
98
102
onlyIf {
99
103
ENV . GITHUB_TOKEN
100
104
}
101
-
105
+
102
106
doLast {
103
107
def github = GitHub . connectUsingOAuth(ENV . GITHUB_TOKEN as String )
104
108
def repository = github. getRepository(" Wurst-Imperium/Wurst-MCX2" )
105
109
def ghVersion = version. substring(0 , version. indexOf(" -" ))
110
+ def archivesName = project. base. archivesName. get() as String
106
111
107
112
def ghRelease = repository. getReleaseByTagName(ghVersion as String )
108
113
if (ghRelease == null ) {
@@ -113,7 +118,7 @@ task github(dependsOn: moveDevLibs) {
113
118
114
119
ghRelease. uploadAsset(remapJar. archiveFile. get(). getAsFile(), " application/java-archive" )
115
120
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" )
118
123
}
119
124
}
0 commit comments