@@ -69,6 +69,16 @@ var KotlinCompilation.kspIncrementalLog: Boolean
69
69
registrar.incrementalLog = value
70
70
}
71
71
72
+ /* *
73
+ * Controls for enabling all warnings as errors in KSP.
74
+ */
75
+ var KotlinCompilation .allWarningsAsErrors: Boolean
76
+ get() = getKspRegistrar().allWarningsAsErrors
77
+ set(value) {
78
+ val registrar = getKspRegistrar()
79
+ registrar.allWarningsAsErrors = value
80
+ }
81
+
72
82
private val KotlinCompilation .kspJavaSourceDir: File
73
83
get() = kspSourcesDir.resolve(" java" )
74
84
@@ -129,6 +139,7 @@ private class KspCompileTestingComponentRegistrar(
129
139
130
140
var incremental: Boolean = false
131
141
var incrementalLog: Boolean = false
142
+ var allWarningsAsErrors: Boolean = false
132
143
133
144
override fun registerProjectComponents (project : MockProject , configuration : CompilerConfiguration ) {
134
145
if (providers.isEmpty()) {
@@ -141,6 +152,7 @@ private class KspCompileTestingComponentRegistrar(
141
152
142
153
this .incremental = this @KspCompileTestingComponentRegistrar.incremental
143
154
this .incrementalLog = this @KspCompileTestingComponentRegistrar.incrementalLog
155
+ this .allWarningsAsErrors = this @KspCompileTestingComponentRegistrar.allWarningsAsErrors
144
156
145
157
this .cachesDir = compilation.kspCachesDir.also {
146
158
it.deleteRecursively()
@@ -181,7 +193,8 @@ private class KspCompileTestingComponentRegistrar(
181
193
compilation.internalMessageStreamAccess,
182
194
MessageRenderer .GRADLE_STYLE ,
183
195
compilation.verbose
184
- )
196
+ ),
197
+ allWarningsAsErrors
185
198
)
186
199
val registrar = KspTestExtension (options, providers, messageCollectorBasedKSPLogger)
187
200
AnalysisHandlerExtension .registerExtension(project, registrar)
0 commit comments