org.jetbrains.dokka.analysis.resolve.DokkaNativeKlibLibraryInfo.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dokka-analysis Show documentation
Show all versions of dokka-analysis Show documentation
Dokka is an API documentation engine for Kotlin and Java, performing the same function as Javadoc for Java
package org.jetbrains.dokka.analysis.resolve
import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.descriptors.ModuleCapability
import org.jetbrains.kotlin.descriptors.konan.DeserializedKlibModuleOrigin
import org.jetbrains.kotlin.descriptors.konan.KlibModuleOrigin
import org.jetbrains.kotlin.idea.klib.safeRead
import org.jetbrains.kotlin.library.KotlinLibrary
import org.jetbrains.kotlin.library.isInterop
import org.jetbrains.kotlin.library.shortName
import org.jetbrains.kotlin.library.uniqueName
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.platform.konan.NativePlatforms
import org.jetbrains.kotlin.resolve.ImplicitIntegerCoercion
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
/** TODO: replace by [NativeKlibLibraryInfo] after fix of KT-40734 */
internal class DokkaNativeKlibLibraryInfo(
override val kotlinLibrary: KotlinLibrary,
override val analyzerServices: PlatformDependentAnalyzerServices,
private val dependencyResolver: DokkaKlibLibraryDependencyResolver
) : DokkaKlibLibraryInfo() {
init {
dependencyResolver.registerLibrary(this)
}
override val name: Name by lazy {
val libraryName = kotlinLibrary.shortName ?: kotlinLibrary.uniqueName
Name.special("<$libraryName>")
}
override val platform: TargetPlatform = NativePlatforms.unspecifiedNativePlatform
override fun dependencies(): List = listOf(this) + dependencyResolver.resolveDependencies(this)
override fun getLibraryRoots(): Collection = listOf(libraryRoot)
override val capabilities: Map, Any?>
get() {
val capabilities = super.capabilities.toMutableMap()
capabilities[KlibModuleOrigin.CAPABILITY] = DeserializedKlibModuleOrigin(kotlinLibrary)
capabilities[ImplicitIntegerCoercion.MODULE_CAPABILITY] = kotlinLibrary.safeRead(false) { isInterop }
return capabilities
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy