Build: enable -Werror in stdlib/core/compiler/plugins modules
Exclude modules where there are still warnings in an explicitly declared variable `tasksWithWarnings`. Also remove "-progressive" from compiler arguments in modules which are built with non-latest language version, as the warning about that leads to an error with -Werror.
This commit is contained in:
@@ -321,6 +321,23 @@ extra["compilerModulesForJps"] = listOf(
|
|||||||
":compiler:compiler.version"
|
":compiler:compiler.version"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// TODO: fix remaining warnings and remove this property.
|
||||||
|
extra["tasksWithWarnings"] = listOf(
|
||||||
|
":kotlin-stdlib:compileTestKotlin",
|
||||||
|
":kotlin-stdlib-jdk7:compileTestKotlin",
|
||||||
|
":kotlin-stdlib-jdk8:compileTestKotlin",
|
||||||
|
":compiler:frontend:compileKotlin",
|
||||||
|
":compiler:fir:tree:compileKotlin",
|
||||||
|
":compiler:fir:resolve:compileKotlin",
|
||||||
|
":compiler:fir:checkers:compileKotlin",
|
||||||
|
":compiler:fir:java:compileKotlin",
|
||||||
|
":plugins:uast-kotlin:compileKotlin",
|
||||||
|
":plugins:uast-kotlin:compileTestKotlin",
|
||||||
|
":plugins:uast-kotlin-idea:compileKotlin"
|
||||||
|
)
|
||||||
|
|
||||||
|
val tasksWithWarnings: List<String> by extra
|
||||||
|
|
||||||
val coreLibProjects = listOfNotNull(
|
val coreLibProjects = listOfNotNull(
|
||||||
":kotlin-stdlib",
|
":kotlin-stdlib",
|
||||||
":kotlin-stdlib-common",
|
":kotlin-stdlib-common",
|
||||||
@@ -454,6 +471,21 @@ allprojects {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
||||||
|
// 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 }
|
||||||
|
if (projectsWithWarningsAsErrors.any(projectDir::startsWith)) {
|
||||||
|
tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompile> {
|
||||||
|
if (path !in tasksWithWarnings) {
|
||||||
|
kotlinOptions {
|
||||||
|
allWarningsAsErrors = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType(VerificationTask::class.java as Class<Task>) {
|
tasks.withType(VerificationTask::class.java as Class<Task>) {
|
||||||
(this as VerificationTask).ignoreFailures = ignoreTestFailures
|
(this as VerificationTask).ignoreFailures = ignoreTestFailures
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,6 +10,8 @@ plugins {
|
|||||||
val compilerModules: Array<String> by rootProject.extra
|
val compilerModules: Array<String> by rootProject.extra
|
||||||
val otherCompilerModules = compilerModules.filter { it != path }
|
val otherCompilerModules = compilerModules.filter { it != path }
|
||||||
|
|
||||||
|
val tasksWithWarnings: List<String> by rootProject.extra
|
||||||
|
|
||||||
val effectSystemEnabled: Boolean by rootProject.extra
|
val effectSystemEnabled: Boolean by rootProject.extra
|
||||||
val newInferenceEnabled: Boolean by rootProject.extra
|
val newInferenceEnabled: Boolean by rootProject.extra
|
||||||
|
|
||||||
@@ -85,6 +87,16 @@ if (kotlinBuildProperties.isInJpsBuildIdeaSync) {
|
|||||||
idea {
|
idea {
|
||||||
this.module.generatedSourceDirs.add(generationRoot)
|
this.module.generatedSourceDirs.add(generationRoot)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
allprojects {
|
||||||
|
tasks.withType<KotlinCompile<*>> {
|
||||||
|
if (path !in tasksWithWarnings) {
|
||||||
|
kotlinOptions {
|
||||||
|
allWarningsAsErrors = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
projectTest(parallel = true) {
|
projectTest(parallel = true) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
languageVersion = "1.3"
|
languageVersion = "1.3"
|
||||||
apiVersion = "1.3"
|
apiVersion = "1.3"
|
||||||
freeCompilerArgs += "-Xskip-prerelease-check"
|
freeCompilerArgs = freeCompilerArgs - "-progressive" + "-Xskip-prerelease-check"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ ext.configureJavaOnlyJvm6Project = { Project project ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<String> tasksWithWarnings = (List<String>) rootProject.ext.get("tasksWithWarnings")
|
||||||
|
|
||||||
ext.configureJvm6Project = { Project project ->
|
ext.configureJvm6Project = { Project project ->
|
||||||
project.configure(project) {
|
project.configure(project) {
|
||||||
configurations {
|
configurations {
|
||||||
@@ -34,6 +36,14 @@ ext.configureJvm6Project = { Project project ->
|
|||||||
executable = "$JDK_16/bin/java"
|
executable = "$JDK_16/bin/java"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project.tasks.withType(org.jetbrains.kotlin.gradle.dsl.KotlinCompile.class) { task ->
|
||||||
|
if (!tasksWithWarnings.contains(task.path)) {
|
||||||
|
task.kotlinOptions {
|
||||||
|
allWarningsAsErrors = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ext.compileJava9Sources = { Project project, String moduleName, Collection<FileCollection> moduleOutputs = [project.sourceSets.main.output] ->
|
ext.compileJava9Sources = { Project project, String moduleName, Collection<FileCollection> moduleOutputs = [project.sourceSets.main.output] ->
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ tasks.withType<org.jetbrains.kotlin.gradle.dsl.KotlinCompile<*>> {
|
|||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
languageVersion = "1.3"
|
languageVersion = "1.3"
|
||||||
apiVersion = "1.3"
|
apiVersion = "1.3"
|
||||||
freeCompilerArgs += "-Xskip-metadata-version-check"
|
freeCompilerArgs = freeCompilerArgs - "-progressive" + "-Xskip-metadata-version-check"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user