diff options
author | Marcin Aman <marcin.aman@gmail.com> | 2021-04-14 21:51:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-14 21:51:16 +0200 |
commit | 7bfab097f35f86bafbc2feff23e6658ad17da2ae (patch) | |
tree | 62528c2763cdb5bd02c8eeff17a772e22462051a /buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt | |
parent | 38270a3b8783857bd0bba4b9422b19b4de507e4c (diff) | |
download | dokka-7bfab097f35f86bafbc2feff23e6658ad17da2ae.tar.gz dokka-7bfab097f35f86bafbc2feff23e6658ad17da2ae.tar.bz2 dokka-7bfab097f35f86bafbc2feff23e6658ad17da2ae.zip |
Introduce binary compatibility plugin (#1774)
* Introduce binary compatibility plugin
* Update diffs
Diffstat (limited to 'buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt')
-rw-r--r-- | buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt b/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt new file mode 100644 index 00000000..fb686e1d --- /dev/null +++ b/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt @@ -0,0 +1,31 @@ +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) { + publicationName.takeIf { + it !in BinaryCompatibilityConfig.ignoredPublications + }?.let { + if (tasks.findByName("apiBuild") == null) { + plugins.apply(kotlinx.validation.BinaryCompatibilityValidatorPlugin::class.java) + configure<ApiValidationExtension> { + ignoredProjects.addAll( + BinaryCompatibilityConfig.ignoredSubprojects.intersect(allprojects.map { it.name }) + ) + } + } + } +}
\ No newline at end of file |