mirror of
https://github.com/jlengrand/ktor.git
synced 2026-03-10 08:31:20 +00:00
Add jacoco coverage
This commit is contained in:
70
build.gradle
70
build.gradle
@@ -180,8 +180,11 @@ allprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
task rootAllTest(type: org.jetbrains.kotlin.gradle.testing.internal.KotlinTestReport) {
|
||||
def rootAllTest = it
|
||||
destinationDir = new File(project.buildDir, "reports/tests/rootAllTest")
|
||||
@@ -256,3 +259,70 @@ afterEvaluate {
|
||||
reportUndocumented = false
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
apply plugin: "jacoco"
|
||||
|
||||
jacoco {
|
||||
toolVersion = "0.8.5"
|
||||
reportsDir = file("${buildDir}/jacoco-reports")
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
task testCoverage(type: JacocoReport, dependsOn: jvmTest) {
|
||||
group = "Reporting"
|
||||
description = "Generate Jacoco coverage reports."
|
||||
|
||||
def coverageSourceDirs = [
|
||||
"common/src",
|
||||
"jvm/src"
|
||||
]
|
||||
classDirectories.from files(fileTree(dir: "${buildDir}/classes/kotlin/jvm/"))
|
||||
sourceDirectories.from files(coverageSourceDirs)
|
||||
additionalSourceDirs.from files(coverageSourceDirs)
|
||||
executionData.from files("${buildDir}/jacoco/jvmTest.exec")
|
||||
|
||||
reports {
|
||||
xml.enabled true
|
||||
csv.enabled false
|
||||
html.enabled true
|
||||
|
||||
html.destination file("${buildDir}/jacoco-reports/html")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def findSources(sourceSet) {
|
||||
return files(subprojects.findResults {
|
||||
it.kotlin.sourceSets.findByName("jvmMain")?.kotlin?.srcDirs
|
||||
})
|
||||
}
|
||||
|
||||
task testCoverage(type: JacocoReport) {
|
||||
group = "Reporting"
|
||||
description = "Generate Jacoco coverage reports."
|
||||
dependsOn subprojects.testCoverage
|
||||
|
||||
def coverageSourceDirs = (
|
||||
findSources("commonMain") + findSources("jvmMain") + findSources("commonTest") + findSources("jvmTest")
|
||||
)
|
||||
|
||||
def classes = files(subprojects.collect {
|
||||
files(fileTree(dir: "${it.buildDir}/classes/kotlin/jvm"))
|
||||
})
|
||||
|
||||
def samples = files(subprojects.testCoverage.executionData).findAll { it.exists() }
|
||||
|
||||
classDirectories.from files(classes)
|
||||
sourceDirectories.from files(coverageSourceDirs)
|
||||
additionalSourceDirs.from files(coverageSourceDirs)
|
||||
executionData.from(samples)
|
||||
|
||||
reports {
|
||||
xml.enabled true
|
||||
csv.enabled false
|
||||
html.enabled true
|
||||
html.destination file("${buildDir}/jacoco-reports/html")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
@@ -13,10 +13,14 @@ import org.junit.*
|
||||
import javax.servlet.*
|
||||
|
||||
class JettyAsyncServletContainerEngineTest :
|
||||
EngineTestSuite<JettyApplicationEngineBase, JettyApplicationEngineBase.Configuration>(Servlet(async = true))
|
||||
EngineTestSuite<JettyApplicationEngineBase, JettyApplicationEngineBase.Configuration>(
|
||||
Servlet(async = true)
|
||||
)
|
||||
|
||||
class JettyBlockingServletContainerEngineTest :
|
||||
EngineTestSuite<JettyApplicationEngineBase, JettyApplicationEngineBase.Configuration>(Servlet(async = false)) {
|
||||
EngineTestSuite<JettyApplicationEngineBase, JettyApplicationEngineBase.Configuration>(
|
||||
Servlet(async = false)
|
||||
) {
|
||||
@Ignore
|
||||
override fun testUpgrade() {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
package io.ktor.tests.server.jetty.http2
|
||||
|
||||
import io.ktor.server.jetty.*
|
||||
import io.ktor.server.testing.*
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
package io.ktor.tests.server.jetty.http2
|
||||
|
||||
import io.ktor.server.engine.*
|
||||
import io.ktor.server.jetty.*
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright 2014-2019 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
* Copyright 2014-2020 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
*/
|
||||
|
||||
package io.ktor.tests.server.jetty
|
||||
package io.ktor.tests.server.jetty.http2
|
||||
|
||||
import io.ktor.application.*
|
||||
import io.ktor.response.*
|
||||
Reference in New Issue
Block a user