aboutsummaryrefslogtreecommitdiff
path: root/buildSrc/src/main/kotlin/org/jetbrains/DokkaPublicationChannel.kt
blob: 05593b40c2897c6e07804331ceb30ad8967c24f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package org.jetbrains

import org.gradle.api.GradleException
import org.gradle.api.Project
import org.gradle.kotlin.dsl.provideDelegate
import org.jetbrains.DokkaPublicationChannel.*

internal enum class DokkaPublicationChannel {
    SpaceDokkaDev,
    BintrayKotlinDev,
    BintrayKotlinEap,
    BintrayKotlinDokka;

    val isSpaceRepository get() = this == SpaceDokkaDev

    val isBintrayRepository
        get() = when (this) {
            SpaceDokkaDev -> false
            BintrayKotlinDev, BintrayKotlinEap, BintrayKotlinDokka -> true
        }
}

internal val Project.publicationChannel: DokkaPublicationChannel
    get() {
        val dokka_publication_channel: String by this
        return when (dokka_publication_channel) {
            "space-dokka-dev" -> SpaceDokkaDev
            "bintray-kotlin-dev" -> BintrayKotlinDev
            "bintray-kotlin-eap" -> BintrayKotlinEap
            "bintray-kotlin-dokka" -> BintrayKotlinDokka
            else -> throw GradleException("Unknown dokka_publication_channel=$dokka_publication_channel")
        }
    }