[Build] Get rid of the testApiJUnit5 method

#KTI-1349 In Progress
This commit is contained in:
Alexander.Likhachev
2023-08-23 18:44:47 +02:00
committed by Space Team
parent 53fde520d5
commit 6f96be0b76
44 changed files with 124 additions and 70 deletions
+3 -1
View File
@@ -18,7 +18,9 @@ dependencies {
implementation(project(":compiler:backend.jvm"))
implementation(project(":compiler:backend.jvm.entrypoint"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(project(":analysis:analysis-api-providers"))
testImplementation(project(":analysis:analysis-api-standalone:analysis-api-standalone-base"))
testImplementation(projectTests(":compiler:tests-common"))
+3 -1
View File
@@ -48,7 +48,9 @@ dependencies {
testApi(projectTests(":analysis:analysis-test-framework"))
testImplementation(toolsJar())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(project(":analysis:symbol-light-classes"))
}
@@ -9,7 +9,9 @@ dependencies {
api(project(":analysis:project-structure"))
api(intellijCore())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(project(":kotlin-test:kotlin-test-junit"))
testImplementation(projectTests(":compiler:tests-common"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
@@ -13,7 +13,9 @@ dependencies {
api(intellijCore())
implementation(project(":analysis:analysis-internal-utils"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(project(":kotlin-test:kotlin-test-junit"))
testImplementation(project(":analysis:analysis-api"))
testImplementation(project(":analysis:analysis-api-standalone:analysis-api-standalone-base"))
@@ -22,7 +22,9 @@ dependencies {
testImplementation(project(":kotlin-test:kotlin-test-junit"))
testImplementation(toolsJar())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
}
kotlin {
@@ -6,7 +6,9 @@ plugins {
dependencies {
testImplementation(kotlinStdlib())
testImplementation(intellijCore())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(project(":kotlin-test:kotlin-test-junit"))
testImplementation(project(":analysis:analysis-internal-utils"))
+3 -1
View File
@@ -50,7 +50,9 @@ dependencies {
testImplementation(projectTests(":analysis:analysis-test-framework"))
testImplementation(projectTests(":analysis:analysis-api-impl-base"))
testImplementation(project(":kotlin-test:kotlin-test-junit"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(project(":analysis:symbol-light-classes"))
testRuntimeOnly(project(":core:descriptors.runtime"))
+3 -1
View File
@@ -23,7 +23,9 @@ dependencies {
testCompileOnly(project(":compiler:cli-common"))
testApi(projectTests(":compiler:tests-common"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(libs.junit.jupyter.params)
testImplementation(libs.junit4)
testApi(protobufFull())
@@ -10,7 +10,9 @@ configureKotlinCompileTasksGradleCompatibility()
dependencies {
compileOnly(kotlinStdlib())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(kotlinStdlib())
}
+3 -1
View File
@@ -26,7 +26,9 @@ dependencies {
testApi(project(":compiler:fir:entrypoint"))
testApi(project(":compiler:frontend"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testRuntimeOnly(project(":core:descriptors.runtime"))
testRuntimeOnly(project(":compiler:fir:fir2ir:jvm-backend"))
+3 -1
View File
@@ -29,7 +29,9 @@ dependencies {
testApi(projectTests(":compiler:tests-common-new"))
testApi(projectTests(":compiler:fir:analysis-tests"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testRuntimeOnly(project(":core:deserialization"))
testRuntimeOnly(project(":core:descriptors.runtime"))
+4 -1
View File
@@ -18,7 +18,10 @@ dependencies {
testImplementation(projectTests(":generators:test-generator"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(libs.junit.platform.launcher)
testApi(projectTests(":compiler:test-infrastructure"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
testApi(projectTests(":compiler:tests-compiler-utils"))
+3 -1
View File
@@ -81,7 +81,9 @@ dependencies {
testImplementation(commonDependency("org.jetbrains.intellij.deps:log4j"))
testImplementation(commonDependency("org.jetbrains.intellij.deps:jdom"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
}
optInToExperimentalCompilerApi()
@@ -10,7 +10,9 @@ dependencies {
testApi(projectTests(":compiler:tests-compiler-utils"))
testApi(projectTests(":compiler:tests-common-new"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(libs.junit.platform.runner)
testImplementation(libs.junit.platform.suite.api)
runtimeOnly(libs.junit.vintage.engine)
@@ -6,7 +6,9 @@ plugins {
dependencies {
testImplementation(kotlinStdlib())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(projectTests(":compiler:tests-common"))
testImplementation(projectTests(":compiler:test-infrastructure"))
testImplementation(projectTests(":compiler:tests-common-new"))
+2
View File
@@ -9,6 +9,8 @@ dependencies {
testApi(project(":kotlin-scripting-compiler"))
testApi(projectTests(":compiler:tests-common"))
testImplementation(intellijCore())
testApi(platform(libs.junit.bom))
testImplementation(libs.junit4)
testApi(projectTests(":generators:test-generator"))
testRuntimeOnly(toolsJar())
}
+4 -1
View File
@@ -16,9 +16,12 @@ dependencies {
testRuntimeOnly(project(":core:descriptors.runtime"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(libs.junit.jupyter.params)
runtimeOnly(libs.junit.vintage.engine)
testImplementation(libs.junit4)
}
sourceSets {
+3 -1
View File
@@ -9,7 +9,9 @@ dependencies {
implementation(project(":core:compiler.common"))
implementation(project(":compiler:ir.serialization.common"))
compileOnly(commonDependency("org.jetbrains.intellij.deps.fastutil:intellij-deps-fastutil"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(libs.junit.jupyter.params)
testImplementation(intellijCore())
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
+2
View File
@@ -16,6 +16,8 @@ dependencies {
testImplementation(projectTests(":compiler:tests-common"))
testImplementation(intellijCore())
testApi(platform(libs.junit.bom))
testImplementation(libs.junit4)
}
sourceSets {
+3 -1
View File
@@ -11,7 +11,9 @@ dependencies {
testImplementation(project(":compiler:visualizer:render-psi"))
testImplementation(project(":compiler:visualizer:render-fir"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(projectTests(":compiler:tests-compiler-utils"))
testApi(projectTests(":compiler:tests-common-new"))
@@ -16,6 +16,8 @@ dependencies {
testApi(projectTests(":generators:test-generator"))
testApi(intellijCore())
testApi(platform(libs.junit.bom))
testImplementation(libs.junit4)
}
sourceSets {
@@ -25,7 +25,9 @@ dependencies {
testImplementation(projectTests(":analysis:symbol-light-classes"))
testImplementation(projectTests(":analysis:decompiled:native"))
testImplementation(intellijCore())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
}
val generateFrontendApiTests by generator("org.jetbrains.kotlin.generators.tests.analysis.api.GenerateAnalysisApiTestsKt")
+3 -1
View File
@@ -79,7 +79,9 @@ dependencies {
testImplementation(projectTests(":js:js.tests"))
testImplementation(project(":kotlin-gradle-compiler-types"))
testImplementation(project(":jps:jps-common"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
if (Ide.IJ()) {
testCompileOnly(jpsBuildTest())
+3 -1
View File
@@ -9,7 +9,9 @@ dependencies {
testApi(projectTests(":compiler:test-infrastructure-utils"))
testApi(kotlinStdlib())
testImplementation(libs.junit4)
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(project(":generators"))
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
+3 -1
View File
@@ -33,7 +33,9 @@ val testJsRuntime by configurations.creating {
}
dependencies {
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testRuntimeOnly(libs.junit.vintage.engine)
testApi(protobufFull())
@@ -96,7 +96,9 @@ dependencies {
testImplementation(gradleApi())
testImplementation(gradleTestKit())
testImplementation(commonDependency("com.google.code.gson:gson"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testRuntimeOnly(libs.junit.vintage.engine)
testImplementation(libs.junit.jupyter.params)
+3 -1
View File
@@ -18,7 +18,9 @@ dependencies {
testImplementation(project(":native:executors"))
testImplementation(project(":kotlin-util-klib-abi"))
testImplementation(projectTests(":kotlin-util-klib-abi"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(commonDependency("org.jetbrains.kotlinx", "kotlinx-metadata-klib"))
testImplementation(commonDependency("org.jetbrains.kotlinx", "kotlinx-coroutines-core")) { isTransitive = false }
+3 -1
View File
@@ -14,7 +14,9 @@ dependencies {
testImplementation(libs.junit4)
testImplementation(kotlinStdlib())
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
}
sourceSets {
+3 -1
View File
@@ -23,7 +23,9 @@ dependencies {
testRuntimeOnly(commonDependency("org.codehaus.woodstox:stax2-api"))
testRuntimeOnly(commonDependency("com.fasterxml:aalto-xml"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(projectTests(":compiler:tests-common-new"))
testImplementation(projectTests(":compiler:test-infrastructure"))
testImplementation(projectTests(":compiler:test-infrastructure-utils"))
@@ -102,7 +102,9 @@ dependencies {
testImplementation(projectTests(":compiler:test-infrastructure"))
testCompileOnly("org.jetbrains.kotlinx:atomicfu:0.21.0")
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testRuntimeOnly(kotlinStdlib())
testRuntimeOnly(project(":kotlin-preloader")) // it's required for ant tests
@@ -19,7 +19,9 @@ dependencies {
compileOnly(intellijCore())
compileOnly(commonDependency("org.jetbrains.intellij.deps:asm-all"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(projectTests(":compiler:tests-common-new"))
testApi(projectTests(":compiler:test-infrastructure"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
+2
View File
@@ -18,6 +18,8 @@ dependencies {
testApi(projectTests(":compiler:tests-common"))
testRuntimeOnly(intellijCore())
testRuntimeOnly("org.jetbrains.kotlinx", "kotlinx-serialization-runtime", kotlinxSerializationVersion)
testApi(platform(libs.junit.bom))
testImplementation(libs.junit4)
embedded("org.jetbrains.kotlinx", "kotlinx-serialization-runtime", kotlinxSerializationVersion) { isTransitive = false }
}
+3 -1
View File
@@ -7,7 +7,9 @@ dependencies {
api(kotlinStdlib())
compileOnly(toolsJarApi())
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testCompileOnly(toolsJarApi())
testRuntimeOnly(toolsJar())
}
+3 -1
View File
@@ -11,7 +11,9 @@ dependencies {
testImplementation(intellijCore())
testApi(projectTests(":compiler:test-infrastructure-utils"))
testApi(projectTests(":compiler:tests-common-new"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
}
sourceSets {
@@ -27,7 +27,9 @@ dependencies {
testRuntimeOnly(commonDependency("org.codehaus.woodstox:stax2-api"))
testRuntimeOnly(commonDependency("com.fasterxml:aalto-xml"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(projectTests(":compiler:tests-common-new"))
testApi(projectTests(":compiler:test-infrastructure"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
+3 -1
View File
@@ -34,7 +34,9 @@ dependencies {
embedded(project(":analysis:low-level-api-fir")) { isTransitive = false }
embedded(project(":analysis:symbol-light-classes")) { isTransitive = false }
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(projectTests(":kotlin-annotation-processing-compiler"))
testImplementation(project(":analysis:analysis-api-standalone"))
testRuntimeOnly(toolsJar())
@@ -40,7 +40,9 @@ dependencies {
testApi(project(":compiler:fir:plugin-utils"))
testImplementation(projectTests(":generators:test-generator"))
testImplementation(projectTests(":js:js.tests"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(project(":kotlinx-serialization-compiler-plugin.common"))
testImplementation(project(":kotlinx-serialization-compiler-plugin.k1"))
+3 -1
View File
@@ -16,7 +16,9 @@ dependencies {
testApi(project(":compiler:cli"))
testApi(project(":kotlin-noarg-compiler-plugin.cli"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(projectTests(":compiler:tests-common-new"))
testApi(projectTests(":compiler:test-infrastructure"))
testApi(projectTests(":compiler:test-infrastructure-utils"))
@@ -19,7 +19,9 @@ dependencies {
embedded(project(":plugins:parcelize:parcelize-compiler:parcelize.backend")) { isTransitive = false }
embedded(project(":plugins:parcelize:parcelize-compiler:parcelize.cli")) { isTransitive = false }
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testApi(intellijCore())
+3 -1
View File
@@ -17,7 +17,9 @@ dependencies {
testCompileOnly(project(":kotlin-compiler"))
testImplementation(project(":kotlin-scripting-jvm-host-unshaded"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testRuntimeOnly(libs.junit.vintage.engine)
testApi(projectTests(":compiler:tests-common-new"))
+3 -1
View File
@@ -8,7 +8,9 @@ plugins {
dependencies {
testImplementation(kotlinStdlib("jdk8"))
testImplementation(project(":kotlin-test:kotlin-test-junit5"))
testApiJUnit5()
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)
testImplementation(projectTests(":compiler:tests-common-new"))
}
+2
View File
@@ -10,6 +10,8 @@ dependencies {
testImplementation(libs.jackson.dataformat.xml)
testImplementation(libs.jackson.module.kotlin)
testImplementation("com.fasterxml.woodstox:woodstox-core:6.5.1")
testApi(platform(libs.junit.bom))
testImplementation(libs.junit4)
testImplementation("org.eclipse.jgit:org.eclipse.jgit:5.13.0.202109080827-r")
}
@@ -14,15 +14,12 @@ import org.gradle.api.file.FileCollection
import org.gradle.internal.jvm.Jvm
import org.gradle.kotlin.dsl.closureOf
import org.gradle.kotlin.dsl.extra
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.project
import java.io.File
private val Project.isEAPIntellij get() = rootProject.extra["versions.intellijSdk"].toString().contains("-EAP-")
private val Project.isNightlyIntellij get() = rootProject.extra["versions.intellijSdk"].toString().endsWith("SNAPSHOT") && !isEAPIntellij
private val Project.libsVersionCatalog get() = extensions.getByType<VersionCatalogsExtension>().named("libs")
val Project.intellijRepo
get() =
when {
@@ -192,35 +189,6 @@ fun DependencyHandler.jpsLikeModuleDependency(moduleName: String, scope: JpsDepS
}
}
fun Project.testApiJUnit5() {
with(dependencies) {
val libsVersionCatalog = libsVersionCatalog
testApi(platform(libsVersionCatalog.findLibrary("junit-bom").orElseThrow { GradleException("No version for `junit-bom`") }))
testImplementation(libsVersionCatalog.findLibrary("junit-jupyter-api").orElseThrow { GradleException("No version for `junit-jupyter-api`") })
testRuntimeOnly(
libsVersionCatalog.findLibrary("junit-jupyter-engine").orElseThrow { GradleException("No version for `junit-jupyter-engine`") })
testImplementation(
libsVersionCatalog.findLibrary("junit-platform-commons")
.orElseThrow { GradleException("No version for `junit-platform-commons`") })
testImplementation(
libsVersionCatalog.findLibrary("junit-platform-launcher")
.orElseThrow { GradleException("No version for `junit-platform-launcher`") })
}
}
private fun DependencyHandler.testApi(dependencyNotation: Any) {
add("testApi", dependencyNotation)
}
private fun DependencyHandler.testImplementation(dependencyNotation: Any) {
add("testImplementation", dependencyNotation)
}
private fun DependencyHandler.testRuntimeOnly(dependencyNotation: Any) {
add("testRuntimeOnly", dependencyNotation)
}
val Project.protobufRelocatedVersion: String get() = findProperty("versions.protobuf-relocated") as String
fun Project.protobufLite(): String = "org.jetbrains.kotlin:protobuf-lite:$protobufRelocatedVersion"
fun Project.protobufFull(): String = "org.jetbrains.kotlin:protobuf-relocated:$protobufRelocatedVersion"
+1 -1
View File
@@ -61,10 +61,10 @@ val jsShell by configurations.creating {
}
dependencies {
testImplementation(libs.junit4)
testApi(projectTests(":compiler:tests-common"))
testApi(projectTests(":compiler:tests-common-new"))
testApi(intellijCore())
testApi(platform(libs.junit.bom))
testImplementation(libs.junit.jupyter.api)
testRuntimeOnly(libs.junit.jupyter.engine)