aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/org/jetbrains/DokkaVersion.kt
blob: 517c7731536c0edf92700c03e5a603bedf5cf542 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package org.jetbrains

import org.gradle.api.Project
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.provideDelegate

@Suppress("LocalVariableName") // property name with underscore as taken from gradle.properties
fun Project.configureDokkaVersion(): String {
    val dokka_version: String? by this.extra
    return checkNotNull(dokka_version)
}

val Project.dokkaVersion: String
    get() = configureDokkaVersion()

val Project.dokkaVersionType: DokkaVersionType?
    get() = DokkaVersionType.values().find {
        it.suffix.matches(dokkaVersion.substringAfter("-", ""))
    }