Skip to content

Commit fbaf874

Browse files
Declare Gradle inputs to tasks (#7272)
1 parent ab2af5d commit fbaf874

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

rewrite-csharp/build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,11 @@ val rpcTestClasspath by tasks.registering {
9494
description = "Write the Java RPC test server classpath for C# integration tests"
9595
dependsOn(tasks.named("testClasses"))
9696

97+
inputs.files(configurations["testRuntimeClasspath"])
98+
.withNormalizer(ClasspathNormalizer::class)
99+
inputs.files(tasks.named<JavaCompile>("compileJava").flatMap { it.destinationDirectory })
100+
inputs.files(tasks.named<JavaCompile>("compileTestJava").flatMap { it.destinationDirectory })
101+
97102
val classpathFile = layout.buildDirectory.file("rpc-test-server-classpath.txt")
98103
outputs.file(classpathFile)
99104

rewrite-python/build.gradle.kts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,13 @@ val generateTestClasspath by tasks.registering {
386386
val outputFile = pythonDir.resolve("test-classpath.txt")
387387
outputs.file(outputFile)
388388

389+
inputs.files(configurations["runtimeClasspath"])
390+
.withNormalizer(ClasspathNormalizer::class)
391+
inputs.files(configurations["testRuntimeClasspath"])
392+
.withNormalizer(ClasspathNormalizer::class)
393+
inputs.files(tasks.named("compileJava").map { it.outputs.files })
394+
inputs.files(tasks.named("processResources").map { it.outputs.files })
395+
389396
// Depend on jar tasks to ensure jars exist
390397
dependsOn(tasks.named("testClasses"))
391398
dependsOn(tasks.named("jar"))
@@ -401,8 +408,6 @@ val generateTestClasspath by tasks.registering {
401408
.joinToString(File.pathSeparator) { it.absolutePath }
402409
outputFile.writeText(classpath)
403410
logger.lifecycle("Generated test classpath to ${outputFile.absolutePath}")
404-
405-
406411
}
407412
}
408413

0 commit comments

Comments
 (0)