Skip to content

Commit c6950bc

Browse files
committed
Fix: Enforce compiler warnings in oauth2-core
To prevent future compiler warnings from being introduced, this change applies the `compile-warnings-error` plugin to the `spring-security-oauth2-core` module. This ensures that any new warnings will fail the build, maintaining code quality and preventing warning accumulation. Fixes: gh-18434 Signed-off-by: Pavel Vassiliev <paulvas@gmail.com> Signed-off-by: paulvas <paulvas@gmail.com>
1 parent 83a5047 commit c6950bc

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

buildSrc/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ gradlePlugin {
5252
id = "org.springframework.security.check-expected-branch-version"
5353
implementationClass = "org.springframework.security.CheckExpectedBranchVersionPlugin"
5454
}
55+
compileWarningsError {
56+
id = "compile-warnings-error"
57+
implementationClass = "CompileWarningsErrorPlugin"
58+
}
5559
}
5660
}
5761

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import org.gradle.api.Plugin
2+
import org.gradle.api.Project
3+
import org.gradle.api.tasks.compile.JavaCompile
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
5+
6+
class CompileWarningsErrorPlugin implements Plugin<Project> {
7+
void apply(Project project) {
8+
project.tasks.withType(JavaCompile) {
9+
options.compilerArgs += "-Werror"
10+
}
11+
project.tasks.withType(KotlinCompile) {
12+
kotlinOptions.allWarningsAsErrors = true
13+
}
14+
}
15+
}

oauth2/oauth2-core/spring-security-oauth2-core.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
plugins {
2+
id 'compile-warnings-error'
3+
}
4+
15
apply plugin: 'io.spring.convention.spring-module'
26

37
dependencies {

0 commit comments

Comments
 (0)