@@ -14,6 +14,7 @@ import org.jetbrains.kotlin.gradle.dsl.*
14
14
* - `kotlin_repo_url` defines additional repository to be added to the repository list
15
15
* - `kotlin_language_version` overrides Kotlin language versions
16
16
* - `kotlin_api_version` overrides Kotlin API version
17
+ * - `kotlin_additional_cli_options` additional CLI options for the Kotlin compiler
17
18
*
18
19
* Ktor Train:
19
20
* All the above properties are applied, and:
@@ -53,6 +54,14 @@ val kotlinApiVersion by lazy {
53
54
.orNull
54
55
?.also { log(" Kotlin API version: ${it.version} " ) }
55
56
}
57
+ val kotlinAdditionalCliOptions by lazy {
58
+ val spacesRegex = " \\ s+" .toRegex()
59
+ providers.gradleProperty(" kotlin_additional_cli_options" )
60
+ .map { it.trim { it == ' "' || it.isWhitespace() }.split(spacesRegex).filterNot(String ::isEmpty) }
61
+ .orNull
62
+ ?.also { log(" Kotlin additional CLI options: $it " ) }
63
+ .orEmpty()
64
+ }
56
65
57
66
pluginManagement {
58
67
repositories {
@@ -88,10 +97,28 @@ gradle.afterProject {
88
97
languageVersion = version
89
98
log(" $path : Set Kotlin LV $version " )
90
99
}
100
+
91
101
kotlinApiVersion?.let { version ->
92
102
apiVersion = version
93
103
log(" $path : Set Kotlin APIV $version " )
94
104
}
105
+
106
+ // Unconditionally disable the -Werror option
107
+ allWarningsAsErrors = false
108
+
109
+ val argsToAdd = listOf (
110
+ // Output reported warnings even in the presence of reported errors
111
+ " -Xreport-all-warnings" ,
112
+ // Output kotlin.git-searchable names of reported diagnostics
113
+ " -Xrender-internal-diagnostic-names" ,
114
+ // Opt into additional warning-reporting compilation checks
115
+ " -Wextra" ,
116
+ // Opt into additional compilation checks hidden from users
117
+ " -Xuse-fir-experimental-checkers" ,
118
+ ) + kotlinAdditionalCliOptions
119
+
120
+ freeCompilerArgs.addAll(argsToAdd)
121
+ log(" $path : Added ${argsToAdd.joinToString(" " )} " )
95
122
}
96
123
}
97
124
0 commit comments