Tweak module exclusion filter for -Xjvm-default=all

- Remove obsolete exclusion of core & stdlib modules, since they are now
  compiled with JVM target 1.8, but leave `:core:descriptors` because of
  an issue in Proguard.
- Remove binary-compatibility-validator and update test data instead.
- Replace some "contains" checks with equality for clarity.
- Remove modules from -Werror filter which no longer use the deprecated
  compatibility mode.
This commit is contained in:
Alexander Udalov
2022-09-05 13:45:56 +02:00
parent c168a19a58
commit b158ece232
4 changed files with 19 additions and 47 deletions
@@ -158,10 +158,6 @@ fun Project.configureKotlinCompilationOptions() {
// TODO: fix remaining warnings and remove this property.
val tasksWithWarnings = listOf(
":kotlin-gradle-plugin:compileCommonKotlin",
// Temporarily disable -Werror for the following modules because of deprecation warning for `-Xjvm-default=compatibility`.
// These modules should be removed after they are migrated to `-Xjvm-default=all/all-compatibility`.
":compiler:frontend:compileKotlin",
":kotlin-scripting-intellij:compileKotlin",
)
val projectsWithEnabledContextReceivers: List<String> by rootProject.extra
@@ -190,23 +186,7 @@ fun Project.configureKotlinCompilationOptions() {
if (project.path in projectsWithEnabledContextReceivers) {
freeCompilerArgs += "-Xcontext-receivers"
}
//TODO: migrate modules to defaults
//TODO: different gradle versions bundle different Kotlin compilers, not all of them support defaults
if (!project.path.contains("-gradle") &&
!project.path.contains("kotlin-project-model") &&
!project.path.contains(":binary-compatibility-validator") &&
!project.path.contains("runtime") &&
//TODO: tune performance in tree and tree.impl modules
!project.path.contains(":compiler:ir.tree") &&
//HACK: filter modules with JVM target 1.6
//TODO: remove after removing 1.6 target
!project.path.startsWith(":core") &&
!project.path.startsWith(":kotlin-stdlib") &&
!project.path.startsWith(":kotlinx-metadata") &&
!project.path.startsWith(":kotlin-scripting") &&
!project.path.startsWith(":compiler:tests-common-jvm6")
) {
if (!skipJvmDefaultAllForModule(project.path)) {
freeCompilerArgs += "-Xjvm-default=all"
}
}
@@ -268,3 +248,18 @@ fun Project.configureTests() {
apply(from = "$rootDir/gradle/testRetry.gradle.kts")
}
}
// TODO: migrate remaining modules to the new JVM default scheme.
fun skipJvmDefaultAllForModule(path: String): Boolean =
// Gradle plugin modules are disabled because different Gradle versions bundle different Kotlin compilers,
// and not all of them support the new JVM default scheme.
"-gradle" in path || "-runtime" in path || path == ":kotlin-project-model" ||
// Visitor/transformer interfaces in ir.tree are very sensitive to the way interface methods are implemented.
// Enabling default method generation results in a performance loss of several % on full pipeline test on Kotlin.
// TODO: investigate the performance difference and enable new mode for ir.tree.
path == ":compiler:ir.tree" ||
// Workaround a Proguard issue:
// java.lang.IllegalAccessError: tried to access method kotlin.reflect.jvm.internal.impl.types.checker.ClassicTypeSystemContext$substitutionSupertypePolicy$2.<init>(
// Lkotlin/reflect/jvm/internal/impl/types/checker/ClassicTypeSystemContext;Lkotlin/reflect/jvm/internal/impl/types/TypeSubstitutor;
// )V from class kotlin.reflect.jvm.internal.impl.resolve.OverridingUtilTypeSystemContext
path == ":core:descriptors"