Skip to content

Commit 4acbfe4

Browse files
update setup section
1 parent 4a3ca6f commit 4acbfe4

14 files changed

+304
-211
lines changed

docs/StardustDocs/d.tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,4 +194,5 @@
194194
<toc-element topic="Support.md"/>
195195
<toc-element topic="FAQ.md"/>
196196
<toc-element topic="Migration-From-Plugins.md"/>
197+
<toc-element topic="SetupCustomGradle.md"/>
197198
</instance-profile>
-79.1 KB
Binary file not shown.
-79.1 KB
Binary file not shown.
-119 KB
Binary file not shown.
-119 KB
Binary file not shown.
96.6 KB
Loading
74.4 KB
Loading

docs/StardustDocs/topics/gettingStarted/Modules.md

Lines changed: 48 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,8 @@ Provides functionality to support auto-generated data schemas from OpenAPI 3.0.0
420420
This module is a companion to [`dataframe-openapi-generator`](#dataframe-openapi-generator):
421421

422422
- `dataframe-openapi-generator` is used internally by the Gradle plugin and Jupyter integration
423-
to generate data schemas from OpenAPI specs.
424-
In the Gradle plugin, it powers the `dataschemas {}` DSL and the `@file:ImportDataSchema()` annotation.
423+
to generate data schemas from OpenAPI specs.
424+
In the Gradle plugin, it powers the `dataschemas {}` DSL and the `@file:ImportDataSchema()` annotation.
425425
In Jupyter, it enables the `importDataSchema()` function.
426426

427427
- `dataframe-openapi` must be added as a dependency to the user project in order to use those generated data schemas.
@@ -454,11 +454,11 @@ dependencies {
454454

455455
#### `dataframe-openapi-generator`
456456

457-
Provides the logic and tooling necessary to import OpenAPI 3.0.0 specifications
458-
as auto-generated data schemas for Kotlin DataFrame.
457+
Provides the logic and tooling necessary to import OpenAPI 3.0.0 specifications
458+
as auto-generated data schemas for Kotlin DataFrame.
459459
This module works in conjunction with [`dataframe-openapi`](#dataframe-openapi):
460460

461-
- `dataframe-openapi-generator` is used internally by the Gradle plugin and Jupyter integration
461+
- `dataframe-openapi-generator` is used internally by the Gradle plugin and Jupyter integration
462462
to generate data schemas from OpenAPI specifications.
463463
- In Gradle, it enables the `dataschemas {}` DSL and the `@file:ImportDataSchema()` annotation.
464464
- In Jupyter, it powers the `importDataSchema()` function.
@@ -497,27 +497,61 @@ dependencies {
497497

498498
#### `kotlin.plugin.dataframe` — Kotlin DataFrame Compiler Plugin {id="kotlin.plugin.dataframe"}
499499

500-
The Kotlin DataFrame compiler plugin enables support for [extension properties](extensionPropertiesApi.md)
501-
in Gradle projects, allowing you to work with dataframes in a name- and type-safe manner.
500+
[Kotlin DataFrame Compiler Plugin](Compiler-Plugin.md) enables automatic generation of
501+
[extension properties](extensionPropertiesApi.md) and updates [data schemas](schemas.md)
502+
on-the-fly in Gradle projects, making development with Kotlin DataFrame faster,
503+
more convenient, and fully type- and name-safe.
504+
505+
> Requires Kotlin 2.2.20-Beta1 or higher.
506+
> { style = "note" }
507+
508+
To enable the plugin in your Gradle project, add it to the `plugins` section:
509+
510+
<tabs>
511+
<tab title="Kotlin DSL">
512+
513+
```kotlin
514+
plugins {
515+
kotlin("plugin.dataframe") version "2.2.20-Beta1"
516+
}
517+
```
518+
519+
</tab>
520+
521+
<tab title="Groovy DSL">
502522

503-
See the [Compiler Plugin setup guide](Compiler-Plugin.md#setup) for installation
504-
and usage instructions for Gradle projects.
523+
```groovy
524+
plugins {
525+
id 'org.jetbrains.kotlin.plugin.dataframe' version '2.2.20-Beta1'
526+
}
527+
```
528+
529+
</tab>
530+
</tabs>
531+
532+
Due to [this issue](https://youtrack.jetbrains.com/issue/KT-66735), incremental compilation must be disabled for now.
533+
Add the following line to your `gradle.properties` file:
534+
535+
```properties
536+
kotlin.incremental=false
537+
```
505538

506539
Published as a Kotlin official plugin.
507540
[Source code is available in the Kotlin repository](https://github.com/JetBrains/kotlin/tree/master/plugins/kotlin-dataframe).
508541

509542
#### `kotlinx.dataframe` – Gradle Plugin {id="kotlinx.dataframe"}
510543

511-
> The current Gradle plugin is **under consideration for deprecation** and may be officially marked as deprecated in future releases.
544+
> The current Gradle plugin is **under consideration for deprecation**
545+
> and may be officially marked as deprecated in future releases.
512546
>
513547
> At the moment, **[data schema generation is handled via dedicated methods](DataSchemaGenerationMethods.md)** instead of relying on the plugin.
514548
{style="warning"}
515549

516-
The Gradle plugin allows generating [data schemas](schemas.md) from samples of data
550+
The Gradle plugin allows generating [data schemas](schemas.md) from samples of data
517551
(of supported formats) like JSON, CSV, Excel files, or URLs, as well as from data fetched from SQL databases
518552
using Gradle.
519553

520-
See the [Gradle Plugin Reference](Gradle-Plugin.md) for installation
554+
See the [Gradle Plugin Reference](Gradle-Plugin.md) for installation
521555
and usage instructions in Gradle projects.
522556

523557
> By default, the Gradle plugin also applies the [KSP plugin](#ksp-plugin).
@@ -552,8 +586,8 @@ plugins {
552586
> At the moment, **[data schema generation is handled via dedicated methods](DataSchemaGenerationMethods.md)** instead of relying on the plugin.
553587
{style="warning"}
554588

555-
The Gradle plugin allows generating [data schemas](schemas.md) from samples of data
556-
(of supported formats) like JSON, CSV, Excel files, or URLs, as well as from data fetched from SQL databases
589+
The Gradle plugin allows generating [data schemas](schemas.md) from samples of data
590+
(of supported formats) like JSON, CSV, Excel files, or URLs, as well as from data fetched from SQL databases
557591
using Kotlin Symbol Processing (KSP).
558592
This is useful for projects where you prefer or require schema generation at the source level.
559593

Lines changed: 53 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
[//]: # (title: Setup Kotlin DataFrame on Android)
22

3-
## Gradle
3+
<web-summary>
4+
Integrate Kotlin DataFrame into your Android app using the standard JVM dependency and simple Gradle configuration.
5+
</web-summary>
46

5-
The Kotlin DataFrame library is published to Maven Central,
6-
so you can add the following line to your Kotlin DSL
7-
buildscript to depend on it:
7+
<card-summary>
8+
Set up Kotlin DataFrame in Android — configure it easily using Gradle and start working with structured data.
9+
</card-summary>
810

9-
### General configuration
11+
<link-summary>
12+
How to use Kotlin DataFrame in your Android project with Gradle setup and compiler plugin support.
13+
</link-summary>
14+
15+
> See an [Android project example](https://github.com/Kotlin/dataframe/tree/master/examples/android-example).
16+
17+
Kotlin DataFrame doesn't provide a dedicated Android artifact yet,
18+
but you can add the Kotlin DataFrame JVM dependency to your Android project with minimal configuration:
1019

1120
<tabs>
1221
<tab title="Kotlin DSL">
1322

1423
```kotlin
15-
plugins {
16-
id("org.jetbrains.kotlinx.dataframe") version "%dataFrameVersion%"
17-
}
18-
1924
dependencies {
2025
implementation("org.jetbrains.kotlinx:dataframe:%dataFrameVersion%")
2126
}
2227

23-
// Below only applies to Android projects
2428
android {
29+
// Requires Android 0+, i.e. SDK version 26 or higher.
2530
defaultConfig {
26-
minSdk = 26 // Android O+
31+
minSdk = 26
2732
}
33+
// Requires Java 8 or higher
2834
compileOptions {
2935
sourceCompatibility = JavaVersion.VERSION_1_8
3036
targetCompatibility = JavaVersion.VERSION_1_8
@@ -62,19 +68,16 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
6268
<tab title="Groovy DSL">
6369

6470
```groovy
65-
plugins {
66-
id "org.jetbrains.kotlinx.dataframe" version "%dataFrameVersion%"
67-
}
68-
6971
dependencies {
7072
implementation 'org.jetbrains.kotlinx:dataframe:%dataFrameVersion%'
7173
}
7274
73-
// Below only applies to Android projects
7475
android {
76+
// Requires Android 0+, i.e. SDK version 26 or higher.
7577
defaultConfig {
76-
minSdk 26 // Android O+
78+
minSdk 26
7779
}
80+
// Requires Java 8 or higher
7881
compileOptions {
7982
sourceCompatibility JavaVersion.VERSION_1_8
8083
targetCompatibility JavaVersion.VERSION_1_8
@@ -91,6 +94,7 @@ android {
9194
"META-INF/LICENSE.md",
9295
"META-INF/NOTICE.md",
9396
"META-INF/LGPL-3.0.txt",
97+
"META-INF/thirdparty-LICENSE",
9498
]
9599
excludes += [
96100
"META-INF/kotlin-jupyter-libraries/libraries.json",
@@ -107,101 +111,32 @@ tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
107111
```
108112

109113
</tab>
110-
111114
</tabs>
112115

113-
Note that it's better to use the same version for a library and plugin to avoid unpredictable errors.
114-
After plugin configuration, you can try it out, for [example](schemasGradle.md#annotation-processing).
116+
This setup adds the [general Kotlin DataFrame dependency](Modules.md#dataframe-general),
117+
which includes the [core API and implementation](Modules.md#dataframe-core)
118+
as well as all [IO modules](Modules.md#io-modules)
119+
(excluding [experimental ones](Modules.md#experimental-modules)).
120+
For flexible configuration, see [Custom configuration](SetupCustomGradle.md).
115121

116-
### Custom configuration
122+
## Kotlin DataFrame Compiler Plugin
117123

118-
If you want to avoid adding unnecessary dependencies, you can choose from the following artifacts:
124+
[Kotlin DataFrame Compiler Plugin](Compiler-Plugin.md) enables automatic generation
125+
of [extension properties](extensionPropertiesApi.md) and updates [data schemas](schemas.md)
126+
on-the-fly in Android projects, making development with Kotlin DataFrame
127+
faster, more convenient, and fully type- and name-safe.
119128

120-
<tabs>
121-
<tab title="Kotlin DSL">
129+
> Requires Kotlin 2.2.20-Beta1 or higher.
130+
> { style = "note" }
122131
123-
```kotlin
124-
dependencies {
125-
// Artifact containing all APIs and implementations
126-
implementation("org.jetbrains.kotlinx:dataframe-core:%dataFrameVersion%")
127-
// Optional formats support
128-
implementation("org.jetbrains.kotlinx:dataframe-json:%dataFrameVersion%")
129-
implementation("org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%")
130-
implementation("org.jetbrains.kotlinx:dataframe-excel:%dataFrameVersion%")
131-
implementation("org.jetbrains.kotlinx:dataframe-jdbc:%dataFrameVersion%")
132-
implementation("org.jetbrains.kotlinx:dataframe-arrow:%dataFrameVersion%")
133-
134-
// experimental
135-
implementation("org.jetbrains.kotlinx:dataframe-openapi:%dataFrameVersion%")
136-
137-
// experimental
138-
// This artifact is only needed to directly call functions that generate @DataSchema code from OpenAPI specifications
139-
// It's used by Gradle and KSP plugins internally.
140-
// Your project needs dataframe-openapi to use generated code
141-
implementation("org.jetbrains.kotlinx:dataframe-openapi-generator:%dataFrameVersion%")
142-
}
143-
```
144-
145-
</tab>
146-
147-
<tab title="Groovy DSL">
148-
149-
```groovy
150-
dependencies {
151-
// Artifact containing all APIs and implementations
152-
implementation 'org.jetbrains.kotlinx:dataframe-core:%dataFrameVersion%'
153-
// Optional formats support
154-
implementation 'org.jetbrains.kotlinx:dataframe-json:%dataFrameVersion%'
155-
implementation 'org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%'
156-
implementation 'org.jetbrains.kotlinx:dataframe-excel:%dataFrameVersion%'
157-
implementation 'org.jetbrains.kotlinx:dataframe-jdbc:%dataFrameVersion%'
158-
implementation 'org.jetbrains.kotlinx:dataframe-arrow:%dataFrameVersion%'
159-
160-
// experimental
161-
implementation 'org.jetbrains.kotlinx:dataframe-openapi:%dataFrameVersion%'
162-
163-
// experimental
164-
// This artifact is only needed to directly call functions that generate @DataSchema code from OpenAPI specifications
165-
// It's used by Gradle and KSP plugins internally.
166-
// Your project needs dataframe-openapi to use generated code
167-
implementation 'org.jetbrains.kotlinx:dataframe-openapi-generator:%dataFrameVersion%'
168-
}
169-
```
170-
171-
</tab>
172-
173-
</tabs>
174-
175-
<note>
176-
`dataframe-json` is included with `dataframe-csv` and `dataframe-excel` by default. This is to interact with
177-
JSON structures inside CSV and Excel files. If you don't need this functionality, you can exclude it like:
178-
```kts
179-
implementation("org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%") {
180-
exclude("org.jetbrains.kotlinx", "dataframe-json")
181-
}
182-
```
183-
</note>
184-
185-
#### Linter configuration
186-
187-
We provide a Gradle plugin that generates interfaces with your data.
188-
If you're using any sort of linter, it might complain about them generated sources.
189-
190-
Use a configuration similar to this to prevent your linter from complaining about the
191-
formatting of the generated sources.
132+
To enable the plugin in your Gradle project, add it to the `plugins` section:
192133

193134
<tabs>
194135
<tab title="Kotlin DSL">
195136

196137
```kotlin
197-
// Exclusions for `kotlinter`, if you use it:
198-
tasks.withType<org.jmailen.gradle.kotlinter.tasks.LintTask> {
199-
exclude {
200-
it.name.endsWith(".Generated.kt")
201-
}
202-
exclude {
203-
it.name.endsWith("\$Extensions.kt")
204-
}
138+
plugins {
139+
kotlin("plugin.dataframe") version "2.2.20-Beta1"
205140
}
206141
```
207142

@@ -210,25 +145,28 @@ tasks.withType<org.jmailen.gradle.kotlinter.tasks.LintTask> {
210145
<tab title="Groovy DSL">
211146

212147
```groovy
213-
// Exclusions for `kotlinter`, if you use it:
214-
tasks.withType(org.jmailen.gradle.kotlinter.tasks.LintTask).all {
215-
exclude {
216-
it.name.endsWith(".Generated.kt")
217-
}
218-
exclude {
219-
it.name.endsWith("\$Extensions.kt")
220-
}
148+
plugins {
149+
id 'org.jetbrains.kotlin.plugin.dataframe' version '2.2.20-Beta1'
221150
}
222151
```
223152

224153
</tab>
225-
<tab title=".editorconfig">
154+
</tabs>
155+
156+
Due to [this issue](https://youtrack.jetbrains.com/issue/KT-66735), incremental compilation must be disabled for now.
157+
Add the following line to your `gradle.properties` file:
226158

227-
```editorconfig
228-
[{**/*.Generated.kt,**/*$Extensions.kt}]
229-
ktlint = disabled
159+
```properties
160+
kotlin.incremental=false
230161
```
231162

232-
</tab>
163+
## Next Steps
233164

234-
</tabs>
165+
* Once Kotlin DataFrame is set up in your Android project, continue with the [](quickstart.md)
166+
to learn the basics of working with DataFrames.
167+
* Explore [detailed guides and real-world examples](Guides-And-Examples.md)
168+
to see how Kotlin DataFrame helps in different data tasks.
169+
* Check out the
170+
[Android project example](https://github.com/Kotlin/dataframe/tree/master/examples/android-example)
171+
and more [IDEA examples on GitHub](https://github.com/Kotlin/dataframe/tree/master/examples/idea-examples).
172+
* Learn more about the [compiler plugin](Compiler-Plugin.md).

0 commit comments

Comments
 (0)