@@ -6,7 +6,7 @@ buildscript {
66
77plugins {
88 id " fabric-loom" version " ${ loom_version} "
9- id " com.diffplug.spotless" version " 8.0 .0"
9+ id " com.diffplug.spotless" version " 8.1 .0"
1010}
1111
1212def ENV = System . getenv()
@@ -68,6 +68,10 @@ loom {
6868 accessWidenerPath = file(" src/main/resources/wurst.accesswidener" )
6969
7070 runs {
71+ clientWithMods {
72+ inherit client
73+ }
74+
7175 clientGameTestWithMods {
7276 inherit client
7377 source = sourceSets. gametest
@@ -89,6 +93,20 @@ dependencies {
8993 testMods " maven.modrinth:sodium:${ project.sodium_version} "
9094}
9195
96+ def cleanClientWithMods = tasks. register(" cleanClientWithMods" , Delete ) {
97+ delete " run/mods"
98+ }
99+
100+ def prepareClientWithMods = tasks. register(" prepareClientWithMods" , Sync ) {
101+ from configurations. testMods
102+ into " run/mods"
103+ }
104+
105+ tasks. named(" runClientWithMods" ) {
106+ dependsOn prepareClientWithMods
107+ finalizedBy cleanClientWithMods
108+ }
109+
92110def cleanClientGameTestWithMods = tasks. register(" cleanClientGameTestWithMods" , Delete ) {
93111 delete layout. buildDirectory. dir(" run/clientGameTestWithMods" )
94112}
@@ -247,60 +265,3 @@ task closeMilestone {
247265 }
248266 }
249267}
250-
251- task uploadBackups {
252- dependsOn build
253-
254- onlyIf {
255- ENV . WI_BACKUPS_API_KEY
256- }
257-
258- doLast {
259- def shortVersion = getGhVersion(). substring(1 )
260- def backupUrl = " https://api.wurstclient.net/artifact-backups/Wurst/${ shortVersion} "
261-
262- def maxRetries = 3
263- def retryCount = 0
264- def success = false
265-
266- while (! success && retryCount < maxRetries) {
267- try {
268- def connection = new URL (backupUrl). openConnection() as HttpURLConnection
269- def boundary = UUID . randomUUID(). toString()
270- connection. setRequestMethod(" POST" )
271- connection. setRequestProperty(" X-API-Key" , ENV . WI_BACKUPS_API_KEY )
272- connection. setRequestProperty(" Accept" , " application/json" )
273- connection. setRequestProperty(" Content-Type" , " multipart/form-data; boundary=$boundary " )
274- connection. doOutput = true
275-
276- def output = connection. outputStream
277- [remapJar, remapSourcesJar]. each { jarTask ->
278- def file = jarTask. archiveFile. get(). asFile
279- output << " --${ boundary} \r\n "
280- output << " Content-Disposition: form-data; name=\" files\" ; filename=\" ${ file.name} \"\r\n "
281- output << " Content-Type: application/java-archive\r\n\r\n "
282- file. withInputStream { input ->
283- output << input
284- }
285- output << " \r\n "
286- }
287- output << " --${ boundary} --\r\n "
288- output. flush()
289-
290- if (connection. responseCode != 200 ) {
291- throw new IOException (" HTTP ${ connection.responseCode} : ${ connection.responseMessage} " )
292- }
293-
294- success = true
295-
296- } catch (Exception e) {
297- retryCount++
298- if (retryCount >= maxRetries) {
299- throw new GradleException (" Failed to upload backups after ${ maxRetries} attempts: ${ e.message} " )
300- }
301- println " Upload attempt ${ retryCount} failed: ${ e.message} . Retrying in 5 seconds..."
302- Thread . sleep(5000 )
303- }
304- }
305- }
306- }
0 commit comments