-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathconfigure-compilation-conventions.gradle.kts
34 lines (31 loc) · 1.27 KB
/
configure-compilation-conventions.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
* Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
configure(subprojects) {
val project = this
if (name in sourceless) return@configure
apply(plugin = "kotlinx-atomicfu")
tasks.withType<KotlinCompile<*>>().configureEach {
val isMainTaskName = name == "compileKotlin" || name == "compileKotlinJvm"
kotlinOptions {
languageVersion = getOverriddenKotlinLanguageVersion(project)
apiVersion = getOverriddenKotlinApiVersion(project)
if (isMainTaskName && versionsAreNotOverridden) {
allWarningsAsErrors = true
}
val newOptions =
listOf(
"-progressive",
"-Xno-param-assertions",
"-Xno-receiver-assertions",
"-Xexpect-actual-classes",
"-Xno-call-assertions",
) + optInAnnotations.map { "-opt-in=$it" }
freeCompilerArgs = freeCompilerArgs + newOptions
}
}
}
val KotlinCommonOptions.versionsAreNotOverridden: Boolean
get() = languageVersion == null && apiVersion == null