Skip to content

Commit 70d167d

Browse files
committed
Merge branch 'master' into jpc-kdoc-reuse
# Conflicts: # core/build.gradle.kts # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aliases.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/Nulls.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/add.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/gather.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/reorder.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/select.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/toDataFrame.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/update.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/convertTo.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/gather.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/reorder.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/api/update.kt # core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/columns/constructors.kt
2 parents cfa9b4a + ec5004b commit 70d167d

File tree

18 files changed

+198
-1900
lines changed

18 files changed

+198
-1900
lines changed

build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ plugins {
1414
id("org.jetbrains.dokka") version libs.versions.dokka
1515
id("org.jetbrains.kotlinx.kover") version libs.versions.kover
1616
id("org.jmailen.kotlinter") version libs.versions.ktlint
17+
id("nl.jolanrensen.docProcessor") version libs.versions.docProcessor apply false
18+
id("xyz.ronella.simple-git") version libs.versions.simpleGit apply false
1719
}
1820

1921
val jupyterApiTCRepo: String by project

core/build.gradle.kts

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import nl.jolanrensen.docProcessor.defaultProcessors.*
22
import nl.jolanrensen.docProcessor.gradle.creatingProcessDocTask
33
import org.gradle.jvm.tasks.Jar
4+
import xyz.ronella.gradle.plugin.simple.git.task.GitTask
45

56
@Suppress("DSL_SCOPE_VIOLATION", "UnstableApiUsage")
67
plugins {
@@ -14,8 +15,9 @@ plugins {
1415
id("org.jetbrains.kotlinx.kover")
1516
id("org.jmailen.kotlinter")
1617
id("org.jetbrains.kotlinx.dataframe")
17-
// id("com.github.jolanrensen.docProcessorGradlePlugin") version "v0.1.0"
18-
id("nl.jolanrensen.docProcessor") version "0.1.1"
18+
id("nl.jolanrensen.docProcessor")
19+
id("xyz.ronella.simple-git")
20+
idea
1921
}
2022

2123
group = "org.jetbrains.kotlinx"
@@ -58,58 +60,62 @@ kotlin.sourceSets {
5860
}
5961
}
6062

63+
val generatedSourcesFolderName = "generated-sources"
64+
val addGeneratedSourcesToGit by tasks.creating(GitTask::class) {
65+
directory.set(file("."))
66+
command.set("add")
67+
args.set(listOf("-A", generatedSourcesFolderName))
68+
}
69+
6170
// Backup the kotlin source files location
6271
val kotlinMainSources = kotlin.sourceSets.main.get().kotlin.sourceDirectories
6372

73+
// Task to generate the processed documentation
6474
val processKDocsMain by creatingProcessDocTask(
65-
sources = kotlinMainSources.filterNot { "build/generated" in it.path } // Exclude generated sources
75+
sources = kotlinMainSources.filterNot { "build/generated" in it.path }, // Exclude generated sources
6676
) {
67-
target = file("generated-sources")
77+
target = file(generatedSourcesFolderName)
6878
processors = listOf(
6979
INCLUDE_DOC_PROCESSOR,
7080
INCLUDE_FILE_DOC_PROCESSOR,
7181
INCLUDE_ARG_DOC_PROCESSOR,
7282
COMMENT_DOC_PROCESSOR,
7383
SAMPLE_DOC_PROCESSOR,
7484
)
75-
}
7685

77-
// As a bonus, this will update dokka if you use that
78-
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaLeafTask> {
79-
dependsOn(processKDocsMain)
80-
dokkaSourceSets {
81-
all {
82-
sourceRoot(processKDocsMain.target.get())
86+
task {
87+
doLast {
88+
// ensure generated sources are added to git
89+
addGeneratedSourcesToGit.executeCommand()
8390
}
8491
}
8592
}
8693

94+
// Exclude the generated/processed sources from the IDE
95+
idea {
96+
module {
97+
excludeDirs.add(file(generatedSourcesFolderName))
98+
}
99+
}
100+
87101
// Modify all Jar tasks such that before running the Kotlin sources are set to
88-
// the target of processKdocIncludeMain and they are returned back to normal afterwards.
102+
// the target of processKdocMain and they are returned back to normal afterwards.
89103
tasks.withType<Jar> {
90104
dependsOn(processKDocsMain)
91105
outputs.upToDateWhen { false }
92106

93107
doFirst {
94-
kotlin {
95-
sourceSets {
96-
main {
97-
kotlin.setSrcDirs(
98-
processKDocsMain.targets +
99-
kotlinMainSources.filter { "build/generated" in it.path } // Include generated sources (which were excluded above)
100-
)
101-
}
102-
}
108+
kotlin.sourceSets.main {
109+
kotlin.setSrcDirs(
110+
processKDocsMain.targets +
111+
kotlinMainSources.filter { "build/generated" in it.path } // Include generated sources (which were excluded above)
112+
)
103113
}
104114
}
105115

106116
doLast {
107-
kotlin {
108-
sourceSets {
109-
main {
110-
kotlin.setSrcDirs(kotlinMainSources)
111-
}
112-
}
117+
kotlin.sourceSets.main {
118+
kotlin.setSrcDirs(kotlinMainSources)
113119
}
114120
}
115121
}
@@ -231,3 +237,13 @@ dataframes {
231237
name = "org.jetbrains.kotlinx.dataframe.samples.api.Repository"
232238
}
233239
}
240+
241+
// If we want to use Dokka, make sure to use the preprocessed sources
242+
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaLeafTask> {
243+
dependsOn(processKDocsMain)
244+
dokkaSourceSets {
245+
all {
246+
sourceRoot(processKDocsMain.target.get())
247+
}
248+
}
249+
}

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/aliases.kt

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,6 @@ public typealias RowValueExpression<T, C, R> = DataRow<T>.(it: C) -> R
7474
*/
7575
public typealias RowColumnExpression<T, C, R> = (row: DataRow<T>, col: DataColumn<C>) -> R
7676

77-
/**
78-
* [ColumnExpression] is used to express or select any instance of `R` using the given instance of [DataColumn]`<C>` as
79-
* `this` and `it`.
80-
*
81-
* Shorthand for:
82-
* ```kotlin
83-
* DataColumn<C>.(it: DataColumn<C>) -> R
84-
* ```
85-
*/
86-
public typealias ColumnExpression<C, R> = Selector<DataColumn<C>, R>
87-
8877
/**
8978
* [ColumnSelector] is used to express or select a single column, represented by [SingleColumn]`<C>`, using the
9079
* context of [ColumnsSelectionDsl]`<T>` as `this` and `it`.

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/ColumnsSelectionDsl.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@ import kotlin.reflect.KProperty
4141
import kotlin.reflect.KType
4242
import kotlin.reflect.typeOf
4343

44-
/** [Column Selection DSL][ColumnSelectionDsl] */
45-
internal interface ColumnSelectionDslLink
46-
47-
/** TODO: Put examples and explanations here */
4844
public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
4945

5046
public operator fun <C> ColumnReference<C>.invoke(): DataColumn<C> = get(this)
@@ -60,10 +56,6 @@ public interface ColumnSelectionDsl<out T> : ColumnsContainer<T> {
6056
public operator fun String.get(column: String): ColumnPath = pathOf(this, column)
6157
}
6258

63-
/** [Columns Selection DSL][ColumnsSelectionDsl] */
64-
internal interface ColumnsSelectionDslLink
65-
66-
/** TODO: Put examples and explanations here */
6759
public interface ColumnsSelectionDsl<out T> : ColumnSelectionDsl<T>, SingleColumn<DataRow<T>> {
6860

6961
public fun <C> ColumnSet<C>.first(condition: ColumnFilter<C>): SingleColumn<C> =

0 commit comments

Comments
 (0)