Skip to content

Commit 841c544

Browse files
authored
Ensure rest snippets task output directory is cleaned before execution (#78653)
1 parent 3cbb265 commit 841c544

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/doc/DocsTestPlugin.groovy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ class DocsTestPlugin implements Plugin<Project> {
6666
TaskProvider<RestTestsFromSnippetsTask> buildRestTests = project.tasks.register('buildRestTests', RestTestsFromSnippetsTask) {
6767
defaultSubstitutions = commonDefaultSubstitutions
6868
testRoot.convention(restRootDir)
69+
doFirst {
70+
project.delete(restRootDir)
71+
}
6972
}
7073

7174
// TODO: This effectively makes testRoot not customizable, which we don't do anyway atm

build-tools-internal/src/main/groovy/org/elasticsearch/gradle/internal/doc/RestTestsFromSnippetsTask.groovy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class RestTestsFromSnippetsTask extends SnippetsTask {
6868
RestTestsFromSnippetsTask(ObjectFactory objectFactory) {
6969
testRoot = objectFactory.directoryProperty()
7070
TestBuilder builder = new TestBuilder()
71-
doFirst { outputRoot().delete() }
7271
perSnippet builder.&handleSnippet
7372
doLast builder.&checkUnconverted
7473
doLast builder.&finishLastTest

0 commit comments

Comments
 (0)