Skip to content

Commit 5206a7d

Browse files
committed
JavaScript: Enable Gradle build cache for NpmTask tasks
NpmTask from the node-gradle plugin isn't @CacheableTask, so the build cache won't store results even when inputs/outputs are properly declared. Adding outputs.cacheIf { true } to npmTest, npmBuild, and npmFixturesBuild enables caching for these tasks.
1 parent 398b8c4 commit 5206a7d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

rewrite-javascript/build.gradle.kts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ val npmTest = tasks.register<NpmTask>("npmTest") {
107107
inputs.files(fileTree("rewrite/test"))
108108
.withPathSensitivity(PathSensitivity.RELATIVE)
109109
outputs.files("rewrite/build/test-results/jest/junit.xml")
110+
outputs.cacheIf { true }
110111

111112
args = listOf("run", "ci:test")
112113
}
@@ -123,6 +124,7 @@ val npmBuild = tasks.register<NpmTask>("npmBuild") {
123124
inputs.files(fileTree("rewrite/src"))
124125
.withPathSensitivity(PathSensitivity.RELATIVE)
125126
outputs.dir(file("rewrite/dist/"))
127+
outputs.cacheIf { true }
126128

127129
val versionTxt = file("src/main/resources/META-INF/version.txt")
128130
outputs.file(versionTxt)
@@ -172,6 +174,7 @@ val npmFixturesBuild = tasks.register<NpmTask>("npmFixturesBuild") {
172174
inputs.files(fileTree("rewrite/fixtures"))
173175
.withPathSensitivity(PathSensitivity.RELATIVE)
174176
outputs.dir(file("rewrite/dist-fixtures/"))
177+
outputs.cacheIf { true }
175178

176179
args = listOf("run", "build:fixtures")
177180
}

0 commit comments

Comments
 (0)