9d1091cdaa
Make task properties validation fail on warnings; run it during IT
112 lines
4.2 KiB
Groovy
112 lines
4.2 KiB
Groovy
apply plugin: 'kotlin'
|
|
|
|
configureJvmProject(project)
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
jcenter()
|
|
maven { url 'http://repository.jetbrains.com/utils/' }
|
|
}
|
|
|
|
dependencies {
|
|
testCompile project(':kotlin-gradle-plugin')
|
|
testCompile project(':kotlin-gradle-plugin').sourceSets.test.output
|
|
testCompile project(':kotlin-gradle-subplugin-example')
|
|
testCompile project(':kotlin-allopen')
|
|
testCompile project(':kotlin-test:kotlin-test-jvm')
|
|
|
|
testCompile project(path: ':kotlin-compiler-embeddable', configuration: 'runtimeJar')
|
|
testCompile project(path: ':examples:annotation-processor-example')
|
|
testCompile project(':kotlin-stdlib-jre8')
|
|
testCompile project(':kotlin-reflect')
|
|
testCompile project(':kotlin-android-extensions')
|
|
testCompile project(path: ':kotlin-build-common', configuration: 'tests-jar')
|
|
testCompile project(path: ':compiler:incremental-compilation-impl', configuration: 'tests-jar')
|
|
|
|
testCompile 'org.jetbrains.kotlin:gradle-api:2.2'
|
|
|
|
testRuntime project(path: ':kotlin-android-extensions', configuration: 'runtimeJar')
|
|
}
|
|
|
|
// Include Gradle task properties validation into the testing procedure:
|
|
test.dependsOn(":kotlin-gradle-plugin:validateTaskProperties")
|
|
|
|
test.dependsOn(":kotlin-allopen:install",
|
|
":kotlin-android-extensions:install",
|
|
":kotlin-build-common:install",
|
|
":kotlin-compiler-embeddable:install",
|
|
":kotlin-gradle-plugin:install",
|
|
":kotlin-reflect:install",
|
|
":kotlin-annotation-processing-gradle:install",
|
|
":kotlin-test:kotlin-test-jvm:install",
|
|
":kotlin-gradle-subplugin-example:install",
|
|
":kotlin-stdlib-jre8:install",
|
|
":examples:annotation-processor-example:install")
|
|
|
|
|
|
// Validate that all dependencies 'install' tasks are added to 'test' dependencies
|
|
// Test dependencies are specified as paths to avoid forcing dependency resolution
|
|
// and also to avoid specifying evaluationDependsOn for each testCompile dependency.
|
|
gradle.taskGraph.whenReady {
|
|
def notAddedTestTasks = []
|
|
def testDependencies = test.dependsOn
|
|
|
|
for (dependency in configurations.getByName("testCompile").allDependencies) {
|
|
if (!(dependency instanceof ProjectDependency)) continue
|
|
|
|
def task = dependency.dependencyProject.tasks.findByName("install")
|
|
if (task != null && !testDependencies.contains(task.path)) {
|
|
notAddedTestTasks.add("\"${task.path}\"")
|
|
}
|
|
}
|
|
|
|
if (!notAddedTestTasks.isEmpty()) {
|
|
throw new GradleException("Add the following tasks to ${test.path} dependencies:\n ${notAddedTestTasks.join(",\n ")}")
|
|
}
|
|
}
|
|
|
|
processResources {
|
|
expand(project.properties)
|
|
}
|
|
|
|
compileTestKotlin.kotlinOptions.jdkHome = JDK_18
|
|
compileTestKotlin.kotlinOptions.jvmTarget = "1.8"
|
|
|
|
tasks.withType(Test) {
|
|
onlyIf { !project.hasProperty("noTest") }
|
|
|
|
executable = "${JDK_18}/bin/java"
|
|
|
|
systemProperty("kotlinVersion", kotlinVersion)
|
|
def mavenLocalRepo = System.getProperty("maven.repo.local")
|
|
if (mavenLocalRepo != null) {
|
|
systemProperty("maven.repo.local", mavenLocalRepo)
|
|
}
|
|
|
|
testLogging {
|
|
// set options for log level LIFECYCLE
|
|
events "passed", "skipped", "failed", "standardOut"
|
|
showExceptions true
|
|
exceptionFormat "full"
|
|
showCauses true
|
|
showStackTraces true
|
|
|
|
// set options for log level DEBUG and INFO
|
|
debug {
|
|
events "started", "passed", "skipped", "failed", "standardOut", "standardError"
|
|
exceptionFormat "full"
|
|
}
|
|
info.events = debug.events
|
|
info.exceptionFormat = debug.exceptionFormat
|
|
|
|
afterSuite { desc, result ->
|
|
if (!desc.parent) { // will match the outermost suite
|
|
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
|
|
def startItem = '| ', endItem = ' |'
|
|
def repeatLength = startItem.length() + output.length() + endItem.length()
|
|
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
|
|
}
|
|
}
|
|
}
|
|
}
|