Skip to content

Commit f0a4eea

Browse files
committed
Refactor writeMinecraftClasspathClient task configuration to simplify classpath file handling
1 parent 6e74b61 commit f0a4eea

1 file changed

Lines changed: 28 additions & 21 deletions

File tree

  • userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev

userdev/src/functionalTest/groovy/net/neoforged/gradle/userdev/RunTests.groovy

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ class RunTests extends BuilderBasedTestSpecification {
198198
modSource project.sourceSets.main
199199
}
200200
}
201+
202+
afterEvaluate {
203+
tasks.named("writeMinecraftClasspathClient").configure { task ->
204+
task.output = project.file("classpath.txt")
205+
}
206+
}
201207
""")
202208
it.withMod()
203209
it.withToolchains()
@@ -212,12 +218,7 @@ class RunTests extends BuilderBasedTestSpecification {
212218
then:
213219
run.task(':writeMinecraftClasspathClient').outcome == TaskOutcome.SUCCESS
214220

215-
def neoformDir = run.file("build/neoForm")
216-
def versionedNeoformDir = neoformDir.listFiles()[0]
217-
def stepsDir = new File(versionedNeoformDir, "steps")
218-
def stepDir = new File(stepsDir, "writeMinecraftClasspathClient")
219-
def classpathFile = new File(stepDir, "classpath.txt")
220-
221+
def classpathFile = run.file("classpath.txt")
221222
classpathFile.exists()
222223

223224
classpathFile.text.contains("org.graalvm.polyglot${File.separator}polyglot")
@@ -247,6 +248,12 @@ class RunTests extends BuilderBasedTestSpecification {
247248
modSource project.sourceSets.main
248249
}
249250
}
251+
252+
afterEvaluate {
253+
tasks.named("writeMinecraftClasspathClient").configure { task ->
254+
task.output = project.file("classpath.txt")
255+
}
256+
}
250257
""")
251258
it.withMod()
252259
it.withToolchains()
@@ -261,11 +268,7 @@ class RunTests extends BuilderBasedTestSpecification {
261268
then:
262269
run.task(':writeMinecraftClasspathClient').outcome == TaskOutcome.SUCCESS
263270

264-
def neoformDir = run.file("build/neoForm")
265-
def versionedNeoformDir = neoformDir.listFiles()[0]
266-
def stepsDir = new File(versionedNeoformDir, "steps")
267-
def stepDir = new File(stepsDir, "writeMinecraftClasspathClient")
268-
def classpathFile = new File(stepDir, "classpath.txt")
271+
def classpathFile = run.file("classpath.txt")
269272

270273
classpathFile.exists()
271274

@@ -330,6 +333,12 @@ class RunTests extends BuilderBasedTestSpecification {
330333
modSource project.sourceSets.main
331334
}
332335
}
336+
337+
afterEvaluate {
338+
tasks.named("writeMinecraftClasspathClient").configure { task ->
339+
task.output = project.file("classpath.txt")
340+
}
341+
}
333342
""")
334343
it.withToolchains()
335344
it.withGlobalCacheDirectory(tempDir)
@@ -344,11 +353,7 @@ class RunTests extends BuilderBasedTestSpecification {
344353
then:
345354
run.task(':writeMinecraftClasspathClient').outcome == TaskOutcome.SUCCESS
346355

347-
def neoformDir = run.file("build/neoForm")
348-
def versionedNeoformDir = neoformDir.listFiles()[0]
349-
def stepsDir = new File(versionedNeoformDir, "steps")
350-
def stepDir = new File(stepsDir, "writeMinecraftClasspathClient")
351-
def classpathFile = new File(stepDir, "classpath.txt")
356+
def classpathFile = run.file("classpath.txt")
352357

353358
classpathFile.exists()
354359

@@ -388,6 +393,12 @@ class RunTests extends BuilderBasedTestSpecification {
388393
modSource project.sourceSets.main
389394
}
390395
}
396+
397+
afterEvaluate {
398+
tasks.named("writeMinecraftClasspathClient").configure { task ->
399+
task.output = project.file("classpath.txt")
400+
}
401+
}
391402
""")
392403
it.withToolchains()
393404
it.withGlobalCacheDirectory(tempDir)
@@ -402,11 +413,7 @@ class RunTests extends BuilderBasedTestSpecification {
402413
then:
403414
run.task(':writeMinecraftClasspathClient').outcome == TaskOutcome.SUCCESS
404415

405-
def neoformDir = run.file("build/neoForm")
406-
def versionedNeoformDir = neoformDir.listFiles()[0]
407-
def stepsDir = new File(versionedNeoformDir, "steps")
408-
def stepDir = new File(stepsDir, "writeMinecraftClasspathClient")
409-
def classpathFile = new File(stepDir, "classpath.txt")
416+
def classpathFile = run.file("classpath.txt")
410417

411418
classpathFile.exists()
412419

0 commit comments

Comments
 (0)