diff options
Diffstat (limited to 'build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt')
-rw-r--r-- | build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt b/build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt deleted file mode 100644 index 293ae96b..00000000 --- a/build-logic/src/main/kotlin/org/jetbrains/ValidatePublications.kt +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2014-2023 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. - */ - -package org.jetbrains - -import org.gradle.api.DefaultTask -import org.gradle.api.GradleException -import org.gradle.api.Project -import org.gradle.api.artifacts.Dependency -import org.gradle.api.artifacts.ProjectDependency -import org.gradle.api.publish.PublishingExtension -import org.gradle.api.publish.maven.MavenPublication -import org.gradle.api.tasks.TaskAction -import org.gradle.kotlin.dsl.findByType - -open class ValidatePublications : DefaultTask() { - - init { - group = "verification" - project.tasks.named("check") { - dependsOn(this@ValidatePublications) - } - } - - @TaskAction - fun validatePublicationConfiguration() { - project.subprojects.forEach { subProject -> - val publishing = subProject.extensions.findByType<PublishingExtension>() ?: return@forEach - publishing.publications - .filterIsInstance<MavenPublication>() - .filter { it.version == project.dokkaVersion } - .forEach { _ -> - subProject.assertPublicationVersion() - } - } - } - - private fun Project.assertPublicationVersion() { - val versionTypeMatchesPublicationChannels = publicationChannels.all { publicationChannel -> - publicationChannel.acceptedDokkaVersionTypes.any { acceptedVersionType -> - acceptedVersionType == dokkaVersionType - } - } - if (!versionTypeMatchesPublicationChannels) { - throw AssertionError("Wrong version $dokkaVersion for configured publication channels $publicationChannels") - } - } -} |