diff options
Diffstat (limited to 'buildSrc')
5 files changed, 3 insertions, 89 deletions
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 7234f33f..ade06b2c 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -7,8 +7,7 @@ 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.6.0") + implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.8.0") implementation("io.github.gradle-nexus:publish-plugin:1.0.0") } diff --git a/buildSrc/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt b/buildSrc/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt index c4f22a90..6b78edba 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt +++ b/buildSrc/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt @@ -6,20 +6,11 @@ import org.gradle.api.Project enum class DokkaPublicationChannel { SpaceDokkaDev, - BintrayKotlinDev, - BintrayKotlinEap, - BintrayKotlinDokka, MavenCentral, MavenCentralSnapshot; val isSpaceRepository get() = this == SpaceDokkaDev - val isBintrayRepository - get() = when (this) { - BintrayKotlinDev, BintrayKotlinEap, BintrayKotlinDokka -> true - else -> false - } - val isMavenRepository get() = when (this) { MavenCentral, MavenCentralSnapshot -> true @@ -31,17 +22,11 @@ enum class DokkaPublicationChannel { MavenCentral -> listOf(DokkaVersionType.Release) MavenCentralSnapshot -> listOf(DokkaVersionType.Snapshot) SpaceDokkaDev -> listOf(DokkaVersionType.Release, DokkaVersionType.Dev, DokkaVersionType.MC, DokkaVersionType.Snapshot) - BintrayKotlinDev -> listOf(DokkaVersionType.Dev, DokkaVersionType.MC, DokkaVersionType.Snapshot) - BintrayKotlinEap -> listOf(DokkaVersionType.MC) - BintrayKotlinDokka -> listOf(DokkaVersionType.Release) } companion object { fun fromPropertyString(value: String): DokkaPublicationChannel = when (value) { "space-dokka-dev" -> SpaceDokkaDev - "bintray-kotlin-dev" -> BintrayKotlinDev - "bintray-kotlin-eap" -> BintrayKotlinEap - "bintray-kotlin-dokka" -> BintrayKotlinDokka "maven-central-release" -> MavenCentral "maven-central-snapshot" -> MavenCentralSnapshot else -> throw IllegalArgumentException("Unknown dokka_publication_channel=$value") diff --git a/buildSrc/src/main/kotlin/org/jetbrains/ValidatePublications.kt b/buildSrc/src/main/kotlin/org/jetbrains/ValidatePublications.kt index f5f515e5..921ec025 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/ValidatePublications.kt +++ b/buildSrc/src/main/kotlin/org/jetbrains/ValidatePublications.kt @@ -1,6 +1,5 @@ package org.jetbrains -import com.jfrog.bintray.gradle.BintrayExtension import org.gradle.api.DefaultTask import org.gradle.api.GradleException import org.gradle.api.Project @@ -9,12 +8,8 @@ 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 -import org.gradle.kotlin.dsl.provideDelegate open class ValidatePublications : DefaultTask() { - class MissingBintrayPublicationException(project: Project, publication: MavenPublication) : GradleException( - "Project ${project.path} has publication ${publication.name} that is not configured for bintray publication" - ) class UnpublishedProjectDependencyException( project: Project, dependencyProject: Project @@ -32,27 +27,12 @@ open class ValidatePublications : DefaultTask() { .filterIsInstance<MavenPublication>() .filter { it.version == project.dokkaVersion } .forEach { publication -> - if (project.publicationChannels.any { it.isBintrayRepository }) { - checkPublicationIsConfiguredForBintray(subProject, publication) - } checkProjectDependenciesArePublished(subProject) subProject.assertPublicationVersion() } } } - private fun checkPublicationIsConfiguredForBintray(project: Project, publication: MavenPublication) { - val bintrayExtension = project.extensions.findByType<BintrayExtension>() - ?: throw MissingBintrayPublicationException(project, publication) - - val isPublicationConfiguredForBintray = bintrayExtension.publications.orEmpty() - .any { publicationName -> publicationName == publication.name } - - if (!isPublicationConfiguredForBintray) { - throw MissingBintrayPublicationException(project, publication) - } - } - private fun checkProjectDependenciesArePublished(project: Project) { (project.configurations.findByName("implementation")?.allDependencies.orEmpty() + project.configurations.findByName("api")?.allDependencies.orEmpty()) diff --git a/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt b/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt index fb686e1d..0b8386b6 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt +++ b/buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt @@ -16,14 +16,12 @@ internal object BinaryCompatibilityConfig { } internal fun Project.registerBinaryCompatibilityCheck(publicationName: String) { - publicationName.takeIf { - it !in BinaryCompatibilityConfig.ignoredPublications - }?.let { + 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 }) + BinaryCompatibilityConfig.ignoredSubprojects.intersect(allprojects.map { it.name }.toSet()) ) } } diff --git a/buildSrc/src/main/kotlin/org/jetbrains/publication.kt b/buildSrc/src/main/kotlin/org/jetbrains/publication.kt index bb4f3ad3..c3fc2ac7 100644 --- a/buildSrc/src/main/kotlin/org/jetbrains/publication.kt +++ b/buildSrc/src/main/kotlin/org/jetbrains/publication.kt @@ -1,8 +1,6 @@ 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.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication @@ -10,7 +8,6 @@ import org.gradle.api.publish.maven.tasks.PublishToMavenRepository import org.gradle.kotlin.dsl.* import org.gradle.plugins.signing.SigningExtension import org.jetbrains.DokkaPublicationChannel.* -import io.github.gradlenexus.publishplugin.NexusPublishExtension import java.net.URI class DokkaPublicationBuilder { @@ -42,7 +39,6 @@ fun Project.registerDokkaArtifactPublication(publicationName: String, configure: } } - configureBintrayPublicationIfNecessary(publicationName) configureSpacePublicationIfNecessary(publicationName) configureSonatypePublicationIfNecessary(publicationName) createDokkaPublishTaskIfNecessary() @@ -88,50 +84,6 @@ fun Project.createDokkaPublishTaskIfNecessary() { if (publicationChannels.any { it.isMavenRepository }) { dependsOn(tasks.named("publishToSonatype")) } - - if (publicationChannels.any { it.isBintrayRepository }) { - dependsOn(tasks.named("bintrayUpload")) - } - } -} - -fun Project.configureBintrayPublicationIfNecessary(vararg publications: String) { - if (publicationChannels.any { it.isBintrayRepository }) { - configureBintrayPublication(*publications) - } -} - -private fun Project.configureBintrayPublication(vararg publications: String) { - extensions.configure<BintrayExtension>("bintray") { - user = System.getenv("BINTRAY_USER") - key = System.getenv("BINTRAY_KEY") - dryRun = System.getenv("BINTRAY_DRY_RUN") == "true" || - project.properties["bintray_dry_run"] == "true" - pkg = PackageConfig().apply { - val bintrayPublicationChannels = publicationChannels.filter { it.isBintrayRepository } - if (bintrayPublicationChannels.size > 1) { - throw IllegalArgumentException( - "Only a single bintray repository can be used for publishing at once. Found $publicationChannels" - ) - } - - repo = when (bintrayPublicationChannels.single()) { - SpaceDokkaDev, MavenCentral, MavenCentralSnapshot -> throw IllegalStateException("${bintrayPublicationChannels.single()} is not a bintray repository") - BintrayKotlinDev -> "kotlin-dev" - BintrayKotlinEap -> "kotlin-eap" - BintrayKotlinDokka -> "dokka" - } - - name = "dokka" - userOrg = "kotlin" - desc = "Dokka, the Kotlin documentation tool" - vcsUrl = "https://github.com/kotlin/dokka.git" - setLicenses("Apache-2.0") - version = VersionConfig().apply { - name = dokkaVersion - } - } - setPublications(*publications) } } |