aboutsummaryrefslogtreecommitdiff
path: root/build-logic/src/main/kotlin/org/jetbrains/DokkaVersion.kt
blob: 9028e8cf0c021d10fb246e93be47de1e9b7236e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/*
 * 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.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("-", ""))
    }