Add 'kgpSimpleTests' task.
This task run all JUnit5 tests with annotated with '@SimpleKGPTests` annotation and also will be used in CI configuration. ^KT-45745 In Progress
This commit is contained in:
@@ -159,8 +159,22 @@ if (isTeamcityBuild) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val KGP_TEST_TASKS_GROUP = "Kotlin Gradle Plugin Verification"
|
||||||
|
|
||||||
|
val simpleTestsTask = tasks.register<Test>("kgpSimpleTests") {
|
||||||
|
group = KGP_TEST_TASKS_GROUP
|
||||||
|
description = "Run only simple tests for Kotlin Gradle Plugin"
|
||||||
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 4).coerceAtLeast(1)
|
||||||
|
|
||||||
|
useJUnitPlatform {
|
||||||
|
includeTags("SimpleKGP")
|
||||||
|
includeEngines("junit-jupiter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.named<Task>("check") {
|
tasks.named<Task>("check") {
|
||||||
dependsOn("testAdvanceGradleVersion")
|
dependsOn("testAdvanceGradleVersion")
|
||||||
|
dependsOn(simpleTestsTask)
|
||||||
if (isTeamcityBuild) {
|
if (isTeamcityBuild) {
|
||||||
dependsOn("testAdvanceGradleVersionMppAndAndroid")
|
dependsOn("testAdvanceGradleVersionMppAndAndroid")
|
||||||
dependsOn("testMppAndAndroid")
|
dependsOn("testMppAndAndroid")
|
||||||
@@ -170,6 +184,17 @@ tasks.named<Task>("check") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val kgpJunit5Tests = tasks.register<Test>("kgpJunit5Tests") {
|
||||||
|
group = KGP_TEST_TASKS_GROUP
|
||||||
|
description = "Run only JUnit 5 tests for Kotlin Gradle Plugin"
|
||||||
|
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 4).coerceAtLeast(1)
|
||||||
|
|
||||||
|
useJUnitPlatform {
|
||||||
|
includeTags("JUnit5")
|
||||||
|
includeEngines("junit-jupiter")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions.jdkHome = rootProject.extra["JDK_18"] as String
|
kotlinOptions.jdkHome = rootProject.extra["JDK_18"] as String
|
||||||
kotlinOptions.jvmTarget = "1.8"
|
kotlinOptions.jvmTarget = "1.8"
|
||||||
@@ -197,8 +222,16 @@ tasks.withType<Test> {
|
|||||||
|
|
||||||
useAndroidSdk()
|
useAndroidSdk()
|
||||||
|
|
||||||
maxHeapSize = "512m"
|
val shouldApplyJunitPlatform = name !in setOf(
|
||||||
useJUnitPlatform()
|
simpleTestsTask.name,
|
||||||
|
kgpJunit5Tests.name
|
||||||
|
)
|
||||||
|
if (shouldApplyJunitPlatform) {
|
||||||
|
maxHeapSize = "512m"
|
||||||
|
useJUnitPlatform {
|
||||||
|
includeEngines("junit-vintage")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
testLogging {
|
testLogging {
|
||||||
// set options for log level LIFECYCLE
|
// set options for log level LIFECYCLE
|
||||||
@@ -233,14 +266,3 @@ tasks.withType<Test> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Test>("kgpJunit5Tests") {
|
|
||||||
group = "Verification"
|
|
||||||
description = "Run only JUnit 5 tests for Kotlin Gradle Plugin"
|
|
||||||
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 4).coerceAtLeast(1)
|
|
||||||
|
|
||||||
useJUnitPlatform {
|
|
||||||
includeTags("JUnit5")
|
|
||||||
includeEngines("junit-jupiter")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+2
@@ -14,6 +14,8 @@ import org.jetbrains.kotlin.gradle.testbase.*
|
|||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
@SimpleGradlePluginPTests
|
||||||
|
@DisplayName("Kotlin Java Toolchain support")
|
||||||
class KotlinJavaToolchainTest : KGPBaseTest() {
|
class KotlinJavaToolchainTest : KGPBaseTest() {
|
||||||
|
|
||||||
@GradleTest
|
@GradleTest
|
||||||
|
|||||||
+1
-1
@@ -5,8 +5,8 @@ import org.gradle.api.logging.configuration.WarningMode
|
|||||||
import org.gradle.util.GradleVersion
|
import org.gradle.util.GradleVersion
|
||||||
import org.jetbrains.kotlin.gradle.testbase.*
|
import org.jetbrains.kotlin.gradle.testbase.*
|
||||||
import org.junit.jupiter.api.DisplayName
|
import org.junit.jupiter.api.DisplayName
|
||||||
import org.junit.jupiter.api.Tag
|
|
||||||
|
|
||||||
|
@SimpleGradlePluginPTests
|
||||||
@DisplayName("KGP simple tests")
|
@DisplayName("KGP simple tests")
|
||||||
class SimpleKotlinGradleIT : KGPBaseTest() {
|
class SimpleKotlinGradleIT : KGPBaseTest() {
|
||||||
|
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.jetbrains.kotlin.gradle.testbase
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Tag
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add it to test classes performing simple KGP checks.
|
||||||
|
*/
|
||||||
|
@Target(AnnotationTarget.CLASS, AnnotationTarget.ANNOTATION_CLASS, AnnotationTarget.FUNCTION)
|
||||||
|
@Retention(AnnotationRetention.RUNTIME)
|
||||||
|
@Tag("SimpleKGP")
|
||||||
|
annotation class SimpleGradlePluginPTests
|
||||||
Reference in New Issue
Block a user