Skip to content

Commit

Permalink
KTOR-7743 Remove redundant configurations for JVM target (#4615)
Browse files Browse the repository at this point in the history
* Remove jetty-apln-boot as it is not necessary anymore
* Move test logback config to ktor-server-test-base
  • Loading branch information
osipxd authored Jan 17, 2025
1 parent 115b099 commit a870be2
Show file tree
Hide file tree
Showing 21 changed files with 39 additions and 134 deletions.
4 changes: 0 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ subprojects {
configureTargets()
if (CI) configureTestTasksOnCi()

configurations {
maybeCreate("testOutput")
}

kotlin {
if (!internalProjects.contains(project.name)) explicitApi()

Expand Down
16 changes: 0 additions & 16 deletions buildSrc/src/main/kotlin/JvmConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,6 @@ fun Project.configureJvm() {
}
}

tasks.register<Jar>("jarTest") {
dependsOn(tasks.named("jvmTestClasses"))
archiveClassifier = "test"
from(kotlin.jvm().compilations["test"].output)
}

configurations {
val testCompile = findByName("testCompile") ?: return@configurations

val testOutput by creating {
extendsFrom(testCompile)
}
val boot by creating {
}
}

val testJdk = project.testJdk
val jvmTest = tasks.named<KotlinJvmTest>("jvmTest") {
maxHeapSize = "2g"
Expand Down
2 changes: 0 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ netty-tcnative = "2.0.69.Final"
jetty = "9.4.57.v20241219"
jetty-jakarta = "11.0.24"
jetty-alpn-api = "1.1.3.v20160715"
jetty-alpn-boot = "8.1.13.v20181017"
jetty-alpn-openjdk8 = "9.4.57.v20241219"

tomcat = "9.0.98"
Expand Down Expand Up @@ -156,7 +155,6 @@ jetty-alpn-java-server = { module = "org.eclipse.jetty:jetty-alpn-java-server",
jetty-alpn-java-client = { module = "org.eclipse.jetty:jetty-alpn-java-client", version.ref = "jetty" }

jetty-alpn-api = { module = "org.eclipse.jetty.alpn:alpn-api", version.ref = "jetty-alpn-api" }
jetty-alpn-boot = { module = "org.mortbay.jetty.alpn:alpn-boot", version.ref = "jetty-alpn-boot" }
jetty-alpn-openjdk8-server = { module = "org.eclipse.jetty:jetty-alpn-openjdk8-server", version.ref = "jetty-alpn-openjdk8" }
jetty-alpn-openjdk8-client = { module = "org.eclipse.jetty:jetty-alpn-openjdk8-client", version.ref = "jetty-alpn-openjdk8" }

Expand Down
6 changes: 1 addition & 5 deletions ktor-server/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = "Wrapper for ktor-server-core and base plugins"
Expand Down Expand Up @@ -34,7 +34,3 @@ kotlin.sourceSets {
}
}
}

artifacts {
add("testOutput", tasks.named("jarTest"))
}
6 changes: 0 additions & 6 deletions ktor-server/ktor-server-cio/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,4 @@ kotlin.sourceSets {
api(project(":ktor-server:ktor-server-test-base"))
}
}
jvmTest {
dependencies {
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(libs.logback.classic)
}
}
}
9 changes: 2 additions & 7 deletions ktor-server/ktor-server-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""
Expand Down Expand Up @@ -41,14 +41,9 @@ kotlin {
implementation(project(":ktor-server:ktor-server-config-yaml"))
implementation(project(":ktor-server:ktor-server-test-base"))
implementation(project(":ktor-server:ktor-server-test-suites"))

api(libs.logback.classic)

implementation(libs.mockk)
}
}
}
}

artifacts {
add("testOutput", tasks.named("jarTest"))
}
12 changes: 1 addition & 11 deletions ktor-server/ktor-server-jetty-jakarta/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""
Expand All @@ -26,17 +26,7 @@ kotlin {
api(project(":ktor-server:ktor-server-test-suites"))

api(libs.jetty.servlet.jakarta)
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(libs.logback.classic)
}
}
}
}

val jetty_alpn_boot_version: String? by extra

dependencies {
if (jetty_alpn_boot_version != null) {
add("boot", libs.jetty.alpn.boot)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest
Expand All @@ -12,25 +12,10 @@ kotlin.sourceSets {
api(libs.jetty.servlet.jakarta)
api(project(":ktor-server:ktor-server-core"))
api(project(":ktor-server:ktor-server-jetty-jakarta"))
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))

api(libs.logback.classic)
}
}
}

val jetty_alpn_boot_version: String? by extra
dependencies {
if (jetty_alpn_boot_version != null) {
add("boot", libs.jetty.alpn.boot)
}
}

tasks.named<KotlinJvmTest>("jvmTest") {
systemProperty("enable.http2", "true")

if (jetty_alpn_boot_version != null && JavaVersion.current() == JavaVersion.VERSION_1_8) {
val bootClasspath = configurations.named("boot").get().files
jvmArgs(bootClasspath.map { "-Xbootclasspath/p:${it.absolutePath}" }.iterator())
}
}
14 changes: 4 additions & 10 deletions ktor-server/ktor-server-jetty/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""

kotlin {
Expand All @@ -21,17 +25,7 @@ kotlin {
api(project(":ktor-server:ktor-server-test-suites"))

api(libs.jetty.servlet)
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(libs.logback.classic)
}
}
}
}

val jetty_alpn_boot_version: String? by extra

dependencies {
if (jetty_alpn_boot_version != null) {
add("boot", libs.jetty.alpn.boot)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest
Expand All @@ -12,25 +12,10 @@ kotlin.sourceSets {
api(libs.jetty.servlet)
api(project(":ktor-server:ktor-server-core"))
api(project(":ktor-server:ktor-server-jetty"))
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))

api(libs.logback.classic)
}
}
}

val jetty_alpn_boot_version: String? by extra
dependencies {
if (jetty_alpn_boot_version != null) {
add("boot", libs.jetty.alpn.boot)
}
}

tasks.named<KotlinJvmTest>("jvmTest") {
systemProperty("enable.http2", "true")

if (jetty_alpn_boot_version != null && JavaVersion.current() == JavaVersion.VERSION_1_8) {
val bootClasspath = configurations.named("boot").get().files
jvmArgs(bootClasspath.map { "-Xbootclasspath/p:${it.absolutePath}" }.iterator())
}
}
7 changes: 1 addition & 6 deletions ktor-server/ktor-server-netty/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest

description = ""

val jetty_alpn_api_version: String by extra

val enableAlpnProp = project.hasProperty("enableAlpn")
val osName = System.getProperty("os.name").lowercase()
val nativeClassifier: String? = if (enableAlpnProp) {
Expand Down Expand Up @@ -45,9 +43,6 @@ kotlin.sourceSets {
api(libs.netty.tcnative)
api(libs.netty.tcnative.boringssl.static)
api(libs.mockk)
api(libs.logback.classic)

api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions ktor-server/ktor-server-plugins/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

subprojects {
Expand All @@ -18,11 +18,7 @@ subprojects {

jvmTest {
dependencies {
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))

// Version catalogs aren't accessible directly inside subprojects block
// https://github.com/gradle/gradle/issues/16634#issuecomment-809345790
api(rootProject.libs.logback.classic)
implementation(project(":ktor-server:ktor-server-test-base"))
}
}
}
Expand Down
5 changes: 4 additions & 1 deletion ktor-server/ktor-server-servlet-jakarta/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""

kotlin.sourceSets {
Expand All @@ -11,7 +15,6 @@ kotlin.sourceSets {

jvmTest {
dependencies {
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(project(":ktor-server:ktor-server-config-yaml"))
implementation(libs.mockk)
implementation(libs.jakarta.servlet)
Expand Down
5 changes: 4 additions & 1 deletion ktor-server/ktor-server-servlet/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""

kotlin.sourceSets {
Expand All @@ -10,7 +14,6 @@ kotlin.sourceSets {

jvmTest {
dependencies {
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(project(":ktor-server:ktor-server-config-yaml"))
implementation(libs.mockk)
implementation(libs.javax.servlet)
Expand Down
6 changes: 1 addition & 5 deletions ktor-server/ktor-server-test-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

description = ""

val jetty_alpn_boot_version: String? by extra

kotlin.sourceSets {
commonMain {
dependencies {
Expand All @@ -22,9 +20,7 @@ kotlin.sourceSets {
api(project(":ktor-network:ktor-network-tls:ktor-network-tls-certificates"))
api(project(":ktor-server:ktor-server-plugins:ktor-server-call-logging"))

if (jetty_alpn_boot_version != null) {
api(libs.jetty.alpn.boot)
}
api(libs.logback.classic)
}
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!--
~ Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
-->

<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
Expand Down
9 changes: 1 addition & 8 deletions ktor-server/ktor-server-test-host/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/*
* Copyright 2014-2024 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""

val jetty_alpn_boot_version: String? by extra

kotlin.sourceSets {
commonMain {
dependencies {
Expand All @@ -28,10 +26,6 @@ kotlin.sourceSets {
// so shouldn"t increase the size of the final artifact.
api(project(":ktor-server:ktor-server-plugins:ktor-server-websockets"))

if (jetty_alpn_boot_version != null) {
api(libs.jetty.alpn.boot)
}

api(libs.kotlin.test)
api(libs.junit)
implementation(libs.kotlinx.coroutines.debug)
Expand All @@ -40,7 +34,6 @@ kotlin.sourceSets {

jvmTest {
dependencies {
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(project(":ktor-server:ktor-server-config-yaml"))
api(libs.kotlin.test)
}
Expand Down
8 changes: 0 additions & 8 deletions ktor-server/ktor-server-test-suites/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,4 @@ kotlin.sourceSets {
implementation(project(":ktor-server:ktor-server-plugins:ktor-server-request-validation"))
}
}

jvmTest {
dependencies {
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))

api(libs.logback.classic)
}
}
}
6 changes: 4 additions & 2 deletions ktor-server/ktor-server-tests/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""

plugins {
Expand All @@ -16,8 +20,6 @@ kotlin.sourceSets {
dependencies {
implementation(libs.jansi)
implementation(project(":ktor-client:ktor-client-plugins:ktor-client-encoding"))
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(libs.logback.classic)
api(project(":ktor-server:ktor-server-plugins:ktor-server-sse"))
}
}
Expand Down
6 changes: 4 additions & 2 deletions ktor-server/ktor-server-tomcat-jakarta/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/

description = ""

kotlin.sourceSets {
Expand All @@ -14,8 +18,6 @@ kotlin.sourceSets {
api(project(":ktor-server:ktor-server-test-base"))
api(project(":ktor-server:ktor-server-test-suites"))
api(project(":ktor-server:ktor-server-core"))
api(project(":ktor-server:ktor-server-core", configuration = "testOutput"))
api(libs.logback.classic)
}
}
}
Loading

0 comments on commit a870be2

Please sign in to comment.