@@ -50,44 +50,40 @@ buildscript {
5050 }
5151 }
5252 dependencies {
53- if (JavaVersion . current(). isJava11Compatible()) {
54- classpath(" com.autonomousapps:dependency-analysis-gradle-plugin:$dependencyAnalysisPluginVersion " )
55- }
53+ // With toolchains, the dependency analysis plugin can always be applied since Gradle runs on JDK 17+
54+ classpath(" com.autonomousapps:dependency-analysis-gradle-plugin:$dependencyAnalysisPluginVersion " )
5655 }
5756}
5857
5958apply plugin : " io.servicetalk.servicetalk-gradle-plugin-internal-root"
6059
61- // Unfortunately, we can not make this validation part of our servicetalk-gradle-plugin-internal because it requires
62- // JDK11 while we build and package our plugin with JDK8.
63- if (JavaVersion . current(). isJava11Compatible()) {
64- apply plugin : " com.autonomousapps.dependency-analysis"
60+ // With toolchains, Gradle always runs on JDK 17+ so dependency analysis can always be applied
61+ apply plugin : " com.autonomousapps.dependency-analysis"
6562
66- dependencyAnalysis {
67- issues {
68- all {
69- onAny {
70- severity(" fail" )
71- }
72- onUnusedDependencies {
73- // We use it for log4j2.xml configuration
74- exclude(" :servicetalk-test-resources" )
75- }
76- onUsedTransitiveDependencies {
77- // We import it as api dependency via :servicetalk-annotations
78- exclude(" com.google.code.findbugs:jsr305" )
79- }
80- onIncorrectConfiguration {
81- // We import it as api dependency via :servicetalk-annotations
82- exclude(" com.google.code.findbugs:jsr305" )
83- }
63+ dependencyAnalysis {
64+ issues {
65+ all {
66+ onAny {
67+ severity(" fail" )
68+ }
69+ onUnusedDependencies {
70+ // We use it for log4j2.xml configuration
71+ exclude(" :servicetalk-test-resources" )
72+ }
73+ onUsedTransitiveDependencies {
74+ // We import it as api dependency via :servicetalk-annotations
75+ exclude(" com.google.code.findbugs:jsr305" )
76+ }
77+ onIncorrectConfiguration {
78+ // We import it as api dependency via :servicetalk-annotations
79+ exclude(" com.google.code.findbugs:jsr305" )
8480 }
8581 }
8682 }
87-
88- quality. dependsOn buildHealth
8983}
9084
85+ quality. dependsOn buildHealth
86+
9187task validateLocalDocSite (type : Exec ) {
9288 group = ' Documentation'
9389 description = ' Generate and validate servicetalk.io site documentation'
@@ -97,8 +93,11 @@ task validateLocalDocSite(type: Exec) {
9793quality. dependsOn validateLocalDocSite
9894
9995subprojects {
100- // mockito 5 only supports jdk11+
101- if (JavaVersion . current() < JavaVersion . VERSION_11 ) {
96+ // mockito 5 only supports jdk11+, but with toolchains we check the toolchain version, not Gradle's JVM
97+ def toolchainVersion = project. hasProperty(' testJavaVersion' )
98+ ? Integer . parseInt(project. property(' testJavaVersion' ). toString())
99+ : 8
100+ if (toolchainVersion < 11 ) {
102101 project. setProperty(" mockitoCoreVersion" , mockitoCorePreJdk11Version)
103102 } else {
104103 apply plugin : " com.autonomousapps.dependency-analysis"
0 commit comments