aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src
diff options
context:
space:
mode:
authorGoooler <wangzongler@gmail.com>2022-03-22 22:17:13 +0800
committerGitHub <noreply@github.com>2022-03-22 17:17:13 +0300
commitdd0fd03ea37554d79a02a8c6bcfd5f081dc6a1e1 (patch)
treebe9fc5302df94e3f12458151e03b338529159bc4 /buildSrc/src
parent36d45997da093eabfb711fef3628a61948399496 (diff)
downloaddokka-dd0fd03ea37554d79a02a8c6bcfd5f081dc6a1e1.tar.gz
dokka-dd0fd03ea37554d79a02a8c6bcfd5f081dc6a1e1.tar.bz2
dokka-dd0fd03ea37554d79a02a8c6bcfd5f081dc6a1e1.zip
Remove bintray publish plugins (#2364)
* Bump binary-compatibility-validator to 0.8.0
Diffstat (limited to 'buildSrc/src')
-rw-r--r--buildSrc/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt15
-rw-r--r--buildSrc/src/main/kotlin/org/jetbrains/ValidatePublications.kt20
-rw-r--r--buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt6
-rw-r--r--buildSrc/src/main/kotlin/org/jetbrains/publication.kt48
4 files changed, 2 insertions, 87 deletions
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)
}
}