diff options
Diffstat (limited to 'buildSrc')
-rw-r--r-- | buildSrc/build.gradle.kts | 1 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt | 31 | ||||
-rw-r--r-- | buildSrc/src/main/kotlin/org/jetbrains/publication.kt | 7 |
3 files changed, 35 insertions, 4 deletions
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 7a7b8f6a..764d5f48 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -10,4 +10,5 @@ repositories { dependencies { implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4") implementation("com.github.jengelman.gradle.plugins:shadow:2.0.4") + implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0") } 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 diff --git a/buildSrc/src/main/kotlin/org/jetbrains/publication.kt b/buildSrc/src/main/kotlin/org/jetbrains/publication.kt index 6c2f71a6..82102467 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/publication.kt +++ b/buildSrc/src/main/kotlin/org/jetbrains/publication.kt @@ -2,15 +2,13 @@ package org.jetbrains import com.github.jengelman.gradle.plugins.shadow.ShadowExtension import com.jfrog.bintray.gradle.BintrayExtension +import kotlinx.validation.ApiValidationExtension import org.gradle.api.Project import org.gradle.api.provider.Provider import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.publish.maven.tasks.PublishToMavenRepository -import org.gradle.kotlin.dsl.configure -import org.gradle.kotlin.dsl.get -import org.gradle.kotlin.dsl.register -import org.gradle.kotlin.dsl.withType +import org.gradle.kotlin.dsl.* import org.gradle.plugins.signing.SigningExtension import org.jetbrains.DokkaPublicationChannel.* import java.net.URI @@ -47,6 +45,7 @@ fun Project.registerDokkaArtifactPublication(publicationName: String, configure: configureBintrayPublicationIfNecessary(publicationName) configureSpacePublicationIfNecessary(publicationName) createDokkaPublishTaskIfNecessary() + registerBinaryCompatibilityCheck(publicationName) } fun Project.configureSpacePublicationIfNecessary(vararg publications: String) { |