Skip to content

Adopt KUP requirements imposed by KT-75078 #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 6, 2025
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,31 @@ allprojects {
}
}

val setAllWarningsAsError = providers.gradleProperty("kotlin_Werror_override").map {
when (it) {
"enable" -> true
"disable" -> false
else -> error("Unexpected value for 'kotlin_Werror_override' property: $it")
}
}

tasks.withType(KotlinCompilationTask::class).configureEach {
compilerOptions {
allWarningsAsErrors = true
freeCompilerArgs.add("-Xexpect-actual-classes")
if (setAllWarningsAsError.orNull != false) {
allWarningsAsErrors = true
} else {
freeCompilerArgs.addAll(
"-Wextra",
"-Xuse-fir-experimental-checkers"
)
logger.info("kotlin_Werror_override was set to 'disable'")
logger.info("Using -Wextra and -Xuse-fir-experimental-checkers compiler options")
}
freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
"-Xreport-all-warnings",
"-Xrender-internal-diagnostic-names"
)
}
if (this is KotlinJsCompile) {
compilerOptions {
Expand All @@ -60,6 +81,14 @@ allprojects {
freeCompilerArgs.add("-Xjvm-default=disable")
}
}

val extraOpts = providers.gradleProperty("kotlin_additional_cli_options").orNull
extraOpts?.split(' ')?.let { opts ->
if (opts.isNotEmpty()) {
logger.info("Adding additional compiler options: ${opts.joinToString(", ")}")
compilerOptions.freeCompilerArgs.addAll(opts)
}
}
}
}

Expand Down