Skip to content

Commit

Permalink
Move test logback config to ktor-server-test-base
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Jan 17, 2025
1 parent 2a88824 commit b2af3f8
Show file tree
Hide file tree
Showing 20 changed files with 37 additions and 78 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
14 changes: 0 additions & 14 deletions buildSrc/src/main/kotlin/JvmConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +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 testJdk = project.testJdk
val jvmTest = tasks.named<KotlinJvmTest>("jvmTest") {
maxHeapSize = "2g"
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"))
}
4 changes: 1 addition & 3 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,8 +26,6 @@ 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)
}
}
}
Expand Down
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,9 +12,6 @@ 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)
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions ktor-server/ktor-server-jetty/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 @@ -25,8 +25,6 @@ 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)
}
}
}
Expand Down
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,9 +12,6 @@ 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)
}
}
}
Expand Down
5 changes: 1 addition & 4 deletions ktor-server/ktor-server-netty/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.
*/

import org.jetbrains.kotlin.gradle.targets.jvm.tasks.KotlinJvmTest
Expand Down Expand Up @@ -43,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
2 changes: 2 additions & 0 deletions ktor-server/ktor-server-test-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ kotlin.sourceSets {
api(project(":ktor-client:ktor-client-apache"))
api(project(":ktor-network:ktor-network-tls:ktor-network-tls-certificates"))
api(project(":ktor-server:ktor-server-plugins:ktor-server-call-logging"))

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
3 changes: 1 addition & 2 deletions ktor-server/ktor-server-test-host/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 @@ -34,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)
}
}
}
6 changes: 4 additions & 2 deletions ktor-server/ktor-server-tomcat/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)
}
}
}

0 comments on commit b2af3f8

Please sign in to comment.