org.jetbrains.kotlinx.jupyter.api.libraries.Scanning.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-jupyter-api Show documentation
Show all versions of kotlin-jupyter-api Show documentation
API for libraries supporting Kotlin Jupyter notebooks
package org.jetbrains.kotlinx.jupyter.api.libraries
import kotlinx.serialization.Serializable
import org.jetbrains.kotlinx.jupyter.api.TypeName
/**
* Path for all Kotlin Jupyter related stuff in library JARs
*/
const val KOTLIN_JUPYTER_RESOURCES_PATH = "META-INF/kotlin-jupyter-libraries"
/**
* Name of file in [KOTLIN_JUPYTER_RESOURCES_PATH] containing
* information about library definitions and providers inside JAR
*/
const val KOTLIN_JUPYTER_LIBRARIES_FILE_NAME = "libraries.json"
/**
* Entity inside library that may be instantiated to an object
* of type [T]
*/
interface LibrariesInstantiable {
/**
* FQN of this entity that is needed for instantiation
*/
val fqn: TypeName
}
/**
* Declaration of [LibraryDefinition] implementor
*
* @property fqn Implementor FQN
*/
@Serializable
data class LibrariesDefinitionDeclaration(
override val fqn: TypeName,
) : LibrariesInstantiable
/**
* Declaration of [LibraryDefinitionProducer] implementor
*
* @property fqn Implementor FQN
*/
@Serializable
data class LibrariesProducerDeclaration(
override val fqn: TypeName,
) : LibrariesInstantiable
/**
* Serialized form of this class instance is a correct content of
* [KOTLIN_JUPYTER_LIBRARIES_FILE_NAME] file, and vice versa.
*/
@Serializable
data class LibrariesScanResult(
val definitions: List = emptyList(),
val producers: List = emptyList(),
)