From a383d45534d787c70e5d7ad224a7965e4adde262 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 21 Jul 2021 18:58:20 +0200 Subject: [PATCH] Disable -Werror if test.progressive.mode is enabled The reason is that when advancing language version, for example from 1.5 to 1.6, there is a brief period between bootstraps where the bootstrapped compiler has latest stable language version 1.6, yet the project is still built with 1.5. That leads to a (correct) warning that progressive mode makes no sense unless the latest language version is used, which fails the build because of Werror. When testing bootstrap in progressive mode, we don't actually care about these warnings, so disable Werror in this case. The only case where this could matter would be if we were introducing _warnings_ in progressive mode and checking that there are no new warnings on Kotlin would be important for us, but so far progressive mode has only been used to turn already existing warnings to errors. --- build.gradle.kts | 2 +- buildSrc/src/main/kotlin/BuildPropertiesExt.kt | 3 ++- buildSrc/src/main/kotlin/LibrariesCommon.kt | 4 ++-- compiler/build.gradle.kts | 4 +++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 75c368834be..b0301a4c104 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -481,7 +481,7 @@ allprojects { } } - if (!kotlinBuildProperties.isInJpsBuildIdeaSync && !kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) { + if (!kotlinBuildProperties.disableWerror) { // For compiler and stdlib, allWarningsAsErrors is configured in the corresponding "root" projects // (compiler/build.gradle.kts and libraries/commonConfiguration.gradle). val projectsWithWarningsAsErrors = listOf("core", "plugins").map { File(it).absoluteFile } diff --git a/buildSrc/src/main/kotlin/BuildPropertiesExt.kt b/buildSrc/src/main/kotlin/BuildPropertiesExt.kt index 170e1ff816e..68abaacd78e 100644 --- a/buildSrc/src/main/kotlin/BuildPropertiesExt.kt +++ b/buildSrc/src/main/kotlin/BuildPropertiesExt.kt @@ -19,7 +19,8 @@ val KotlinBuildProperties.jarCompression: Boolean get() = getBoolean("kotlin.bui val KotlinBuildProperties.ignoreTestFailures: Boolean get() = getBoolean("ignoreTestFailures", isTeamcityBuild) -val KotlinBuildProperties.disableWerror: Boolean get() = getBoolean("kotlin.build.disable.werror", false) +val KotlinBuildProperties.disableWerror: Boolean + get() = getBoolean("kotlin.build.disable.werror") || useFir || isInJpsBuildIdeaSync || getBoolean("test.progressive.mode") val KotlinBuildProperties.isObsoleteJdkOverrideEnabled: Boolean get() = getBoolean("kotlin.build.isObsoleteJdkOverrideEnabled", false) diff --git a/buildSrc/src/main/kotlin/LibrariesCommon.kt b/buildSrc/src/main/kotlin/LibrariesCommon.kt index 17645e79e0d..c8bdbfe7491 100644 --- a/buildSrc/src/main/kotlin/LibrariesCommon.kt +++ b/buildSrc/src/main/kotlin/LibrariesCommon.kt @@ -61,7 +61,7 @@ private class Java9AdditionalArgumentsProvider( } fun Project.disableDeprecatedJvmTargetWarning() { - if (!kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) { + if (!kotlinBuildProperties.disableWerror) { val tasksWithWarnings: List by rootProject.extra tasks.withType().configureEach { if (!tasksWithWarnings.contains(path)) { @@ -72,4 +72,4 @@ fun Project.disableDeprecatedJvmTargetWarning() { } } } -} \ No newline at end of file +} diff --git a/compiler/build.gradle.kts b/compiler/build.gradle.kts index 38fc5b42cb4..539dca8c7cd 100644 --- a/compiler/build.gradle.kts +++ b/compiler/build.gradle.kts @@ -85,7 +85,9 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) { idea { this.module.generatedSourceDirs.add(generationRoot) } -} else if (!kotlinBuildProperties.useFir && !kotlinBuildProperties.disableWerror) { +} + +if (!kotlinBuildProperties.disableWerror) { allprojects { tasks.withType> { if (path !in tasksWithWarnings) {