blob: c950fbbe061f4f29bac47f1ee4e92c0fb26be0b5 (
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
package org.jetbrains.dokka.dokkatoo.dokka.parameters
import org.jetbrains.dokka.Platform
/**
* The Kotlin
*
* @see org.jetbrains.dokka.Platform
* @param[displayName] The display name, eventually used in the rendered Dokka publication.
*/
enum class KotlinPlatform(
internal val displayName: String
) {
AndroidJVM("androidJvm"),
Common("common"),
JS("js"),
JVM("jvm"),
Native("native"),
WASM("wasm"),
;
companion object {
internal val values: Set<KotlinPlatform> = values().toSet()
val DEFAULT: KotlinPlatform = JVM
fun fromString(key: String): KotlinPlatform {
val keyMatch = values.firstOrNull {
it.name.equals(key, ignoreCase = true) || it.displayName.equals(key, ignoreCase = true)
}
if (keyMatch != null) {
return keyMatch
}
return when (key.lowercase()) {
"android" -> AndroidJVM
"metadata" -> Common
else -> error("Unrecognized platform: $key")
}
}
// Not defined as a property to try and minimize the dependency on Dokka Core types
internal val KotlinPlatform.dokkaType: Platform
get() =
when (this) {
AndroidJVM, JVM -> Platform.jvm
JS -> Platform.js
WASM -> Platform.wasm
Native -> Platform.native
Common -> Platform.common
}
}
}
|