Skip to content

Commit 815a555

Browse files
Update dependencies and sample code to Kotlin 1.4.0
Linkify README
1 parent 7ac68cd commit 815a555

File tree

3 files changed

+26
-37
lines changed

3 files changed

+26
-37
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
# Full Stack JVM & JS App Hands-On Lab
55

6-
This repository is the code corresponding to the hands-on lab Full Stack JVM & JS App.
6+
This repository is the code corresponding to the hands-on lab [Building a Full Stack Web App with Kotlin Multiplatform](https://play.kotlinlang.org/hands-on/Full%20Stack%20Web%20App%20with%20Kotlin%20Multiplatform/).
77

8-
**The master branch is to be used as a template. If you would like to see the completed project, check out the final branch.**
8+
**The master branch is to be used as a template. If you would like to see the completed project, check out the [final](https://github.com/kotlin-hands-on/jvm-js-fullstack/tree/final) branch.**

build.gradle.kts

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpack
22

3-
val kotlinVersion = "1.3.71"
4-
val serializationVersion = "0.20.0"
5-
val ktorVersion = "1.3.2"
3+
val kotlinVersion = "1.4.0"
4+
val serializationVersion = "1.0.0-RC"
5+
val ktorVersion = "1.4.0"
66

77
plugins {
8-
kotlin("multiplatform") version "1.3.71"
8+
kotlin("multiplatform") version "1.4.0"
99
application //to run JVM part
10-
kotlin("plugin.serialization") version "1.3.70"
10+
kotlin("plugin.serialization") version "1.4.0"
1111
}
1212

1313
group = "org.example"
@@ -21,26 +21,21 @@ repositories {
2121
}
2222

2323
kotlin {
24-
/* Targets configuration omitted.
24+
/* Targets configuration omitted.
2525
* To find out how to configure the targets, please follow the link:
2626
* https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html#setting-up-targets */
2727

2828
jvm {
2929
withJava()
3030
}
3131
js {
32-
browser {
33-
dceTask {
34-
keep("ktor-ktor-io.\$\$importsForInline\$\$.ktor-ktor-io.io.ktor.utils.io")
35-
}
36-
}
32+
browser()
3733
}
3834
sourceSets {
3935
val commonMain by getting {
4036
dependencies {
4137
implementation(kotlin("stdlib-common"))
42-
implementation("io.ktor:ktor-serialization:$ktorVersion")
43-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serializationVersion")
38+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion")
4439
implementation("io.ktor:ktor-client-core:$ktorVersion")
4540
}
4641
}
@@ -53,41 +48,27 @@ kotlin {
5348

5449
val jvmMain by getting {
5550
dependencies {
51+
implementation("io.ktor:ktor-serialization:$ktorVersion")
5652
implementation("io.ktor:ktor-server-core:$ktorVersion")
5753
implementation("io.ktor:ktor-server-netty:$ktorVersion")
5854
implementation("ch.qos.logback:logback-classic:1.2.3")
59-
implementation(kotlin("stdlib", kotlinVersion)) // or "stdlib-jdk8"
60-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serializationVersion") // JVM dependency
6155
implementation("io.ktor:ktor-websockets:$ktorVersion")
62-
63-
implementation("org.litote.kmongo:kmongo-coroutine-serialization:3.12.2")
56+
implementation("org.litote.kmongo:kmongo-coroutine-serialization:4.1.1")
6457
}
6558
}
6659

6760
val jsMain by getting {
6861
dependencies {
69-
implementation(kotlin("stdlib-js"))
70-
71-
implementation("org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serializationVersion")
72-
//todo: bugfix in kx.serialization?
73-
implementation(npm("text-encoding"))
74-
implementation(npm("abort-controller"))
75-
7662
implementation("io.ktor:ktor-client-js:$ktorVersion") //include http&websockets
77-
//todo: bugfix in ktor-client?
78-
implementation(npm("bufferutil")) //TODO: Uncomment this and stuff breaks. WHY?
79-
implementation(npm("utf-8-validate"))
8063

8164
//ktor client js json
8265
implementation("io.ktor:ktor-client-json-js:$ktorVersion")
8366
implementation("io.ktor:ktor-client-serialization-js:$ktorVersion")
84-
implementation(npm("fs"))
8567

86-
//React, React DOM + Wrappers (chapter 3)
87-
implementation("org.jetbrains:kotlin-react:16.13.0-pre.93-kotlin-1.3.70")
88-
implementation("org.jetbrains:kotlin-react-dom:16.13.0-pre.93-kotlin-1.3.70")
89-
implementation(npm("react", "16.13.0"))
90-
implementation(npm("react-dom", "16.13.0"))
68+
implementation("org.jetbrains:kotlin-react:16.13.1-pre.110-kotlin-1.4.0")
69+
implementation("org.jetbrains:kotlin-react-dom:16.13.1-pre.110-kotlin-1.4.0")
70+
implementation(npm("react", "16.13.1"))
71+
implementation(npm("react-dom", "16.13.1"))
9172
}
9273
}
9374
}
@@ -109,6 +90,14 @@ tasks.getByName<Jar>("jvmJar") {
10990
from(File(webpackTask.destinationDirectory, webpackTask.outputFileName)) // bring output file along into the JAR
11091
}
11192

93+
tasks {
94+
withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
95+
kotlinOptions {
96+
jvmTarget = "1.8"
97+
}
98+
}
99+
}
100+
112101
distributions {
113102
main {
114103
contents {
@@ -120,7 +109,7 @@ distributions {
120109
}
121110
}
122111

123-
// Alias "installDist" as "stage" for Heroku
112+
// Alias "installDist" as "stage" (for cloud providers)
124113
tasks.create("stage") {
125114
dependsOn(tasks.getByName("installDist"))
126115
}

src/jsMain/kotlin/Main.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import kotlin.browser.document
1+
import kotlinx.browser.document
22

33
fun main() {
44
document.getElementById("root")?.innerHTML = "Hello, Kotlin/JS!"

0 commit comments

Comments
 (0)