diff --git a/RELEASE_CHECK_LIST.md b/RELEASE_CHECK_LIST.md index ca8969f482..193fb76679 100644 --- a/RELEASE_CHECK_LIST.md +++ b/RELEASE_CHECK_LIST.md @@ -1,36 +1,36 @@ **Release activities check-list for releases:** -0. Run code inspections (fix typos, Kotlin issues, fix code formatting, linter) -1. Write missed KDocs for new APIs -2. Update tutorials according to last code changes -3. Update README.MD according last code changes +1. Run code inspections (fix typos, Kotlin issues, fix code formatting, linter) +2. Write missed KDocs for new APIs +3. Update tutorials according to last code changes +4. Update README.MD according last code changes - update an artifact version - update a Kotlin version - update the [section](README.md#kotlin-kotlin-jupyter-openapi-arrow-and-jdk-versions) about library versions -4. Update a project version in the file `gradle.properties` (i.e. 0.9.0 -> 0.10.0) +5. Update a project version in the file `gradle.properties` (i.e. 0.9.0 -> 0.10.0) - For major releases: update a project version in the file [`v.list`](https://github.com/Kotlin/dataframe/blame/master/docs/StardustDocs/v.list) - For major releases: update a project version in the file [`main.yml`](https://github.com/Kotlin/dataframe/blob/master/.github/workflows/main.yml) - For major releases: update a project version in the file [`project.ihp`](https://github.com/Kotlin/dataframe/blob/master/docs/StardustDocs/project.ihp) -5. Update `libs.versions.toml` file if required -6. Create and checkout the release branch -7. Make last commit with release tag (_v0.1.1_ for example) to the release branch -8. Run tests and build artifacts on TC for the commit with the release tag -9. Deploy artifacts on MavenCentral via `Publish` task running on TC based on the commit with the release tag -10. Check artifacts' availability on [MavenCentral](https://mvnrepository.com/artifact/org.jetbrains.kotlinx/dataframe) -11. Check [Gradle Plugin portal availability](https://plugins.gradle.org/plugin/org.jetbrains.kotlinx.dataframe/) (usually it takes 12 hours) -12. Update a bootstrap dependency version in the `libs.versions.toml` file (only after the plugin's publication) -13. Make final testing +6. Update `libs.versions.toml` file if required, run `./gradlew dependencyUpdates` to check for updates +7. Create and checkout the release branch +8. Make last commit with release tag (_v0.1.1_ for example) to the release branch +9. Run tests and build artifacts on TC for the commit with the release tag +10. Deploy artifacts on MavenCentral via `Publish` task running on TC based on the commit with the release tag +11. Check artifacts' availability on [MavenCentral](https://mvnrepository.com/artifact/org.jetbrains.kotlinx/dataframe) +12. Check [Gradle Plugin portal availability](https://plugins.gradle.org/plugin/org.jetbrains.kotlinx.dataframe/) (usually it takes 12 hours) +13. Update a bootstrap dependency version in the `libs.versions.toml` file (only after the plugin's publication) +14. Make final testing - Check on Datalore with a test project (TODO: add link) - Check for Android with a test project (TODO: add link) - Check for ServerSide with a test project (TODO: add link) -14. Publish Documentation from [GitHub Action](https://github.com/Kotlin/dataframe/actions/workflows/main.yml) -15. Prepare and publish the Release Notes -16. Create Release from the release tag on GitHub -17. Update a KDF version in the [Kotlin Jupyter Descriptor](https://github.com/Kotlin/kotlin-jupyter-libraries/blob/master/dataframe.json). Now the Renovate bot doing this -18. Update DataFrame version in the `gradle.properties` file for the next release cycle (i.e. 0.10.0 -> 0.11.0) -19. Update deprecated functions in [deprecationMessages.kt](/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt) +15. Publish Documentation from [GitHub Action](https://github.com/Kotlin/dataframe/actions/workflows/main.yml) +16. Prepare and publish the Release Notes +17. Create Release from the release tag on GitHub +18. Update a KDF version in the [Kotlin Jupyter Descriptor](https://github.com/Kotlin/kotlin-jupyter-libraries/blob/master/dataframe.json). Now the Renovate bot doing this +19. Update DataFrame version in the `gradle.properties` file for the next release cycle (i.e. 0.10.0 -> 0.11.0) +20. Update deprecated functions in [deprecationMessages.kt](/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt) such that - `Level.WARNING` messages are changed to `Level.ERROR` - `Level.ERROR` messages and their functions are removed. - Update regions in the file accordingly. -20. Update Notebook examples, both in the project and on Datalore. +21. Update Notebook examples, both in the project and on Datalore. diff --git a/build.gradle.kts b/build.gradle.kts index eea996ca8b..b66b7783ef 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,23 +1,32 @@ +import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import org.jetbrains.kotlin.gradle.tasks.KotlinCompile -import org.jetbrains.kotlin.tooling.core.closure +import org.jetbrains.kotlinx.dataframe.AnyFrame +import org.jetbrains.kotlinx.dataframe.DataFrame +import org.jetbrains.kotlinx.dataframe.api.filter +import org.jetbrains.kotlinx.dataframe.api.print +import org.jetbrains.kotlinx.dataframe.api.select +import org.jetbrains.kotlinx.dataframe.io.readJson import org.jetbrains.kotlinx.publisher.apache2 import org.jetbrains.kotlinx.publisher.developer import org.jetbrains.kotlinx.publisher.githubRepo -import org.jmailen.gradle.kotlinter.KotlinterExtension -@Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage") plugins { - kotlin("jvm") version libs.versions.kotlin - kotlin("libs.publisher") version libs.versions.libsPublisher - kotlin("plugin.serialization") version libs.versions.kotlin - id("org.jetbrains.kotlinx.dataframe") version libs.versions.dataframe apply false - kotlin("jupyter.api") version libs.versions.kotlinJupyter apply false - - id("org.jetbrains.dokka") version libs.versions.dokka - id("org.jetbrains.kotlinx.kover") version libs.versions.kover - id("org.jmailen.kotlinter") version libs.versions.ktlint - id("nl.jolanrensen.docProcessor") version libs.versions.docProcessor apply false - id("xyz.ronella.simple-git") version libs.versions.simpleGit apply false + with(libs.plugins) { + alias(kotlin.jvm) + alias(publisher) + alias(serialization) + alias(jupyter.api) apply false + alias(dokka) + alias(kover) + alias(kotlinter) + alias(docProcessor) apply false + alias(simpleGit) apply false + alias(dependencyVersions) + + // dependence on our own plugin + alias(dataframe) apply false + alias(ksp) apply false + } } val jupyterApiTCRepo: String by project @@ -42,6 +51,78 @@ dependencies { api(project(":dataframe-jdbc")) } +private enum class Version : Comparable { + SNAPSHOT, DEV, ALPHA, BETA, RC, STABLE; +} + +private fun String.findVersion(): Version { + val version = this.lowercase() + return when { + "snapshot" in version -> Version.SNAPSHOT + "dev" in version -> Version.DEV + "alpha" in version -> Version.ALPHA + "beta" in version -> Version.BETA + "rc" in version -> Version.RC + else -> Version.STABLE + } +} + +// these names of outdated dependencies will not show up in the table output +val dependencyUpdateExclusions = listOf( + // 5.6 requires Java 11 + libs.klaxon.get().name, + // TODO Requires more work to be updated to 1.7.0+, https://github.com/Kotlin/dataframe/issues/594 + libs.plugins.kover.get().pluginId, + // TODO Updating requires major changes all across the project, https://github.com/Kotlin/dataframe/issues/364 + libs.plugins.kotlinter.get().pluginId, + // TODO 5.8.0 is not possible due to https://github.com/Kotlin/dataframe/issues/595 + libs.kotestAssertions.get().name, + // Can't be updated to 7.4.0+ due to Java 8 compatibility + libs.android.gradle.api.get().group, + // TODO 1.9.10 requires korro and docProcessor to update, https://github.com/Kotlin/dataframe/issues/596 + libs.plugins.dokka.get().pluginId, + // Directly dependent on the Gradle version + "org.gradle.kotlin.kotlin-dsl", +) + +// run `./gradlew dependencyUpdates` to check for updates +tasks.named("dependencyUpdates").configure { + checkForGradleUpdate = true + outputFormatter = "json,html" + revision = "milestone" + + rejectVersionIf { + val current = currentVersion.findVersion() + val candidate = candidate.version.findVersion() + candidate < current + } + + doLast { + val outputFile = layout.buildDirectory + .file("../$outputDir/$reportfileName.json") + .get().asFile + when (val outDatedDependencies = DataFrame.readJson(outputFile)["outdated"]["dependencies"][0]) { + is AnyFrame -> { + val df = outDatedDependencies.select { + cols("group", "name", "version") and { + "available"["milestone"] named "newVersion" + } + }.filter { "name"() !in dependencyUpdateExclusions && "group"() !in dependencyUpdateExclusions } + logger.warn("Outdated dependencies found:") + df.print( + rowsLimit = Int.MAX_VALUE, + valueLimit = Int.MAX_VALUE, + borders = true, + title = true, + alignLeft = true, + ) + } + + else -> logger.info("No outdated dependencies found") + } + } +} + allprojects { tasks.withType { kotlinOptions { diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 2659ccffbd..196eaba1cb 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -1,27 +1,32 @@ -import com.google.devtools.ksp.gradle.KspTaskJvm import com.google.devtools.ksp.gradle.KspTask +import com.google.devtools.ksp.gradle.KspTaskJvm import io.github.devcrocod.korro.KorroTask -import nl.jolanrensen.docProcessor.defaultProcessors.* +import nl.jolanrensen.docProcessor.defaultProcessors.ARG_DOC_PROCESSOR_LOG_NOT_FOUND import nl.jolanrensen.docProcessor.gradle.creatingProcessDocTask import org.gradle.jvm.tasks.Jar import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jmailen.gradle.kotlinter.tasks.LintTask import xyz.ronella.gradle.plugin.simple.git.task.GitTask -@Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage") plugins { - kotlin("jvm") - kotlin("libs.publisher") - kotlin("plugin.serialization") - kotlin("jupyter.api") - - id("io.github.devcrocod.korro") version libs.versions.korro - id("org.jetbrains.dataframe.generator") - id("org.jetbrains.kotlinx.kover") - id("org.jmailen.kotlinter") - id("org.jetbrains.kotlinx.dataframe") - id("nl.jolanrensen.docProcessor") - id("xyz.ronella.simple-git") + with(libs.plugins) { + alias(kotlin.jvm) + alias(publisher) + alias(serialization) + alias(jupyter.api) + alias(korro) + alias(keywordGenerator) + alias(kover) + alias(kotlinter) + alias(docProcessor) + alias(simpleGit) + + // dependence on our own plugin + alias(dataframe) + + // only mandatory if `kotlin.dataframe.add.ksp=false` in gradle.properties + alias(ksp) + } idea } @@ -221,6 +226,7 @@ idea { // the target of processKdocMain and they are returned back to normal afterwards. tasks.withType { dependsOn(processKDocsMain) + mustRunAfter(tasks.generateKeywordsSrc) outputs.upToDateWhen { false } doFirst { diff --git a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt index 2cd0c3c378..51737c0eaa 100644 --- a/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt +++ b/core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt @@ -8,7 +8,6 @@ import org.jetbrains.kotlinx.dataframe.api.filter import org.jetbrains.kotlinx.dataframe.api.map import org.jetbrains.kotlinx.dataframe.api.schema import org.jetbrains.kotlinx.dataframe.api.take -import org.jetbrains.kotlinx.dataframe.api.type import org.jetbrains.kotlinx.dataframe.columns.BaseColumn import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup import org.jetbrains.kotlinx.dataframe.columns.ColumnKind diff --git a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt index e0620cb553..a7f1d28e1c 100644 --- a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt +++ b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt @@ -8,7 +8,7 @@ class CodeGenerationTests : DataFrameJupyterTest() { private fun Code.checkCompilation() { lines().forEach { - exec(it) + execRendered(it) } } diff --git a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt index 9b718847c6..66ec57b159 100644 --- a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt +++ b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt @@ -19,7 +19,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen adding column with generic type function`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ fun AnyFrame.addValue(value: T) = add("value") { listOf(value) } val df = dataFrameOf("a")(1).addValue(2) @@ -36,7 +36,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Don't inherit from data class`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema data class A(val a: Int) @@ -57,7 +57,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Don't inherit from non open class`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema class A(val a: Int) @@ -78,7 +78,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Don't inherit from open class`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema open class A(val a: Int) @@ -99,7 +99,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Do inherit from open interface`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema interface A { val a: Int } @@ -120,7 +120,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for enumerated frames`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val names = (0..2).map { it.toString() } val df = dataFrameOf(names)(1, 2, 3) @@ -136,7 +136,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for complex column names`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("[a], (b), {c}\n1, 2, 3") df @@ -145,7 +145,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """listOf(df.`{a}`[0], df.`(b)`[0], df.`{c}`[0])""" ) res2 shouldBe listOf(1, 2, 3) @@ -154,7 +154,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for '$' that is interpolator in kotlin string literals`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("\${'$'}id\n1") df @@ -163,7 +163,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`\$id`[0])" ) res2 shouldBe listOf(1) @@ -172,7 +172,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for backtick that is forbidden in kotlin identifiers`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("Day`s\n1") df @@ -182,7 +182,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { println(res1.entries.joinToString()) @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`Day's`[0])" ) res2 shouldBe listOf(1) @@ -193,7 +193,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { val forbiddenChar = ";" @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("Test$forbiddenChar\n1") df @@ -203,7 +203,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { println(res1.entries.joinToString()) @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`Test `[0])" ) res2 shouldBe listOf(1) @@ -214,7 +214,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { val forbiddenChar = "\\\\" @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("Test$forbiddenChar\n1") df @@ -224,7 +224,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { println(res1.entries.joinToString()) @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`Test `[0])" ) res2 shouldBe listOf(1) @@ -233,7 +233,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generic interface`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema interface Generic { @@ -244,7 +244,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """ val ColumnsContainer>.test1: DataColumn get() = field val DataRow>.test2: T get() = field @@ -256,7 +256,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generic interface with upper bound`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema interface Generic { @@ -267,7 +267,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """ val ColumnsContainer>.test1: DataColumn get() = field val DataRow>.test2: T get() = field @@ -279,7 +279,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generic interface with variance and user type in type parameters`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ interface UpperBound @@ -292,7 +292,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """ val ColumnsContainer>.test1: DataColumn get() = field val DataRow>.test2: T get() = field @@ -304,7 +304,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generate a new marker when dataframe marker is not a data schema so that columns are accessible with extensions`() { @Language("kts") - val a = exec( + val a = execRendered( """ enum class State { Idle, Productive, Maintenance @@ -328,7 +328,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { ) shouldNotThrowAny { @Language("kts") - val b = exec( + val b = execRendered( """ events.toolId events.state diff --git a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt index 1f711cef86..8f48073e73 100644 --- a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt +++ b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt @@ -32,7 +32,7 @@ class RenderingTests : JupyterReplTestCase() { html shouldContain "Bill" @Language("kts") - val useRes = exec( + val useRes = execRendered( """ USE { render { (it * 2).toString() } @@ -73,7 +73,7 @@ class RenderingTests : JupyterReplTestCase() { fun execSimpleDf() = execHtml("""dataFrameOf("a", "b")(1, 2, 3, 4)""") val htmlLight = execSimpleDf() - val r1 = exec("notebook.changeColorScheme(ColorScheme.DARK); 1") + val r1 = execRendered("notebook.changeColorScheme(ColorScheme.DARK); 1") val htmlDark = execSimpleDf() r1 shouldBe 1 @@ -106,7 +106,7 @@ class RenderingTests : JupyterReplTestCase() { * @return the parsed DataFrame result as a `JsonObject` */ private fun executeScriptAndParseDataframeResult(@Language("kts") script: String): JsonObject { - val result = exec(script) + val result = execRendered(script) return parseDataframeJson(result) } diff --git a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt index c7c263339d..b7bcf419ea 100644 --- a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt +++ b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt @@ -95,7 +95,7 @@ class SampleNotebooksTests : DataFrameJupyterTest() { val codeToExecute = replacer.replace(code) println("Executing code:\n$codeToExecute") - val cellResult = exec(codeToExecute) + val cellResult = execRendered(codeToExecute) println(cellResult) } } finally { diff --git a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt index 90afe78d75..94d351f016 100644 --- a/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt +++ b/core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt @@ -8,7 +8,7 @@ import org.jetbrains.kotlinx.dataframe.api.group import org.jetbrains.kotlinx.dataframe.api.into import org.jetbrains.kotlinx.dataframe.api.parse import org.jetbrains.kotlinx.dataframe.io.toStandaloneHTML -import org.jetbrains.kotlinx.jupyter.findNthSubstring +import org.jetbrains.kotlinx.jupyter.util.findNthSubstring import org.junit.Ignore import org.junit.Test import java.awt.Desktop diff --git a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt index 2cd0c3c378..51737c0eaa 100644 --- a/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt +++ b/core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/DataColumn.kt @@ -8,7 +8,6 @@ import org.jetbrains.kotlinx.dataframe.api.filter import org.jetbrains.kotlinx.dataframe.api.map import org.jetbrains.kotlinx.dataframe.api.schema import org.jetbrains.kotlinx.dataframe.api.take -import org.jetbrains.kotlinx.dataframe.api.type import org.jetbrains.kotlinx.dataframe.columns.BaseColumn import org.jetbrains.kotlinx.dataframe.columns.ColumnGroup import org.jetbrains.kotlinx.dataframe.columns.ColumnKind diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt index e0620cb553..a7f1d28e1c 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/CodeGenerationTests.kt @@ -8,7 +8,7 @@ class CodeGenerationTests : DataFrameJupyterTest() { private fun Code.checkCompilation() { lines().forEach { - exec(it) + execRendered(it) } } diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt index 9b718847c6..66ec57b159 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/JupyterCodegenTests.kt @@ -19,7 +19,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen adding column with generic type function`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ fun AnyFrame.addValue(value: T) = add("value") { listOf(value) } val df = dataFrameOf("a")(1).addValue(2) @@ -36,7 +36,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Don't inherit from data class`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema data class A(val a: Int) @@ -57,7 +57,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Don't inherit from non open class`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema class A(val a: Int) @@ -78,7 +78,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Don't inherit from open class`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema open class A(val a: Int) @@ -99,7 +99,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `Do inherit from open interface`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema interface A { val a: Int } @@ -120,7 +120,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for enumerated frames`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val names = (0..2).map { it.toString() } val df = dataFrameOf(names)(1, 2, 3) @@ -136,7 +136,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for complex column names`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("[a], (b), {c}\n1, 2, 3") df @@ -145,7 +145,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """listOf(df.`{a}`[0], df.`(b)`[0], df.`{c}`[0])""" ) res2 shouldBe listOf(1, 2, 3) @@ -154,7 +154,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for '$' that is interpolator in kotlin string literals`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("\${'$'}id\n1") df @@ -163,7 +163,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`\$id`[0])" ) res2 shouldBe listOf(1) @@ -172,7 +172,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `codegen for backtick that is forbidden in kotlin identifiers`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("Day`s\n1") df @@ -182,7 +182,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { println(res1.entries.joinToString()) @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`Day's`[0])" ) res2 shouldBe listOf(1) @@ -193,7 +193,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { val forbiddenChar = ";" @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("Test$forbiddenChar\n1") df @@ -203,7 +203,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { println(res1.entries.joinToString()) @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`Test `[0])" ) res2 shouldBe listOf(1) @@ -214,7 +214,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { val forbiddenChar = "\\\\" @Language("kts") - val res1 = exec( + val res1 = execRendered( """ val df = DataFrame.readDelimStr("Test$forbiddenChar\n1") df @@ -224,7 +224,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { println(res1.entries.joinToString()) @Language("kts") - val res2 = exec( + val res2 = execRendered( "listOf(df.`Test `[0])" ) res2 shouldBe listOf(1) @@ -233,7 +233,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generic interface`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema interface Generic { @@ -244,7 +244,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """ val ColumnsContainer>.test1: DataColumn get() = field val DataRow>.test2: T get() = field @@ -256,7 +256,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generic interface with upper bound`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ @DataSchema interface Generic { @@ -267,7 +267,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """ val ColumnsContainer>.test1: DataColumn get() = field val DataRow>.test2: T get() = field @@ -279,7 +279,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generic interface with variance and user type in type parameters`() { @Language("kts") - val res1 = exec( + val res1 = execRendered( """ interface UpperBound @@ -292,7 +292,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { res1.shouldBeInstanceOf() @Language("kts") - val res2 = exec( + val res2 = execRendered( """ val ColumnsContainer>.test1: DataColumn get() = field val DataRow>.test2: T get() = field @@ -304,7 +304,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { @Test fun `generate a new marker when dataframe marker is not a data schema so that columns are accessible with extensions`() { @Language("kts") - val a = exec( + val a = execRendered( """ enum class State { Idle, Productive, Maintenance @@ -328,7 +328,7 @@ class JupyterCodegenTests : JupyterReplTestCase() { ) shouldNotThrowAny { @Language("kts") - val b = exec( + val b = execRendered( """ events.toolId events.state diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt index 1f711cef86..8f48073e73 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/RenderingTests.kt @@ -32,7 +32,7 @@ class RenderingTests : JupyterReplTestCase() { html shouldContain "Bill" @Language("kts") - val useRes = exec( + val useRes = execRendered( """ USE { render { (it * 2).toString() } @@ -73,7 +73,7 @@ class RenderingTests : JupyterReplTestCase() { fun execSimpleDf() = execHtml("""dataFrameOf("a", "b")(1, 2, 3, 4)""") val htmlLight = execSimpleDf() - val r1 = exec("notebook.changeColorScheme(ColorScheme.DARK); 1") + val r1 = execRendered("notebook.changeColorScheme(ColorScheme.DARK); 1") val htmlDark = execSimpleDf() r1 shouldBe 1 @@ -106,7 +106,7 @@ class RenderingTests : JupyterReplTestCase() { * @return the parsed DataFrame result as a `JsonObject` */ private fun executeScriptAndParseDataframeResult(@Language("kts") script: String): JsonObject { - val result = exec(script) + val result = execRendered(script) return parseDataframeJson(result) } diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt index c7c263339d..b7bcf419ea 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/jupyter/SampleNotebooksTests.kt @@ -95,7 +95,7 @@ class SampleNotebooksTests : DataFrameJupyterTest() { val codeToExecute = replacer.replace(code) println("Executing code:\n$codeToExecute") - val cellResult = exec(codeToExecute) + val cellResult = execRendered(codeToExecute) println(cellResult) } } finally { diff --git a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt index 90afe78d75..94d351f016 100644 --- a/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt +++ b/core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/testSets/person/HtmlRenderingTests.kt @@ -8,7 +8,7 @@ import org.jetbrains.kotlinx.dataframe.api.group import org.jetbrains.kotlinx.dataframe.api.into import org.jetbrains.kotlinx.dataframe.api.parse import org.jetbrains.kotlinx.dataframe.io.toStandaloneHTML -import org.jetbrains.kotlinx.jupyter.findNthSubstring +import org.jetbrains.kotlinx.jupyter.util.findNthSubstring import org.junit.Ignore import org.junit.Test import java.awt.Desktop diff --git a/dataframe-arrow/build.gradle.kts b/dataframe-arrow/build.gradle.kts index 68bb3c311f..dd80f5929c 100644 --- a/dataframe-arrow/build.gradle.kts +++ b/dataframe-arrow/build.gradle.kts @@ -1,8 +1,10 @@ plugins { - kotlin("jvm") - kotlin("libs.publisher") - id("org.jetbrains.kotlinx.kover") - id("org.jmailen.kotlinter") + with(libs.plugins) { + alias(kotlin.jvm) + alias(publisher) + alias(kover) + alias(kotlinter) + } } group = "org.jetbrains.kotlinx" diff --git a/dataframe-excel/build.gradle.kts b/dataframe-excel/build.gradle.kts index 78768409b0..796f872f50 100644 --- a/dataframe-excel/build.gradle.kts +++ b/dataframe-excel/build.gradle.kts @@ -1,8 +1,10 @@ plugins { - kotlin("jvm") - kotlin("libs.publisher") - id("org.jetbrains.kotlinx.kover") - id("org.jmailen.kotlinter") + with(libs.plugins) { + alias(kotlin.jvm) + alias(publisher) + alias(kover) + alias(kotlinter) + } } group = "org.jetbrains.kotlinx" diff --git a/dataframe-jdbc/build.gradle.kts b/dataframe-jdbc/build.gradle.kts index 2c5505a46f..ea2160035a 100644 --- a/dataframe-jdbc/build.gradle.kts +++ b/dataframe-jdbc/build.gradle.kts @@ -1,9 +1,11 @@ plugins { - kotlin("jvm") - kotlin("libs.publisher") - id("org.jetbrains.kotlinx.kover") - kotlin("jupyter.api") - // TODO enable later: id("org.jmailen.kotlinter") + with(libs.plugins) { + alias(kotlin.jvm) + alias(publisher) + alias(kover) + // TODO enable later: alias(libs.kotlinter) + alias(jupyter.api) + } } group = "org.jetbrains.kotlinx" diff --git a/dataframe-openapi/build.gradle.kts b/dataframe-openapi/build.gradle.kts index d00075ad71..9190e3ce28 100644 --- a/dataframe-openapi/build.gradle.kts +++ b/dataframe-openapi/build.gradle.kts @@ -1,10 +1,12 @@ plugins { - kotlin("jvm") - kotlin("libs.publisher") - kotlin("plugin.serialization") - id("org.jetbrains.kotlinx.kover") - id("org.jmailen.kotlinter") - kotlin("jupyter.api") + with(libs.plugins) { + alias(kotlin.jvm) + alias(publisher) + alias(serialization) + alias(kover) + alias(kotlinter) + alias(jupyter.api) + } } group = "org.jetbrains.kotlinx" diff --git a/dataframe-openapi/src/test/kotlin/OpenApiTests.kt b/dataframe-openapi/src/test/kotlin/OpenApiTests.kt index fd8d7bc2cf..cb6a05ff19 100644 --- a/dataframe-openapi/src/test/kotlin/OpenApiTests.kt +++ b/dataframe-openapi/src/test/kotlin/OpenApiTests.kt @@ -21,7 +21,7 @@ class OpenApiTests : JupyterReplTestCase() { private val additionalImports = openApi.createDefaultReadMethod().additionalImports.joinToString("\n") private fun execGeneratedCode(code: Code): Code { - @Language("kts") val res1 = exec( + @Language("kts") val res1 = execRendered( """ $additionalImports $code diff --git a/examples/idea-examples/json/build.gradle.kts b/examples/idea-examples/json/build.gradle.kts index 89e3cc8c3d..cd98122ca5 100644 --- a/examples/idea-examples/json/build.gradle.kts +++ b/examples/idea-examples/json/build.gradle.kts @@ -4,7 +4,11 @@ import org.jetbrains.kotlinx.dataframe.api.JsonPath plugins { application kotlin("jvm") + id("org.jetbrains.kotlinx.dataframe") + + // only mandatory if `kotlin.dataframe.add.ksp=false` in gradle.properties + id("com.google.devtools.ksp") } repositories { diff --git a/examples/idea-examples/json/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/openapi/openApiApiGuru.kt b/examples/idea-examples/json/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/openapi/openApiApiGuru.kt index ceb3dfdc9f..e9873b7471 100644 --- a/examples/idea-examples/json/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/openapi/openApiApiGuru.kt +++ b/examples/idea-examples/json/src/main/kotlin/org/jetbrains/kotlinx/dataframe/examples/openapi/openApiApiGuru.kt @@ -13,6 +13,7 @@ import org.jetbrains.kotlinx.dataframe.annotations.ImportDataSchema import org.jetbrains.kotlinx.dataframe.api.any import org.jetbrains.kotlinx.dataframe.api.filter import org.jetbrains.kotlinx.dataframe.api.print +import org.jetbrains.kotlinx.dataframe.api.value /** * In this file we'll demonstrate how to use OpenApi schemas @@ -35,7 +36,7 @@ private fun gradle() { apis.filter { value.versions.value.any { - (updated ?: added).year >= 2021 + (it.updated ?: it.added).year >= 2021 } } diff --git a/examples/idea-examples/movies/build.gradle.kts b/examples/idea-examples/movies/build.gradle.kts index e36b005d93..bd47a6e0d3 100644 --- a/examples/idea-examples/movies/build.gradle.kts +++ b/examples/idea-examples/movies/build.gradle.kts @@ -3,7 +3,11 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { application kotlin("jvm") + id("org.jetbrains.kotlinx.dataframe") + + // only mandatory if `kotlin.dataframe.add.ksp=false` in gradle.properties + id("com.google.devtools.ksp") } repositories { diff --git a/examples/idea-examples/titanic/build.gradle.kts b/examples/idea-examples/titanic/build.gradle.kts index ee812ef50b..a753923089 100644 --- a/examples/idea-examples/titanic/build.gradle.kts +++ b/examples/idea-examples/titanic/build.gradle.kts @@ -1,7 +1,11 @@ plugins { application kotlin("jvm") + id("org.jetbrains.kotlinx.dataframe") + + // only mandatory if `kotlin.dataframe.add.ksp=false` in gradle.properties + id("com.google.devtools.ksp") } repositories { @@ -14,10 +18,10 @@ application.mainClass.set("org.jetbrains.kotlinx.dataframe.examples.titanic.ml.T dependencies { // implementation("org.jetbrains.kotlinx:dataframe:X.Y.Z") implementation(project(":")) - implementation("org.jetbrains.kotlinx:kotlin-deeplearning-api:0.5.1") - implementation("org.jetbrains.kotlinx:kotlin-deeplearning-impl:0.5.1") - implementation("org.jetbrains.kotlinx:kotlin-deeplearning-tensorflow:0.5.1") - implementation("org.jetbrains.kotlinx:kotlin-deeplearning-dataset:0.5.1") + implementation("org.jetbrains.kotlinx:kotlin-deeplearning-api:0.5.2") + implementation("org.jetbrains.kotlinx:kotlin-deeplearning-impl:0.5.2") + implementation("org.jetbrains.kotlinx:kotlin-deeplearning-tensorflow:0.5.2") + implementation("org.jetbrains.kotlinx:kotlin-deeplearning-dataset:0.5.2") } dataframes { diff --git a/examples/idea-examples/youtube/build.gradle.kts b/examples/idea-examples/youtube/build.gradle.kts index b7b1277e7b..379cf1c63a 100644 --- a/examples/idea-examples/youtube/build.gradle.kts +++ b/examples/idea-examples/youtube/build.gradle.kts @@ -3,7 +3,11 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { application kotlin("jvm") + id("org.jetbrains.kotlinx.dataframe") + + // only mandatory if `kotlin.dataframe.add.ksp=false` in gradle.properties + id("com.google.devtools.ksp") } repositories { diff --git a/generator/build.gradle.kts b/generator/build.gradle.kts index 27756e1f46..1925b89b6a 100644 --- a/generator/build.gradle.kts +++ b/generator/build.gradle.kts @@ -19,6 +19,7 @@ gradlePlugin { plugins { create("dependencies") { id = "org.jetbrains.dataframe.generator" + version = "1.0" implementationClass = "org.jetbrains.dataframe.keywords.KeywordsGeneratorPlugin" } } diff --git a/generator/gradle.properties b/generator/gradle.properties index 51cd9bb92e..40610d1612 100644 --- a/generator/gradle.properties +++ b/generator/gradle.properties @@ -1,2 +1,4 @@ -kotlinCompilerVersion=1.6.0 -kotlinPoetVersion=1.7.2 +kotlinCompilerVersion=1.9.22 + +# 1.15.0+ breaks with NoSuchMethodException: 'java.io.File com.squareup.kotlinpoet.FileSpec.writeTo(java.io.File)' +kotlinPoetVersion=1.14.2 diff --git a/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/GeneratorTask.kt b/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/GeneratorTask.kt index 5679fbc163..50ad1e77a0 100644 --- a/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/GeneratorTask.kt +++ b/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/GeneratorTask.kt @@ -45,7 +45,7 @@ open class GeneratorTask : DefaultTask() { } private fun getKeywords(tokenSet: TokenSet): List { - fun id(value: String) = value.toUpperCase().replace("!", "NOT_") + fun id(value: String) = value.uppercase().replace("!", "NOT_") return tokenSet.types.map { t -> t as KtKeywordToken diff --git a/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/KeywordsGeneratorPlugin.kt b/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/KeywordsGeneratorPlugin.kt index 4152588dd7..a9be91cf6f 100644 --- a/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/KeywordsGeneratorPlugin.kt +++ b/generator/src/main/kotlin/org/jetbrains/dataframe/keywords/KeywordsGeneratorPlugin.kt @@ -10,7 +10,7 @@ import java.io.File class KeywordsGeneratorPlugin: Plugin { override fun apply(target: Project): Unit = with(target){ - val genSrcDir = buildDir.resolve("generatedSrc") + val genSrcDir = layout.buildDirectory.asFile.get().resolve("generatedSrc") val sourceSets = project.extensions.getByName("sourceSets") as SourceSetContainer val mainSourceSet: SourceSet = sourceSets.named("main").get() mainSourceSet.addDir(genSrcDir) diff --git a/gradle.properties b/gradle.properties index 445e6cebad..cda3df9c4a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,3 +5,9 @@ kotlin.jupyter.add.scanner=false org.gradle.jvmargs=-Xmx4G # build.number.detection=false # build.number=0.8.0 + +# Disables the bundled KSP plugin from the dataframe gradle plugin +# that's used to generate data schemas in some modules. +# This makes it mandatory to explicitly apply your own version of the +# KSP plugin in the modules that use it. +kotlin.dataframe.add.ksp=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5a7163c9b0..6b0b7b7cdb 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,66 +1,100 @@ [versions] ksp = "1.9.22-1.0.17" -kotlinJupyter = "0.11.0-358" +kotlinJupyter = "0.12.0-139" + +# TODO Updating requires major changes all across the project +# https://github.com/Kotlin/dataframe/issues/364 ktlint = "3.4.5" + +# make sure to sync manually with :generator module kotlin = "1.9.22" +kotlinpoet = "1.16.0" + +# TODO 1.9.10 requires korro and docProcessor to update +# https://github.com/Kotlin/dataframe/issues/596 dokka = "1.8.10" -libsPublisher = "0.0.60-dev-30" + +libsPublisher = "1.8.10-dev-43" + # "Bootstrap" version of the dataframe, used in the build itself to generate @DataSchema APIs, # dogfood Gradle / KSP plugins in tests and idea-examples modules -dataframe = "0.12.1" +dataframe = "0.13.0-dev-2838" + korro = "0.1.5" -kover = "0.6.0-Beta" -commonsCsv = "1.8" -commonsCompress = "1.21" -klaxon = "5.5" +# TODO Requires more work to be updated to 0.7.0+ +# https://github.com/Kotlin/dataframe/issues/594 +kover = "0.6.1" + +commonsCsv = "1.10.0" +commonsCompress = "1.26.0" +klaxon = "5.5" # 5.6 requires Java 11 fuel = "2.3.1" -poi = "5.2.2" -mariadb = "3.1.4" -h2db = "2.2.220" +poi = "5.2.5" +mariadb = "3.3.2" +h2db = "2.2.224" mysql = "8.0.33" -postgresql = "42.6.0" -sqlite = "3.42.0.1" -kotlinDatetime = "0.4.0" -kotlinpoet = "1.12.0" -openapi = "2.1.13" -kotlinLogging = "5.0.1" -sl4j = "2.0.7" +postgresql = "42.7.1" +sqlite = "3.45.1.0" +kotlinDatetime = "0.5.0" +openapi = "2.1.20" +kotlinLogging = "6.0.3" +sl4j = "2.0.12" junit = "4.13.2" -kotestAsserions = "4.6.3" -jsoup = "1.14.3" -arrow = "11.0.0" +junit-jupiter = "5.10.2" +junit-platform = "1.10.2" + +# TODO 5.8.0 is not possible due to https://github.com/Kotlin/dataframe/issues/595 +kotestAsserions = "5.5.4" + +jsoup = "1.17.2" +arrow = "15.0.0" docProcessor = "0.3.2" simpleGit = "2.0.3" +dependencyVersions = "0.51.0" +plugin-publish = "1.2.1" +shadow = "8.1.1" +android-gradle-api = "7.3.1" # Can't be updated to 7.4.0+ due to Java 8 compatibility +ktor-server-netty = "2.3.8" +kotlin-compile-testing = "1.5.0" [libraries] ksp-gradle = { group = "com.google.devtools.ksp", name = "symbol-processing-gradle-plugin", version.ref = "ksp" } ksp-api = { group = "com.google.devtools.ksp", name = "symbol-processing-api", version.ref = "ksp" } -jupyter-api = { module = "org.jetbrains.kotlinx:kotlin-jupyter-kernel", version.ref = "kotlinJupyter" } +jupyter-api = { group = "org.jetbrains.kotlinx", name = "kotlin-jupyter-kernel", version.ref = "kotlinJupyter" } kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib", version.ref = "kotlin" } kotlin-stdlib-jdk8 = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" } kotlin-reflect = { group = "org.jetbrains.kotlin", name = "kotlin-reflect", version.ref = "kotlin" } kotlin-scriptingJvm = { group = "org.jetbrains.kotlin", name = "kotlin-scripting-jvm", version.ref = "kotlin" } -commonsCsv = { module = "org.apache.commons:commons-csv", version.ref = "commonsCsv" } -commonsCompress = { module = "org.apache.commons:commons-compress", version.ref = "commonsCompress" } -klaxon = { module = "com.beust:klaxon", version.ref = "klaxon" } -fuel = { module = "com.github.kittinunf.fuel:fuel", version.ref = "fuel" } -poi = { module = "org.apache.poi:poi", version.ref = "poi" } +commonsCsv = { group = "org.apache.commons", name = "commons-csv", version.ref = "commonsCsv" } +commonsCompress = { group = "org.apache.commons", name = "commons-compress", version.ref = "commonsCompress" } +klaxon = { group = "com.beust", name = "klaxon", version.ref = "klaxon" } +fuel = { group = "com.github.kittinunf.fuel", name = "fuel", version.ref = "fuel" } +poi = { group = "org.apache.poi", name = "poi", version.ref = "poi" } mariadb = { group = "org.mariadb.jdbc", name = "mariadb-java-client", version.ref = "mariadb" } h2db = { group = "com.h2database", name = "h2", version.ref = "h2db" } mysql = { group = "mysql", name = "mysql-connector-java", version.ref = "mysql" } postgresql = { group = "org.postgresql", name = "postgresql", version.ref = "postgresql" } sqlite = { group = "org.xerial", name = "sqlite-jdbc", version.ref = "sqlite" } -poi-ooxml = { module = "org.apache.poi:poi-ooxml", version.ref = "poi" } -kotlin-datetimeJvm = { module = "org.jetbrains.kotlinx:kotlinx-datetime-jvm", version.ref = "kotlinDatetime" } +poi-ooxml = { group = "org.apache.poi", name = "poi-ooxml", version.ref = "poi" } +kotlin-datetimeJvm = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime-jvm", version.ref = "kotlinDatetime" } + +junit = { group = "junit", name = "junit", version.ref = "junit" } -junit = { module = "junit:junit", version.ref = "junit" } -kotestAssertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotestAsserions" } -jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } +junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit-jupiter" } +junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter", version.ref = "junit-jupiter" } +junit-jupiter-engine = { group = "org.junit.jupiter", name = "junit-jupiter-engine", version.ref = "junit-jupiter" } +junit-platform-commons = { group = "org.junit.platform", name = "junit-platform-commons", version.ref = "junit-platform" } +junit-platform-launcher = { group = "org.junit.platform", name = "junit-platform-launcher", version.ref = "junit-platform" } +junit-platform-runner = { group = "org.junit.platform", name = "junit-platform-runner", version.ref = "junit-platform" } +junit-platform-suite-api = { group = "org.junit.platform", name = "junit-platform-suite-api", version.ref = "junit-platform" } + +kotestAssertions = { group = "io.kotest", name = "kotest-assertions-core", version.ref = "kotestAsserions" } +jsoup = { group = "org.jsoup", name = "jsoup", version.ref = "jsoup" } arrow-format = { group = "org.apache.arrow", name = "arrow-format", version.ref = "arrow" } arrow-vector = { group = "org.apache.arrow", name = "arrow-vector", version.ref = "arrow" } @@ -71,9 +105,27 @@ swagger = { group = "io.swagger.parser.v3", name = "swagger-parser", version.ref kotlinLogging = { group = "io.github.oshai", name = "kotlin-logging", version.ref = "kotlinLogging" } sl4j = { group = "org.slf4j", name = "slf4j-simple", version.ref = "sl4j" } +android-gradle-api = { group = "com.android.tools.build", name = "gradle-api", version.ref = "android-gradle-api" } +android-gradle = { group = "com.android.tools.build", name = "gradle", version.ref = "android-gradle-api" } +kotlin-gradle-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin" } +kotlin-gradle-plugin-api = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin-api" } +ktor-server-netty = { group = "io.ktor", name = "ktor-server-netty", version.ref = "ktor-server-netty" } +kotlin-compile-testing = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing", version.ref = "kotlin-compile-testing" } +kotlin-compile-testing-ksp = { group = "com.github.tschuchortdev", name = "kotlin-compile-testing-ksp", version.ref = "kotlin-compile-testing" } +kotlin-compiler = { group = "org.jetbrains.kotlin", name = "kotlin-compiler", version.ref = "kotlin" } +kotlin-compiler-embeddable = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-embeddable", version.ref = "kotlin" } +kotlin-compiler-internal-test-framework = { group = "org.jetbrains.kotlin", name = "kotlin-compiler-internal-test-framework", version.ref = "kotlin" } +kotlin-test = { group = "org.jetbrains.kotlin", name = "kotlin-test", version.ref = "kotlin" } +kotlin-script-runtime = { group = "org.jetbrains.kotlin", name = "kotlin-script-runtime", version.ref = "kotlin" } +kotlin-annotations-jvm = { group = "org.jetbrains.kotlin", name = "kotlin-annotations-jvm", version.ref = "kotlin" } +kotlin-jupyter-test-kit = { group = "org.jetbrains.kotlinx", name = "kotlin-jupyter-test-kit", version.ref = "kotlinJupyter" } + +dataframe-symbol-processor = { group = "org.jetbrains.kotlinx.dataframe", name = "symbol-processor-all" } + [plugins] jupyter-api = { id = "org.jetbrains.kotlin.jupyter.api", version.ref = "kotlinJupyter" } +ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" } @@ -84,4 +136,9 @@ kotlinter = { id = "org.jmailen.kotlinter", version.ref = "ktlint" } dataframe = { id = "org.jetbrains.kotlinx.dataframe", version.ref = "dataframe" } kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } docProcessor = { id = "nl.jolanrensen.docProcessor", version.ref = "docProcessor" } -simpleGit = { id = "xyz.ronella.simple-git", version.ref = "simpleGit"} +simpleGit = { id = "xyz.ronella.simple-git", version.ref = "simpleGit" } +serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" } +kover = { id = "org.jetbrains.kotlinx.kover", version.ref = "kover" } +dependencyVersions = { id = "com.github.ben-manes.versions", version.ref = "dependencyVersions" } +plugin-publish = { id = "com.gradle.plugin-publish", version.ref = "plugin-publish" } +shadow = { id = "com.github.johnrengelman.shadow", version.ref = "shadow" } diff --git a/plugins/dataframe-gradle-plugin/build.gradle.kts b/plugins/dataframe-gradle-plugin/build.gradle.kts index 503f4c70b4..846a15ccb5 100644 --- a/plugins/dataframe-gradle-plugin/build.gradle.kts +++ b/plugins/dataframe-gradle-plugin/build.gradle.kts @@ -1,11 +1,9 @@ -import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet - plugins { `kotlin-dsl` `java-gradle-plugin` `maven-publish` - id("com.gradle.plugin-publish") version "0.15.0" - id("org.jmailen.kotlinter") + alias(libs.plugins.plugin.publish) + alias(libs.plugins.kotlinter) } repositories { @@ -23,17 +21,18 @@ dependencies { implementation(project(":dataframe-openapi")) implementation(project(":dataframe-excel")) implementation(project(":dataframe-jdbc")) - implementation(kotlin("gradle-plugin-api")) - implementation(kotlin("gradle-plugin")) - implementation("com.beust:klaxon:5.5") + + implementation(libs.kotlin.gradle.plugin.api) + implementation(libs.kotlin.gradle.plugin) + implementation(libs.klaxon) implementation(libs.ksp.gradle) implementation(libs.ksp.api) - testImplementation("junit:junit:4.13.1") - testImplementation("io.kotest:kotest-assertions-core:4.6.0") - testImplementation("com.android.tools.build:gradle-api:7.3.1") - testImplementation("com.android.tools.build:gradle:7.3.1") - testImplementation("io.ktor:ktor-server-netty:1.6.7") + testImplementation(libs.junit) + testImplementation(libs.kotestAssertions) + testImplementation(libs.android.gradle.api) + testImplementation(libs.android.gradle) + testImplementation(libs.ktor.server.netty) testImplementation(libs.h2db) testImplementation(gradleApi()) } @@ -61,42 +60,26 @@ tasks.withType { } gradlePlugin { - plugins { - create("schemaGeneratorPlugin") { - id = "org.jetbrains.kotlinx.dataframe" - implementationClass = "org.jetbrains.dataframe.gradle.ConvenienceSchemaGeneratorPlugin" - } - create("deprecatedSchemaGeneratorPlugin") { - id = "org.jetbrains.kotlin.plugin.dataframe" - implementationClass = "org.jetbrains.dataframe.gradle.DeprecatingSchemaGeneratorPlugin" - } - } -} - -pluginBundle { // These settings are set for the whole plugin bundle website = "https://github.com/Kotlin/dataframe" vcsUrl = "https://github.com/Kotlin/dataframe" - (plugins) { - "schemaGeneratorPlugin" { - // id is captured from java-gradle-plugin configuration + plugins { + create("schemaGeneratorPlugin") { + id = "org.jetbrains.kotlinx.dataframe" + implementationClass = "org.jetbrains.dataframe.gradle.ConvenienceSchemaGeneratorPlugin" displayName = "Kotlin Dataframe gradle plugin" description = "Gradle plugin providing task for inferring data schemas from your CSV or JSON data" tags = listOf("dataframe", "kotlin") } - "deprecatedSchemaGeneratorPlugin" { - // id is captured from java-gradle-plugin configuration + create("deprecatedSchemaGeneratorPlugin") { + id = "org.jetbrains.kotlin.plugin.dataframe" + implementationClass = "org.jetbrains.dataframe.gradle.DeprecatingSchemaGeneratorPlugin" displayName = "Kotlin Dataframe gradle plugin" - description = - "The plugin was moved to 'org.jetbrains.kotlinx.dataframe'. Gradle plugin providing task for inferring data schemas from your CSV or JSON data" + description = "The plugin was moved to 'org.jetbrains.kotlinx.dataframe'. Gradle plugin providing task for inferring data schemas from your CSV or JSON data" tags = listOf("dataframe", "kotlin") } } - - mavenCoordinates { - groupId = project.group.toString() - } } tasks.withType() { diff --git a/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/EmbeddedServerRunners.kt b/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/EmbeddedServerRunners.kt index 843e2061a9..0c0e7e43b6 100644 --- a/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/EmbeddedServerRunners.kt +++ b/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/EmbeddedServerRunners.kt @@ -1,11 +1,11 @@ package org.jetbrains.dataframe.gradle -import io.ktor.application.* import io.ktor.http.* -import io.ktor.response.* -import io.ktor.routing.* +import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.server.netty.* +import io.ktor.server.response.* +import io.ktor.server.routing.* fun useHostedJson(json: String, f: (url: String) -> Unit) { // duplicated in ksp/EmbeddedServerRunners.kt diff --git a/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt b/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt index b56df8fd50..4ad54d26f1 100644 --- a/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt +++ b/plugins/dataframe-gradle-plugin/src/test/kotlin/org/jetbrains/dataframe/gradle/GradleRunnerDsl.kt @@ -9,7 +9,7 @@ import java.nio.file.Files fun runGradleBuild( task: String, @Language("kts") settingsGradle: (File) -> String = { "" }, - build: (File) -> String, + @Language("kts") build: (File) -> String, ): Build { val buildDir = Files.createTempDirectory("test").toFile() val buildFile = File(buildDir, "build.gradle.kts") diff --git a/plugins/expressions-converter/build.gradle.kts b/plugins/expressions-converter/build.gradle.kts index 8ef4946cf1..23acd2620a 100644 --- a/plugins/expressions-converter/build.gradle.kts +++ b/plugins/expressions-converter/build.gradle.kts @@ -1,9 +1,11 @@ plugins { - id("java") - kotlin("jvm") - id("com.github.johnrengelman.shadow") version "7.1.2" - kotlin("libs.publisher") - id("org.jmailen.kotlinter") + java + with(libs.plugins) { + alias(kotlin.jvm) + alias(shadow) + alias(publisher) + alias(kotlinter) + } } group = "org.jetbrains.kotlinx.dataframe" @@ -13,26 +15,25 @@ repositories { } dependencies { - val kotlinVersion = libs.versions.kotlin.get() - val compiler = "org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion" - compileOnly(compiler) + compileOnly(libs.kotlin.compiler) - testImplementation(compiler) - testImplementation("org.jetbrains.kotlin:kotlin-compiler-internal-test-framework:$kotlinVersion") + testImplementation(libs.kotlin.compiler) + testImplementation(libs.kotlin.compiler.internal.test.framework) testRuntimeOnly(project(":core")) - testRuntimeOnly("org.jetbrains.kotlin:kotlin-test:$kotlinVersion") - testRuntimeOnly("org.jetbrains.kotlin:kotlin-script-runtime:$kotlinVersion") - testRuntimeOnly("org.jetbrains.kotlin:kotlin-annotations-jvm:$kotlinVersion") + testRuntimeOnly(libs.kotlin.test) + testRuntimeOnly(libs.kotlin.script.runtime) + testRuntimeOnly(libs.kotlin.annotations.jvm) + + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) + testImplementation(libs.junit.platform.commons) + testImplementation(libs.junit.platform.launcher) + testImplementation(libs.junit.platform.runner) + testImplementation(libs.junit.platform.suite.api) - testImplementation(platform("org.junit:junit-bom:5.8.0")) - testImplementation("org.junit.jupiter:junit-jupiter") - testImplementation("org.junit.platform:junit-platform-commons") - testImplementation("org.junit.platform:junit-platform-launcher") - testImplementation("org.junit.platform:junit-platform-runner") - testImplementation("org.junit.platform:junit-platform-suite-api") - testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.1") + testRuntimeOnly(libs.junit.jupiter.engine) } tasks.test { diff --git a/plugins/symbol-processor/build.gradle b/plugins/symbol-processor/build.gradle index 941d7c751c..8c4f5b2bd4 100644 --- a/plugins/symbol-processor/build.gradle +++ b/plugins/symbol-processor/build.gradle @@ -1,8 +1,10 @@ +import org.jetbrains.kotlinx.publisher.PomUtilKt + plugins { - id("com.github.johnrengelman.shadow") version "7.1.2" - id("org.jetbrains.kotlin.jvm") - id("org.jetbrains.kotlin.libs.publisher") - id("org.jmailen.kotlinter") + alias(libs.plugins.shadow) + alias(libs.plugins.kotlin.jvm) + alias(libs.plugins.publisher) + alias(libs.plugins.kotlinter) } repositories { @@ -23,16 +25,16 @@ dependencies { implementation(libs.kotlin.reflect) implementation(libs.h2db) testImplementation(libs.h2db) - testImplementation("org.jetbrains.kotlin:kotlin-test") - testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.5.0") - testImplementation("com.github.tschuchortdev:kotlin-compile-testing-ksp:1.5.0") - testImplementation("io.ktor:ktor-server-netty:1.6.7") - testImplementation("io.kotest:kotest-assertions-core:4.6.0") + testImplementation(libs.kotlin.test) + testImplementation(libs.kotlin.compile.testing) + testImplementation(libs.kotlin.compile.testing.ksp) + testImplementation(libs.ktor.server.netty) + testImplementation(libs.kotestAssertions) } kotlinPublications { pom { - use(org.jetbrains.kotlinx.publisher.PomUtilKt) { + use(PomUtilKt) { githubRepo("Kotlin", "dataframe") inceptionYear.set("2021") licenses { diff --git a/plugins/symbol-processor/src/test/kotlin/org/jetbrains/dataframe/ksp/EmbeddedServerRunners.kt b/plugins/symbol-processor/src/test/kotlin/org/jetbrains/dataframe/ksp/EmbeddedServerRunners.kt index 669977ce4b..045e664ab4 100644 --- a/plugins/symbol-processor/src/test/kotlin/org/jetbrains/dataframe/ksp/EmbeddedServerRunners.kt +++ b/plugins/symbol-processor/src/test/kotlin/org/jetbrains/dataframe/ksp/EmbeddedServerRunners.kt @@ -1,10 +1,10 @@ package org.jetbrains.dataframe.ksp -import io.ktor.application.* -import io.ktor.response.* -import io.ktor.routing.* +import io.ktor.server.application.* import io.ktor.server.engine.* import io.ktor.server.netty.* +import io.ktor.server.response.* +import io.ktor.server.routing.* import java.io.File fun useHostedFile(file: File, f: (url: String) -> Unit) { diff --git a/settings.gradle.kts b/settings.gradle.kts index 07f677cd2a..3e96dde332 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,9 @@ rootProject.name = "dataframe" +// treated as a separate project with its own Kotlin version etc. includeBuild("generator") + include("plugins:dataframe-gradle-plugin") include("plugins:symbol-processor") include("plugins:expressions-converter") diff --git a/tests/build.gradle.kts b/tests/build.gradle.kts index 0cf781c43a..b6f6b575ad 100644 --- a/tests/build.gradle.kts +++ b/tests/build.gradle.kts @@ -1,13 +1,17 @@ import org.jmailen.gradle.kotlinter.tasks.LintTask -@Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage") plugins { - id("java") - kotlin("jvm") - id("org.jetbrains.kotlinx.dataframe") - id("io.github.devcrocod.korro") version libs.versions.korro - id("org.jmailen.kotlinter") - id("org.jetbrains.kotlinx.kover") + java + with(libs.plugins) { + alias(kotlin.jvm) + alias(korro) + alias(kotlinter) + alias(kover) + + alias(dataframe) + // only mandatory if `kotlin.dataframe.add.ksp=false` in gradle.properties + alias(ksp) + } } repositories {