File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change 1
1
import org.jetbrains.kotlin.config.KotlinCompilerVersion
2
2
import org.jetbrains.kotlin.gradle.dsl.*
3
3
import org.gradle.kotlin.dsl.*
4
+ import org.gradle.kotlin.dsl.withType
5
+ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
6
+ import kotlin.collections.joinToString
4
7
5
8
buildscript {
6
9
if (shouldUseLocalMaven(rootProject)) {
@@ -171,3 +174,10 @@ if (isSnapshotTrainEnabled(rootProject)) {
171
174
// Report Kotlin compiler version when building project
172
175
println (" Using Kotlin compiler version: ${KotlinCompilerVersion .VERSION } " )
173
176
}
177
+
178
+ tasks.withType<KotlinCompilationTask <* >>().configureEach {
179
+ doFirst {
180
+ logger.info(" Added Kotlin compiler flags: ${compilerOptions.freeCompilerArgs.get().joinToString(" , " )} " )
181
+ logger.info(" allWarningsAsErrors=${compilerOptions.allWarningsAsErrors.get()} " )
182
+ }
183
+ }
Original file line number Diff line number Diff line change @@ -201,11 +201,12 @@ fun KotlinCommonCompilerOptions.configureKotlinUserProject() {
201
201
* See <https://github.com/Kotlin/kotlinx.coroutines/pull/4392#issuecomment-2775630200>
202
202
*/
203
203
fun KotlinCommonCompilerOptions.addExtraCompilerFlags (project : Project ) {
204
- val extraOptions = project.providers.gradleProperty(" kotlin_additional_cli_options" ).orNull
205
- if (extraOptions != null ) {
206
- LOGGER .info(""" Adding extra compiler flags '$extraOptions ' for a compilation in the project $${project.name} """ )
207
- extraOptions.split(" " ).forEach {
208
- if (it.isNotEmpty()) freeCompilerArgs.add(it)
204
+ val extraOptions = project.providers.gradleProperty(" kotlin_additional_cli_options" )
205
+ .orNull?.let { options ->
206
+ options.removeSurrounding(" \" " ).split(" " ).filter { it.isNotBlank() }
209
207
}
208
+ extraOptions?.forEach { option ->
209
+ freeCompilerArgs.add(option)
210
+ LOGGER .info(""" Adding extra compiler flag '$option ' for a compilation in the project $${project.name} """ )
210
211
}
211
212
}
You can’t perform that action at this time.
0 commit comments