diff --git a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java index ae7dc0b260..545cae72d6 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java @@ -190,9 +190,7 @@ class JavaConventions { if (isPredictiveTestSelectionEnabled()) { PredictiveTestSelectionExtension predictiveTestSelection = test.getExtensions() .getByType(PredictiveTestSelectionExtension.class); - predictiveTestSelection.getEnabled().set(true); - predictiveTestSelection.mustRun((mustRun) -> mustRun.getIncludeClasses() - .add("org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation.*")); + predictiveTestSelection.getEnabled().convention(true); } } diff --git a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle index db77d16657..72f2f42110 100644 --- a/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle +++ b/spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle @@ -196,26 +196,10 @@ dependencies { testRuntimeOnly("org.springframework.security:spring-security-saml2-service-provider") } -test { - outputs.dir("${buildDir}/generated-snippets") -} - task dependencyVersions(type: org.springframework.boot.build.constraints.ExtractVersionConstraints) { enforcedPlatform(":spring-boot-project:spring-boot-dependencies") } -tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) { - dependsOn dependencyVersions - doFirst { - def versionConstraints = dependencyVersions.versionConstraints - def integrationVersion = versionConstraints["org.springframework.integration:spring-integration-core"] - def integrationDocs = String.format("https://docs.spring.io/spring-integration/docs/%s/reference/html/", integrationVersion) - attributes "spring-integration-docs": integrationDocs - } - dependsOn test - inputs.dir("${buildDir}/generated-snippets").withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("generatedSnippets") -} - asciidoctor { sources { include "index.adoc" @@ -243,3 +227,31 @@ task zip(type: Zip) { artifacts { documentation zip } + +tasks.named("test") { + filter { + excludeTestsMatching("org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation.*") + } +} + +def documentationTest = tasks.register("documentationTest", Test) { + filter { + includeTestsMatching("org.springframework.boot.actuate.autoconfigure.endpoint.web.documentation.*") + } + outputs.dir("${buildDir}/generated-snippets") + predictiveSelection { + enabled = false + } +} + +tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) { + dependsOn dependencyVersions + doFirst { + def versionConstraints = dependencyVersions.versionConstraints + def integrationVersion = versionConstraints["org.springframework.integration:spring-integration-core"] + def integrationDocs = String.format("https://docs.spring.io/spring-integration/docs/%s/reference/html/", integrationVersion) + attributes "spring-integration-docs": integrationDocs + } + dependsOn documentationTest + inputs.dir("${buildDir}/generated-snippets").withPathSensitivity(PathSensitivity.RELATIVE).withPropertyName("generatedSnippets") +} diff --git a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-junit-vintage/build.gradle b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-junit-vintage/build.gradle index d44518a14d..537f554ab9 100644 --- a/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-junit-vintage/build.gradle +++ b/spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-junit-vintage/build.gradle @@ -23,4 +23,7 @@ test { } } } + predictiveSelection { + enabled = false + } }