Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make embedKernel arguments nullable #132

Merged
merged 1 commit into from
Mar 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/main/kotlin/org/jetbrains/kotlinx/jupyter/ikotlin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,17 @@ fun main(vararg args: String) {
/**
* This function is to be run in projects which use kernel as a library,
* so we don't have a big need in covering it with tests
*
* The expected use case for this function is embedding into a Java application that doesn't necessarily support extensions written in Kotlin
* The signature of this function should thus be simple, and e.g. allow resolutionInfoProvider to be null instead of having to pass EmptyResolutionInfoProvider
* because EmptyResolutionInfoProvider is a Kotlin singleton object and it takes a while to understand how to use it from Java code.
*/
@Suppress("unused")
fun embedKernel(cfgFile: File, resolutionInfoProvider: ResolutionInfoProvider = EmptyResolutionInfoProvider, scriptReceivers: List<Any>? = null) {
fun embedKernel(cfgFile: File, resolutionInfoProvider: ResolutionInfoProvider?, scriptReceivers: List<Any>? = null) {
val cp = System.getProperty("java.class.path").split(File.pathSeparator).toTypedArray().map { File(it) }
val config = KernelConfig.fromConfig(
KernelJupyterParams.fromFile(cfgFile),
resolutionInfoProvider,
resolutionInfoProvider ?: EmptyResolutionInfoProvider,
cp,
null,
true
Expand Down