aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt
blob: 0b8386b61ec0326fb8264b37e02197b43dd15f49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.jetbrains

import kotlinx.validation.ApiValidationExtension
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure

internal object BinaryCompatibilityConfig {
    val ignoredPublications = setOf("kotlinAnalysisIntelliJ", "kotlinAnalysis", "kotlinAnalysisCompiler")
    val ignoredSubprojects = setOf(
        "search-component",
        "compiler-dependency",
        "intellij-dependency",
        "kotlin-analysis",
        "frontend"
    )
}

internal fun Project.registerBinaryCompatibilityCheck(publicationName: String) {
    if (publicationName !in BinaryCompatibilityConfig.ignoredPublications) {
        if (tasks.findByName("apiBuild") == null) {
            plugins.apply(kotlinx.validation.BinaryCompatibilityValidatorPlugin::class.java)
            configure<ApiValidationExtension> {
                ignoredProjects.addAll(
                    BinaryCompatibilityConfig.ignoredSubprojects.intersect(allprojects.map { it.name }.toSet())
                )
            }
        }
    }
}