[build] add checks to ensure that no modules which are part of the IDE plugin do not use experimental stdlib API

to ensure binary compatibility with stdlib inside IntelliJ.

This includes using the latest stable kotlin API version and
forbidding using experimental declarations from stdlib.

^KT-62510
This commit is contained in:
Ilya Kirillov
2023-10-11 19:27:29 +02:00
committed by Space Team
parent ded5cf2caa
commit a65c735feb
18 changed files with 670 additions and 1 deletions
@@ -114,6 +114,9 @@ fun Project.configureJavaBasePlugin() {
}
}
val projectsUsedInIntelliJKotlinPlugin: Array<String> by rootProject.extra
val kotlinApiVersionForProjectsUsedInIntelliJKotlinPlugin: String by rootProject.extra
fun Project.configureKotlinCompilationOptions() {
plugins.withType<KotlinBasePluginWrapper> {
val commonCompilerArgs = listOfNotNull(
@@ -152,6 +155,9 @@ fun Project.configureKotlinCompilationOptions() {
apiVersion = kotlinLanguageVersion
freeCompilerArgs += "-Xskip-prerelease-check"
}
if (project.path in projectsUsedInIntelliJKotlinPlugin) {
apiVersion = kotlinApiVersionForProjectsUsedInIntelliJKotlinPlugin
}
if (KotlinVersion.DEFAULT >= KotlinVersion.KOTLIN_2_0 && forced19) {
options.progressiveMode.set(false)
}
@@ -300,6 +300,14 @@ fun Project.idePluginDependency(block: () -> Unit) {
}
fun Project.publishJarsForIde(projects: List<String>, libraryDependencies: List<String> = emptyList()) {
val projectsUsedInIntelliJKotlinPlugin: Array<String> by rootProject.extra
for (projectName in projects) {
check(projectName in projectsUsedInIntelliJKotlinPlugin) {
"`$projectName` is used in IntelliJ Kotlin Plugin, it should be added to `extra[\"projectsUsedInIntelliJKotlinPlugin\"]`"
}
}
idePluginDependency {
publishProjectJars(projects, libraryDependencies)
}