-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add Gradle-like API for adding dependencies #382
Conversation
@@ -20,7 +20,7 @@ abstract class ScriptTemplateWithDisplayHelpers( | |||
|
|||
fun EXECUTE(code: String) = host.scheduleExecution(CodeExecution(code).toExecutionCallback()) | |||
|
|||
fun USE(library: LibraryDefinition) = host.addLibrary(library) | |||
fun USE(library: LibraryDefinition) = host.scheduleExecution { addLibrary(library) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we try to add library immediately, recursive execution happens - execution DURING another execution. We don't know how to handle it, because we use previous script instances for evaluation, and it's not clear what to do without them. So we just schedule the execution to the end of the current execution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not clear if this uses gradle resolver or maven resolver. It works differently for mpp libraries. I think the notation is great in any case, but if it uses maven resolver, there must be a warning about jvm
suffix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks neat!
I'm concerned about names too: it's not clear what |
maybe something like |
Let's choose something please |
@ileasile I think it is better to discuss in slack. Maybe a vote. I do not think that the outer scope should match how it looks in Gradle because people do not copy the whole block, they copy its contents. Also What about |
…ies code) via USE(). Add Gradle-like API for adding dependencies. Fix #367
Final version of API: USE {
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.config4k:config4k:0.4.2")
}
} Or in integration: internal class Integration : JupyterIntegration() {
override fun Builder.onLoaded() {
repositories {
mavenCentral()
}
dependencies {
implementation("io.github.config4k:config4k:0.4.2")
}
}
} |
Fix #367