[Build] Add jUnit dependencies in testApiJUnit5 to the implementation configuration

Adding these dependencies to the `api` configuration pollutes classpath for each dependant modules even if it doesn't need them. Instead, the dependencies should be declared more granularly if they're required
#KTI-1349 In Progress
This commit is contained in:
Alexander.Likhachev
2023-08-23 14:04:23 +02:00
committed by Space Team
parent 0ecbb64c64
commit 53fde520d5
45 changed files with 121 additions and 55 deletions
@@ -14,8 +14,8 @@ import org.jetbrains.kotlin.gradle.dsl.multiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.ide.dependencyResolvers.resolveMetadata
import org.jetbrains.kotlin.gradle.plugin.mpp.MetadataDependencyResolution
import org.jetbrains.kotlin.gradle.util.*
import org.junit.jupiter.api.assertDoesNotThrow
import org.junit.jupiter.api.assertThrows
import org.jetbrains.kotlin.util.assertDoesNotThrow
import org.jetbrains.kotlin.util.assertThrows
import kotlin.test.Test
class StdlibJsExplicitDependencyResolutionTest {
@@ -17,8 +17,8 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPluginLifecycle.Stage.ReadyForEx
import org.jetbrains.kotlin.gradle.util.buildProject
import org.jetbrains.kotlin.gradle.util.runLifecycleAwareTest
import org.jetbrains.kotlin.gradle.utils.*
import org.jetbrains.kotlin.util.assertThrows
import org.junit.Test
import org.junit.jupiter.api.assertThrows
import java.util.concurrent.atomic.AtomicInteger
import kotlin.test.*
@@ -11,9 +11,9 @@ import com.intellij.util.io.Compressor
import org.gradle.kotlin.dsl.support.unzipTo
import org.jetbrains.kotlin.gradle.utils.copyZipFilePartially
import org.jetbrains.kotlin.gradle.utils.listDescendants
import org.jetbrains.kotlin.util.assertThrows
import org.junit.Rule
import org.junit.Test
import org.junit.jupiter.api.assertThrows
import org.junit.rules.TemporaryFolder
import java.io.File
import java.util.zip.ZipEntry
@@ -9,14 +9,12 @@ import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.statistics.metrics.StringAnonymizationPolicy
import org.jetbrains.kotlin.statistics.metrics.StringMetrics
import org.junit.jupiter.api.DisplayName
import kotlin.test.Test
class KotlinBuildStatHandlerTest {
@DisplayName("Checks that all KonanTarget names are presented in MPP_PLATFORMS statistic's report validator")
@Test
fun mppPlatformsShouldContainsllKonanTargetsTest() {
@Test // Checks that all KonanTarget names are presented in MPP_PLATFORMS statistic's report validator
fun mppPlatformsShouldContainAllKonanTargetsTest() {
val regex = Regex(StringMetrics.MPP_PLATFORMS.anonymization.validationRegexp())
val konanTargetsMissedInMppPlatforms = KonanTarget::class.sealedSubclasses
@@ -28,8 +26,7 @@ class KotlinBuildStatHandlerTest {
}
}
@DisplayName("Checks that all KotlinPlatformType names are presented in MPP_PLATFORMS statistic's report validator")
@Test
@Test // Checks that all KotlinPlatformType names are presented in MPP_PLATFORMS statistic's report validator
fun mppPlatformsShouldContainAllKotlinPlatformTypeTest() {
val regex = Regex(StringMetrics.MPP_PLATFORMS.anonymization.validationRegexp())
@@ -43,8 +40,7 @@ class KotlinBuildStatHandlerTest {
}
@DisplayName("Checks that only values listed in KotlinPlatformType and KonanTarget are included in MPP_PLATFORMS")
@Test
@Test // Checks that only values listed in KotlinPlatformType and KonanTarget are included in MPP_PLATFORMS
fun mppPlatformsShouldContainOnlyKonanTargetsAndKotlinPlatformTypeTest() {
val allowedMppValues =
(StringMetrics.MPP_PLATFORMS.anonymization as StringAnonymizationPolicy.AllowedListAnonymizer)
@@ -15,8 +15,8 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptionsDefault
import org.jetbrains.kotlin.gradle.utils.newInstance
import org.jetbrains.kotlin.testhelpers.StubLogger
import org.jetbrains.kotlin.util.assertThrows
import org.junit.Before
import org.junit.jupiter.api.assertThrows
import java.io.File
import kotlin.test.Test
import kotlin.test.assertEquals
@@ -6,8 +6,8 @@
package org.jetbrains.kotlin.gradle.utils
import org.jetbrains.kotlin.gradle.plugin.MULTIPLE_KOTLIN_PLUGINS_LOADED_WARNING
import org.jetbrains.kotlin.util.assertThrows
import org.junit.AssumptionViolatedException
import org.junit.jupiter.api.assertThrows
import java.net.URLClassLoader
import kotlin.test.Test
import kotlin.test.assertNull
@@ -49,7 +49,7 @@ class CastIsolatedKotlinPluginClassLoaderAwareTest {
assertTrue(
MULTIPLE_KOTLIN_PLUGINS_LOADED_WARNING !in exception.message.orEmpty(),
"Expected no classpath warning in the error message, since this cast was not failing because of iosolated classloaders"
"Expected no classpath warning in the error message, since this cast was not failing because of isolated classloaders"
)
}
@@ -12,7 +12,7 @@ dependencies {
testCompileOnly(project(":compiler:cli"))
testCompileOnly(project(":kotlin-scripting-jvm-host-unshaded"))
testApi(kotlinStdlib("jdk8"))
testApi(libs.junit4)
testImplementation(libs.junit4)
testApi(projectTests(":kotlin-scripting-compiler")) { isTransitive = false }
testImplementation(project(":kotlin-compiler-embeddable"))
kotlinxSerializationGradlePluginClasspath(project(":kotlinx-serialization-compiler-plugin.embeddable")) { isTransitive = false }
@@ -17,7 +17,7 @@ dependencies {
api(project(":kotlin-daemon-client"))
testCompileOnly(project(":compiler:cli"))
testApi(project(":kotlin-test:kotlin-test-junit"))
testApi(libs.junit4)
testImplementation(libs.junit4)
testApi(project(":kotlin-scripting-compiler"))
testRuntimeOnly(project(":kotlin-compiler"))
testApi(intellijCore())