我已阅读codecov/example-gradle,但不确定如何将其转换为 Kotlin DSL。
我的.travis.yml
:
language: java
jdk:
- openjdk11
before_install:
- chmod +x gradlew
- chmod +x gradle/wrapper/gradle-wrapper.jar
script:
- ./gradlew test
- ./gradlew codeCoverageReport
after_success:
- bash <(curl -s https://codecov.io/bash)
我的build.gradle.kts
:
import org.jetbrains.kotlin.gradle.plugin.KotlinPluginWrapper
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "1.2.71"
jacoco
maven
}
repositories {
mavenCentral()
}
dependencies {
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.3.1")
}
tasks {
"test"(Test::class) {
useJUnitPlatform()
}
// Task with name 'codeCoverageReport' not found in root project ''.
"codeCoverageReport"(JacocoReport::class) {
executionData(fileTree(project.rootDir.absolutePath).include("**/build/jacoco/*.exec"))
subprojects.onEach {
sourceSets(it.sourceSets.main)
}
reports {
xml.isEnabled = true
xml.destination = File("$buildDir/reports/jacoco/report.xml")
html.isEnabled = false
csv.isEnabled = false
}
dependsOn("test")
}
}