Skip to content

Commit 1847649

Browse files
authored
KTOR-5512 Apply Ktor Gradle plugin to all sample projects and remove specific versions for artifacts (#153)
* KTOR-5512 Apply Ktor Gradle plugin and remove specific versions of Ktor dependencies for chat application * KTOR-5512 Gradle plugin portal shortcut for chat application * KTOR-5512 Apply ktor-bom dependency to client-mpp sample * KTOR-5512 Apply Ktor plugin to client-multipart sample * KTOR-5512 Apply Ktor plugin to client-tools sample * KTOR-5512 Remove specific versions from di-kodein sample * KTOR-5512 Remove specific versions from filelisting sample * KTOR-5512 Add ktor-bom dependency to fullstack-mpp sample * KTOR-5512 Simplify configuration for chat sample * KTOR-5512 Apply Ktor plugin to graalvm sample * KTOR-5512 Apply Ktor plugin to h2 sample * KTOR-5512 Remove specific versions of httpbin sample * KTOR-5512 Remove specific versions of kweet sample * KTOR-5512 Remove specific versions of location-header sample * KTOR-5512 Add ktor-bom dependency to maven-google-appengine sample * KTOR-5512 Remove specific versions from redirect-with-exception sample * KTOR-5512 Remove specific versions from reverse-proxy sample * KTOR-5512 Remove specific versions from reverse-proxy-ws sample * KTOR-5512 Remove specific versions from rx sample * KTOR-5512 Remove specific versions from sse sample * KTOR-5512 Remove specific versions from structured-logging sample * KTOR-5512 Remove specific versions from version-diff sample * KTOR-5512 Remove specific versions from youkube sample
1 parent b9ebdfc commit 1847649

35 files changed

+153
-149
lines changed

chat/build.gradle

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -17,50 +17,52 @@ kotlin {
1717
enabled = false
1818
}
1919

20-
dceTask {
21-
keep 'ktor-ktor-io.\$\$importsForInline\$\$.ktor-ktor-io.io.ktor.utils.io'
22-
}
23-
2420
distribution {
2521
directory = file("$projectDir/src/backendMain/resources/web")
2622
}
2723
}
2824
}
2925
jvm('backend') {
3026
compilations.main {
31-
tasks.getByName(processResourcesTaskName) {
27+
tasks.named(processResourcesTaskName) {
3228
dependsOn(frontendBrowserWebpack)
3329
}
3430
}
3531
}
3632
}
3733

34+
sourceSets.each {
35+
it.dependencies {
36+
implementation(project.dependencies.enforcedPlatform("io.ktor:ktor-bom:2.2.3"))
37+
}
38+
}
39+
3840
sourceSets {
3941
backendMain {
4042
dependencies {
4143
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20"
42-
implementation "io.ktor:ktor-server-netty:2.2.3"
43-
implementation "io.ktor:ktor-server-websockets:2.2.3"
44-
implementation "io.ktor:ktor-server-call-logging:2.2.3"
45-
implementation "io.ktor:ktor-server-default-headers:2.2.3"
46-
implementation "io.ktor:ktor-server-sessions:2.2.3"
44+
implementation "io.ktor:ktor-server-netty"
45+
implementation "io.ktor:ktor-server-websockets"
46+
implementation "io.ktor:ktor-server-call-logging"
47+
implementation "io.ktor:ktor-server-default-headers"
48+
implementation "io.ktor:ktor-server-sessions"
4749
implementation "ch.qos.logback:logback-classic:1.2.11"
4850
}
4951
}
5052

5153
backendTest {
5254
dependencies {
53-
implementation "io.ktor:ktor-server-test-host:2.2.3"
54-
implementation "io.ktor:ktor-client-websockets:2.2.3"
55+
implementation "io.ktor:ktor-server-test-host"
56+
implementation "io.ktor:ktor-client-websockets"
5557
implementation "org.jetbrains.kotlin:kotlin-test"
5658
}
5759
}
5860

5961
frontendMain {
6062
dependencies {
6163
implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
62-
implementation "io.ktor:ktor-client-websockets:2.2.3"
63-
implementation "io.ktor:ktor-client-js:2.2.3"
64+
implementation "io.ktor:ktor-client-websockets"
65+
implementation "io.ktor:ktor-client-js"
6466
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.6.4"
6567
}
6668
}
@@ -71,9 +73,9 @@ repositories {
7173
mavenCentral()
7274
}
7375

74-
task run(type: JavaExec, dependsOn: [backendJar]) {
75-
main = "io.ktor.samples.chat.backend.ChatApplicationKt"
76+
tasks.register("run", JavaExec) {
77+
dependsOn(backendJar)
78+
mainClass.set("io.ktor.samples.chat.backend.ChatApplicationKt")
7679
classpath(configurations.backendRuntimeClasspath, backendJar)
7780
args = []
7881
}
79-

client-mpp/shared/build.gradle

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@ kotlin {
1616
js(IR) {
1717
browser()
1818
}
19+
20+
sourceSets.each {
21+
it.dependencies {
22+
implementation(project.dependencies.enforcedPlatform("io.ktor:ktor-bom:2.2.3"))
23+
}
24+
}
25+
1926
sourceSets {
2027
commonMain {
2128
dependencies {
22-
implementation "io.ktor:ktor-client-core:2.2.3"
29+
implementation "io.ktor:ktor-client-core"
2330
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4"
2431
}
2532
}
@@ -33,7 +40,7 @@ kotlin {
3340
dependencies {
3441
implementation 'com.google.android.material:material:1.6.4'
3542
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4"
36-
implementation "io.ktor:ktor-client-android:2.2.3"
43+
implementation "io.ktor:ktor-client-android"
3744
}
3845
}
3946
androidTest {
@@ -44,21 +51,21 @@ kotlin {
4451
}
4552
iosMain {
4653
dependencies {
47-
implementation "io.ktor:ktor-client-ios:2.2.3"
54+
implementation "io.ktor:ktor-client-ios"
4855
}
4956
}
5057
iosTest {
5158

5259
}
5360
jsMain {
5461
dependencies {
55-
implementation "io.ktor:ktor-client-js:2.2.3"
62+
implementation "io.ktor:ktor-client-js"
5663
}
5764
}
5865
macosX64Main {
5966
dependencies {
60-
implementation "io.ktor:ktor-client-core:2.2.3"
61-
implementation "io.ktor:ktor-client-curl:2.2.3"
67+
implementation "io.ktor:ktor-client-core"
68+
implementation "io.ktor:ktor-client-curl"
6269
}
6370
}
6471
}

client-multipart/build.gradle

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
buildscript {
22
repositories {
33
mavenCentral()
4+
gradlePluginPortal()
45
}
56
dependencies {
67
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
8+
classpath "io.ktor.plugin:plugin:2.2.3"
79
}
810
}
911

1012
apply plugin: 'kotlin'
1113
apply plugin: 'application'
14+
apply plugin: 'io.ktor.plugin'
1215

1316
mainClassName = "io.ktor.samples.clientmultipart.MultipartAppKt"
1417

@@ -25,9 +28,9 @@ repositories {
2528

2629
dependencies {
2730
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20'
28-
implementation "io.ktor:ktor-server-html-builder:2.2.3"
31+
implementation "io.ktor:ktor-server-html-builder"
2932
implementation 'ch.qos.logback:logback-classic:1.2.11'
30-
implementation 'io.ktor:ktor-server-netty-jvm:2.2.3'
31-
implementation 'io.ktor:ktor-client-cio-jvm:2.2.3'
33+
implementation 'io.ktor:ktor-server-netty-jvm'
34+
implementation 'io.ktor:ktor-client-cio-jvm'
3235
}
3336

client-tools/build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
buildscript {
22
repositories {
33
mavenCentral()
4+
gradlePluginPortal()
45
}
56
dependencies {
67
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20"
8+
classpath "io.ktor.plugin:plugin:2.2.3"
79
}
810
}
911

1012
apply plugin: 'kotlin'
1113
apply plugin: 'application'
14+
apply plugin: 'io.ktor.plugin'
1215

13-
mainClassName = "io.ktor.samples.clientmultipart.MultipartAppKt"
16+
mainClassName = "ToolsAppKt"
1417

1518
sourceSets {
1619
main.kotlin.srcDirs = ['src']
@@ -25,9 +28,9 @@ repositories {
2528

2629
dependencies {
2730
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.20'
28-
implementation "io.ktor:ktor-server-html-builder:2.2.3"
31+
implementation "io.ktor:ktor-server-html-builder"
2932
implementation 'ch.qos.logback:logback-classic:1.2.9'
30-
implementation 'io.ktor:ktor-server-netty-jvm:2.2.3'
31-
implementation 'io.ktor:ktor-client-cio-jvm:2.2.3'
33+
implementation 'io.ktor:ktor-server-netty-jvm'
34+
implementation 'io.ktor:ktor-client-cio-jvm'
3235
}
3336

di-kodein/build.gradle.kts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
val ktor_version: String by project
21
val kotlin_version: String by project
32
val logback_version: String by project
43

@@ -17,13 +16,13 @@ repositories {
1716
}
1817

1918
dependencies {
20-
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
21-
implementation("io.ktor:ktor-server-netty-jvm:$ktor_version")
22-
implementation("io.ktor:ktor-server-resources:$ktor_version")
23-
implementation("io.ktor:ktor-server-default-headers:$ktor_version")
24-
implementation("io.ktor:ktor-server-html-builder:$ktor_version")
19+
implementation("io.ktor:ktor-server-core-jvm")
20+
implementation("io.ktor:ktor-server-netty-jvm")
21+
implementation("io.ktor:ktor-server-resources")
22+
implementation("io.ktor:ktor-server-default-headers")
23+
implementation("io.ktor:ktor-server-html-builder")
2524
implementation("org.kodein.di:kodein-di-jvm:7.17.0")
2625
implementation("ch.qos.logback:logback-classic:$logback_version")
27-
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")
26+
testImplementation("io.ktor:ktor-server-tests-jvm")
2827
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
2928
}

di-kodein/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
ktor_version=2.2.3
21
kotlin_version=1.8.0
32
logback_version=1.2.11
43
kotlin.code.style=official

filelisting/build.gradle.kts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
val ktor_version: String by project
21
val kotlin_version: String by project
32
val logback_version: String by project
43

@@ -16,12 +15,12 @@ repositories {
1615
}
1716

1817
dependencies {
19-
implementation("io.ktor:ktor-server-core-jvm:$ktor_version")
20-
implementation("io.ktor:ktor-server-netty-jvm:$ktor_version")
21-
implementation("io.ktor:ktor-server-default-headers:$ktor_version")
22-
implementation("io.ktor:ktor-server-html-builder:$ktor_version")
23-
implementation("io.ktor:ktor-server-call-logging:$ktor_version")
18+
implementation("io.ktor:ktor-server-core-jvm")
19+
implementation("io.ktor:ktor-server-netty-jvm")
20+
implementation("io.ktor:ktor-server-default-headers")
21+
implementation("io.ktor:ktor-server-html-builder")
22+
implementation("io.ktor:ktor-server-call-logging")
23+
testImplementation("io.ktor:ktor-server-tests-jvm")
2424
implementation("ch.qos.logback:logback-classic:$logback_version")
25-
testImplementation("io.ktor:ktor-server-tests-jvm:$ktor_version")
2625
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlin_version")
2726
}

filelisting/gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
ktor_version=2.2.3
21
kotlin_version=1.8.0
32
logback_version=1.2.11
43
kotlin.code.style=official

fullstack-mpp/build.gradle

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ kotlin {
2626
}
2727
}
2828

29+
sourceSets.each {
30+
it.dependencies {
31+
implementation(project.dependencies.enforcedPlatform("io.ktor:ktor-bom:2.2.3"))
32+
}
33+
}
34+
2935
sourceSets {
3036
commonTest {
3137
dependencies {
@@ -35,8 +41,8 @@ kotlin {
3541
}
3642
backendMain {
3743
dependencies {
38-
implementation "io.ktor:ktor-server-netty:2.2.3"
39-
implementation "io.ktor:ktor-server-html-builder:2.2.3"
44+
implementation "io.ktor:ktor-server-netty"
45+
implementation "io.ktor:ktor-server-html-builder"
4046
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
4147
implementation "ch.qos.logback:logback-classic:1.2.11"
4248
}
@@ -51,8 +57,8 @@ kotlin {
5157
dependencies {
5258
implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
5359
implementation "org.jetbrains.kotlin:kotlin-test-js"
54-
implementation "io.ktor:ktor-client-core:2.2.3"
55-
implementation "io.ktor:ktor-client-js:2.2.3"
60+
implementation "io.ktor:ktor-client-core"
61+
implementation "io.ktor:ktor-client-js"
5662
}
5763
}
5864
}

graalvm/build.gradle.kts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
plugins {
22
application
33
kotlin("jvm") version "1.7.20"
4+
id("io.ktor.plugin") version "2.2.3"
45
id("org.graalvm.buildtools.native") version "0.9.11"
56
}
67

@@ -16,8 +17,8 @@ repositories {
1617

1718
dependencies {
1819
implementation("ch.qos.logback:logback-classic:1.2.11")
19-
implementation("io.ktor:ktor-server-core-jvm:2.2.3")
20-
implementation("io.ktor:ktor-server-cio-jvm:2.2.3")
20+
implementation("io.ktor:ktor-server-core-jvm")
21+
implementation("io.ktor:ktor-server-cio-jvm")
2122
}
2223

2324
graalvmNative {

0 commit comments

Comments
 (0)