Replace useJupyter with jupyterLibrary

This commit is contained in:
Alexander Nozik 2021-09-12 22:06:08 +03:00
parent 6fa4b264a2
commit 878405ac6a
3 changed files with 27 additions and 16 deletions

View File

@ -1,14 +1,14 @@
[versions] [versions]
atomicfu = "0.16.2" atomicfu = "0.16.2"
binary-compatibility-validator = "0.6.0" binary-compatibility-validator = "0.7.1"
changelog = "1.2.1" changelog = "1.3.0"
dokka = "1.5.0" dokka = "1.5.0"
kotlin = "1.5.30" kotlin = "1.5.30"
kotlin-jupyter = "0.10.0-184" kotlin-jupyter = "0.10.0-227"
kotlinx-benchmark = "0.3.1" kotlinx-benchmark = "0.3.1"
kotlinx-cli = "0.3.2" kotlinx-cli = "0.3.2"
kotlinx-collections-immutable = "0.3.4" kotlinx-collections-immutable = "0.3.4"
kotlinx-coroutines = "1.5.1" kotlinx-coroutines = "1.5.2"
kotlinx-datetime = "0.2.1" kotlinx-datetime = "0.2.1"
kotlinx-html = "0.7.3" kotlinx-html = "0.7.3"
kotlinx-knit = "0.2.3" kotlinx-knit = "0.2.3"
@ -16,7 +16,7 @@ kotlinx-nodejs = "0.0.7"
kotlinx-serialization = "1.3.0-RC" kotlinx-serialization = "1.3.0-RC"
ktor = "1.6.3" ktor = "1.6.3"
tools = "0.10.3" tools = "0.10.3"
xmlutil = "0.82.0" xmlutil = "0.83.0"
yamlkt = "0.10.2" yamlkt = "0.10.2"
jsBom = "0.0.1-pre.243-kotlin-1.5.30" jsBom = "0.0.1-pre.243-kotlin-1.5.30"

View File

@ -4,13 +4,13 @@ import kotlinx.atomicfu.plugin.gradle.AtomicFUGradlePlugin
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.plugins.ApplicationPlugin import org.gradle.api.plugins.ApplicationPlugin
import org.gradle.kotlin.dsl.apply import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.findByType import org.gradle.kotlin.dsl.findByType
import org.gradle.kotlin.dsl.withType import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
import ru.mipt.npm.gradle.internal.defaultPlatform import ru.mipt.npm.gradle.internal.defaultPlatform
import ru.mipt.npm.gradle.internal.useCommonDependency import ru.mipt.npm.gradle.internal.useCommonDependency
import ru.mipt.npm.gradle.internal.useFx import ru.mipt.npm.gradle.internal.useFx
@ -135,10 +135,21 @@ public class KScienceExtension(public val project: Project) {
/** /**
* Apply jupyter plugin * Apply jupyter plugin
*/ */
@Deprecated("Use jupyterLibrary")
public fun useJupyter() { public fun useJupyter() {
project.apply("org.jetbrains.kotlin.jupyter.api") project.apply("org.jetbrains.kotlin.jupyter.api")
} }
/**
* Apply jupyter plugin and add entry point for the jupyter library
*/
public fun jupyterLibrary(pluginClass: String, vararg additionalPluginClasses: String) {
project.apply("org.jetbrains.kotlin.jupyter.api")
project.tasks.named("processJupyterApiResources", JupyterApiResourcesTask::class.java) {
libraryProducers = listOf(pluginClass, *additionalPluginClasses)
}
}
/** /**
* Mark this module as an application module. JVM application should be enabled separately * Mark this module as an application module. JVM application should be enabled separately
*/ */

View File

@ -65,15 +65,15 @@ public class KSciencePublishingExtension(public val project: Project) {
* *
* @param githubProject the GitHub project. * @param githubProject the GitHub project.
* @param githubOrg the GitHub user or organization. * @param githubOrg the GitHub user or organization.
* @param released whether publish packages in the `release` task to the GitHub repository. * @param release whether publish packages in the `release` task to the GitHub repository.
*/ */
public fun github(githubProject: String, githubOrg: String = "mipt-npm", released: Boolean = false, published: Boolean = true) { public fun github(githubProject: String, githubOrg: String = "mipt-npm", release: Boolean = false, publish: Boolean = true) {
// Automatically initialize VCS using GitHub // Automatically initialize VCS using GitHub
if (!isVcsInitialized) if (!isVcsInitialized)
git("https://github.com/$githubOrg/${githubProject}", "https://github.com/$githubOrg/${githubProject}.git") git("https://github.com/$githubOrg/${githubProject}", "https://github.com/$githubOrg/${githubProject}.git")
if (published) project.addGithubPublishing(githubOrg, githubProject) if (publish) project.addGithubPublishing(githubOrg, githubProject)
if (released) linkPublicationsToReleaseTask("github") if (release) linkPublicationsToReleaseTask("github")
} }
private val releaseTask by lazy { private val releaseTask by lazy {
@ -84,13 +84,13 @@ public class KSciencePublishingExtension(public val project: Project) {
* Adds Space Packages Maven repository to publishing. * Adds Space Packages Maven repository to publishing.
* *
* @param spaceRepo the repository URL. * @param spaceRepo the repository URL.
* @param released whether publish packages in the `release` task to the Space repository. * @param release whether publish packages in the `release` task to the Space repository.
*/ */
public fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", released: Boolean = false) { public fun space(spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/sci/maven", release: Boolean = true) {
require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" } require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" }
project.addSpacePublishing(spaceRepo) project.addSpacePublishing(spaceRepo)
if (released) linkPublicationsToReleaseTask("space") if (release) linkPublicationsToReleaseTask("space")
} }
// // Bintray publishing // // Bintray publishing
@ -102,13 +102,13 @@ public class KSciencePublishingExtension(public val project: Project) {
/** /**
* Adds Sonatype Maven repository to publishing. * Adds Sonatype Maven repository to publishing.
* *
* @param released whether publish packages in the `release` task to the Sonatype repository. * @param release whether publish packages in the `release` task to the Sonatype repository.
*/ */
public fun sonatype(released: Boolean = true) { public fun sonatype(release: Boolean = true) {
require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" } require(isVcsInitialized) { "The project vcs is not set up use 'vcs' method to do so" }
project.addSonatypePublishing() project.addSonatypePublishing()
if (released) linkPublicationsToReleaseTask("sonatype") if (release) linkPublicationsToReleaseTask("sonatype")
} }
} }