Skip to content

Commit 178a094

Browse files
authored
Split the Gradle and Kotlin build snippets for Android and Server-side (#400)
* Fixed for Android * Fixed review * Fixed for Android
1 parent d5280cc commit 178a094

File tree

1 file changed

+97
-9
lines changed

1 file changed

+97
-9
lines changed

README.md

Lines changed: 97 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
[![Maven Central](https://img.shields.io/maven-central/v/org.jetbrains.kotlinx/dataframe?color=blue&label=Maven%20Central)](https://search.maven.org/artifact/org.jetbrains.kotlinx/dataframe)
66
[![GitHub License](https://img.shields.io/badge/license-Apache%20License%202.0-blue.svg?style=flat)](http://www.apache.org/licenses/LICENSE-2.0)
77

8-
Kotlin Dataframe aims to reconcile Kotlin static typing with dynamic nature of data by utilizing both the full power of Kotlin language and opportunities provided by intermittent code execution in Jupyter notebooks and REPL.
8+
Kotlin Dataframe aims to reconcile Kotlin's static typing with the dynamic nature of data by utilizing both the full power of the Kotlin language and the opportunities provided by intermittent code execution in Jupyter notebooks and REPL.
99

1010
* **Hierarchical** — represents hierarchical data structures, such as JSON or a tree of JVM objects.
1111
* **Functional** — data processing pipeline is organized in a chain of `DataFrame` transformation operations. Every operation returns a new instance of `DataFrame` reusing underlying storage wherever it's possible.
1212
* **Readable** — data transformation operations are defined in DSL close to natural language.
13-
* **Practical** — provides simple solutions for common problems and ability to perform complex tasks.
13+
* **Practical** — provides simple solutions for common problems and the ability to perform complex tasks.
1414
* **Minimalistic** — simple, yet powerful data model of three column kinds.
1515
* **Interoperable** — convertable with Kotlin data classes and collections.
1616
* **Generic** — can store objects of any type, not only numbers or strings.
@@ -23,23 +23,105 @@ Explore [**documentation**](https://kotlin.github.io/dataframe/overview.html) fo
2323

2424
## Setup
2525

26-
### Gradle
26+
### Gradle for JVM
27+
```groovy
28+
// build.gradle
29+
30+
plugins {
31+
// Optional Gradle plugin for enhanced type safety and schema generation
32+
// https://kotlin.github.io/dataframe/gradle.html
33+
id 'org.jetbrains.kotlinx.dataframe' version '0.10.1'
34+
}
35+
36+
repositories {
37+
mavenCentral()
38+
}
39+
40+
dependencies {
41+
implementation 'org.jetbrains.kotlinx:dataframe:0.10.1'
42+
}
43+
```
44+
2745
```kotlin
46+
// build.gradle.kts
47+
2848
plugins {
2949
// Optional Gradle plugin for enhanced type safety and schema generation
3050
// https://kotlin.github.io/dataframe/gradle.html
31-
id("org.jetbrains.kotlinx.dataframe") version "0.10.0"
51+
id("org.jetbrains.kotlinx.dataframe") version "0.10.1"
3252
}
3353

3454
repositories {
3555
mavenCentral()
3656
}
3757

3858
dependencies {
39-
implementation("org.jetbrains.kotlinx:dataframe:0.10.0")
59+
implementation("org.jetbrains.kotlinx:dataframe:0.10.1")
60+
}
61+
```
62+
63+
### Gradle for Android
64+
```groovy
65+
// build.gradle
66+
67+
plugins {
68+
// Optional Gradle plugin for enhanced type safety and schema generation
69+
// https://kotlin.github.io/dataframe/gradle.html
70+
id 'org.jetbrains.kotlinx.dataframe' version '0.10.1'
71+
}
72+
73+
dependencies {
74+
implementation 'org.jetbrains.kotlinx:dataframe:0.10.1'
75+
}
76+
77+
android {
78+
defaultConfig {
79+
minSdk 26 // Android O+
80+
}
81+
compileOptions {
82+
sourceCompatibility JavaVersion.VERSION_1_8
83+
targetCompatibility JavaVersion.VERSION_1_8
84+
}
85+
kotlinOptions {
86+
jvmTarget = '1.8'
87+
}
88+
packagingOptions {
89+
resources {
90+
pickFirsts = ["META-INF/AL2.0",
91+
"META-INF/LGPL2.1",
92+
"META-INF/ASL-2.0.txt",
93+
"META-INF/LICENSE.md",
94+
"META-INF/NOTICE.md",
95+
"META-INF/LGPL-3.0.txt"]
96+
excludes = ["META-INF/kotlin-jupyter-libraries/libraries.json",
97+
"META-INF/{INDEX.LIST,DEPENDENCIES}",
98+
"{draftv3,draftv4}/schema",
99+
"arrow-git.properties"]
100+
}
101+
}
102+
}
103+
104+
// optional, could be required for KSP
105+
tasks.withType(KotlinCompile).configureEach {
106+
kotlinOptions {
107+
jvmTarget = '1.8'
108+
}
109+
}
110+
```
111+
112+
```kotlin
113+
// build.gradle.kts
114+
115+
plugins {
116+
// Optional Gradle plugin for enhanced type safety and schema generation
117+
// https://kotlin.github.io/dataframe/gradle.html
118+
id("org.jetbrains.kotlinx.dataframe") version "0.10.1"
119+
}
120+
121+
dependencies {
122+
implementation("org.jetbrains.kotlinx:dataframe:0.10.1")
40123
}
41124

42-
// Below only applies to Android projects
43125
android {
44126
defaultConfig {
45127
minSdk = 26 // Android O+
@@ -70,10 +152,13 @@ android {
70152
}
71153
}
72154
}
73-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
155+
156+
// required for KSP
157+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
74158
kotlinOptions.jvmTarget = "1.8"
75159
}
76160
```
161+
77162
### Jupyter Notebook
78163

79164
Install [Kotlin kernel](https://github.com/Kotlin/kotlin-jupyter) for [Jupyter](https://jupyter.org/)
@@ -97,7 +182,7 @@ or specific version:
97182

98183
## Kotlin, Kotlin Jupyter, OpenAPI, Arrow and JDK versions
99184

100-
This table shows the mapping between main library components versions and minimum supported Java versions.
185+
This table shows the mapping between main library component versions and minimum supported Java versions.
101186

102187
| Kotlin DataFrame Version | Minimum Java Version | Kotlin Version | Kotlin Jupyter Version | OpenAPI version | Apache Arrow version |
103188
|--------------------------|----------------------|----------------|------------------------|-----------------|----------------------|
@@ -116,6 +201,9 @@ val airline by columnOf("KLM(!)", "{Air France} (12)", "(British Airways. )", "1
116201

117202
// create dataframe
118203
val df = dataFrameOf(fromTo, flightNumber, recentDelays, airline)
204+
205+
// print dataframe
206+
df.print()
119207
```
120208

121209
**Clean:**
@@ -155,7 +243,7 @@ val clean = df
155243
clean
156244
// group by the flight origin renamed into "from"
157245
.groupBy { origin named "from" }.aggregate {
158-
// we are in the context of single data group
246+
// we are in the context of a single data group
159247

160248
// total number of flights from origin
161249
count() into "count"

0 commit comments

Comments
 (0)