Function to fix miscellaneous shit in kotlin compiler

This commit is contained in:
Andrew Golovashevich 2024-11-12 02:50:51 +03:00
parent abfd205cf6
commit 5bbaa5d834

View File

@ -0,0 +1,22 @@
package ru.landgrafhomyak.kotlin.kmp_gradle_build_helper
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
public enum class Improvements {
JAVA_INTERFACES_DEFAULT_METHODS {
// since kotlin 1.4
override fun fix(target: KotlinMultiplatformExtension) {
target.configureAllCompilersOptions { freeCompilerArgs.add("-Xjvm-default=all") }
}
};
internal abstract fun fix(target: KotlinMultiplatformExtension)
}
public fun KotlinMultiplatformExtension.fixAllStrangeBehavioursExcept(vararg except: Improvements) {
(Improvements.values().toSet() - except.toSet()).forEach { f -> f.fix(this) }
}
public fun KotlinMultiplatformExtension.fixAllStrangeBehaviours(): Unit = this.fixAllStrangeBehavioursExcept()