File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,32 @@ private val LOGGER: Logger = Logger.getLogger("Kotlin settings logger")
1818 * are compatible with our libraries (aka "integration testing that substitues lack of unit testing").
1919 */
2020
21+ /* *
22+ * Should be used for running against of non-released Kotlin compiler on a system test level.
23+ *
24+ * @return a Kotlin API version parametrized from command line nor gradle.properties, null otherwise
25+ */
26+ fun getOverriddenKotlinApiVersion (project : Project ): String? {
27+ val apiVersion = project.rootProject.properties[" kotlin_api_version" ] as ? String
28+ if (apiVersion != null ) {
29+ LOGGER .info(""" Configured Kotlin API version: '$apiVersion ' for project $${project.name} """ )
30+ }
31+ return apiVersion
32+ }
33+
34+ /* *
35+ * Should be used for running against of non-released Kotlin compiler on a system test level
36+ *
37+ * @return a Kotlin Language version parametrized from command line nor gradle.properties, null otherwise
38+ */
39+ fun getOverriddenKotlinLanguageVersion (project : Project ): String? {
40+ val languageVersion = project.rootProject.properties[" kotlin_language_version" ] as ? String
41+ if (languageVersion != null ) {
42+ LOGGER .info(""" Configured Kotlin Language version: '$languageVersion ' for project ${project.name} """ )
43+ }
44+ return languageVersion
45+ }
46+
2147/* *
2248 * Should be used for running against of non-released Kotlin compiler on a system test level
2349 * Kotlin compiler artifacts are expected to be downloaded from maven central by default.
Original file line number Diff line number Diff line change 22 * Copyright 2016-2022 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33 */
44
5- import org.jetbrains.kotlin.gradle.tasks.*
5+ import org.jetbrains.kotlin.gradle.dsl.KotlinCompile
6+ import org.jetbrains.kotlin.gradle.dsl.KotlinCommonOptions
67
78configure(subprojects) {
9+ val project = this
810 if (name in sourceless) return @configure
911 apply (plugin = " kotlinx-atomicfu" )
10- val projectName = name
11- tasks.withType(KotlinCompile ::class ).all {
12+ tasks.withType<KotlinCompile <* >>().configureEach {
1213 val isMainTaskName = name == " compileKotlin" || name == " compileKotlinJvm"
1314 kotlinOptions {
14- if (isMainTaskName) {
15+ languageVersion = getOverriddenKotlinLanguageVersion(project)
16+ apiVersion = getOverriddenKotlinApiVersion(project)
17+ if (isMainTaskName && versionsAreNotOverridden) {
1518 allWarningsAsErrors = true
1619 }
1720 val newOptions =
@@ -23,3 +26,6 @@ configure(subprojects) {
2326 }
2427 }
2528}
29+
30+ val KotlinCommonOptions .versionsAreNotOverridden: Boolean
31+ get() = languageVersion == null && apiVersion == null
You can’t perform that action at this time.
0 commit comments