Skip to content
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

Update user projects config: adapt build script to new TeamCity variables #3791

Merged
merged 1 commit into from
Jun 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 26 additions & 0 deletions buildSrc/src/main/kotlin/CommunityProjectsBuild.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,32 @@ private val LOGGER: Logger = Logger.getLogger("Kotlin settings logger")
* are compatible with our libraries (aka "integration testing that substitues lack of unit testing").
*/

/**
* Should be used for running against of non-released Kotlin compiler on a system test level.
*
* @return a Kotlin API version parametrized from command line nor gradle.properties, null otherwise
*/
fun getOverriddenKotlinApiVersion(project: Project): String? {
val apiVersion = project.rootProject.properties["kotlin_api_version"] as? String
if (apiVersion != null) {
LOGGER.info("""Configured Kotlin API version: '$apiVersion' for project $${project.name}""")
}
return apiVersion
}

/**
* Should be used for running against of non-released Kotlin compiler on a system test level
*
* @return a Kotlin Language version parametrized from command line nor gradle.properties, null otherwise
*/
fun getOverriddenKotlinLanguageVersion(project: Project): String? {
val languageVersion = project.rootProject.properties["kotlin_language_version"] as? String
if (languageVersion != null) {
LOGGER.info("""Configured Kotlin Language version: '$languageVersion' for project ${project.name}""")
}
return languageVersion
}

/**
* Should be used for running against of non-released Kotlin compiler on a system test level
* Kotlin compiler artifacts are expected to be downloaded from maven central by default.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
* 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.tasks.*
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")
val projectName = name
tasks.withType(KotlinCompile::class).all {
tasks.withType<KotlinCompile<*>>().configureEach {
val isMainTaskName = name == "compileKotlin" || name == "compileKotlinJvm"
kotlinOptions {
if (isMainTaskName) {
languageVersion = getOverriddenKotlinLanguageVersion(project)
apiVersion = getOverriddenKotlinApiVersion(project)
if (isMainTaskName && versionsAreNotOverridden) {
allWarningsAsErrors = true
}
val newOptions =
Expand All @@ -23,3 +26,6 @@ configure(subprojects) {
}
}
}

val KotlinCommonOptions.versionsAreNotOverridden: Boolean
get() = languageVersion == null && apiVersion == null