[Gradle, JS] Move KJS configuration cache tests into separate test suite
This way we make it utilize test execution workers more effectively #KT-45745 In Progress
This commit is contained in:
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
import org.gradle.api.logging.configuration.WarningMode
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.gradle.plugin.KotlinJsCompilerType
|
||||
import org.jetbrains.kotlin.gradle.testbase.*
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
|
||||
abstract class AbstractJsConfigurationCacheIT(protected val irBackend: Boolean) : KGPBaseTest() {
|
||||
private val defaultJsOptions = BuildOptions.JsOptions(
|
||||
useIrBackend = irBackend,
|
||||
jsCompilerType = if (irBackend) KotlinJsCompilerType.IR else KotlinJsCompilerType.LEGACY,
|
||||
)
|
||||
|
||||
final override val defaultBuildOptions =
|
||||
super.defaultBuildOptions.copy(
|
||||
jsOptions = defaultJsOptions,
|
||||
warningMode = WarningMode.Summary,
|
||||
configurationCache = true,
|
||||
configurationCacheProblems = BaseGradleIT.ConfigurationCacheProblems.FAIL
|
||||
)
|
||||
|
||||
@DisplayName("configuration cache is working for kotlin2js plugin")
|
||||
@GradleTest
|
||||
fun testKotlin2JsCompilation(gradleVersion: GradleVersion) {
|
||||
project("instantExecutionToJs", gradleVersion) {
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
"assemble",
|
||||
buildOptions = defaultBuildOptions,
|
||||
executedTaskNames = listOf(":compileKotlinJs")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is working for kotlin/js browser project")
|
||||
@GradleTest
|
||||
fun testBrowserDistribution(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-browser-project", gradleVersion) {
|
||||
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
|
||||
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
":app:build",
|
||||
buildOptions = defaultBuildOptions,
|
||||
executedTaskNames = listOf(
|
||||
":app:packageJson",
|
||||
":app:publicPackageJson",
|
||||
":app:compileKotlinJs",
|
||||
if (irBackend) ":app:compileProductionExecutableKotlinJs" else ":app:processDceKotlinJs",
|
||||
":app:browserProductionWebpack",
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is working for kotlin/js node project")
|
||||
@GradleTest
|
||||
fun testNodeJs(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-nodejs-project", gradleVersion) {
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
":build",
|
||||
buildOptions = defaultBuildOptions,
|
||||
executedTaskNames = listOf(
|
||||
":packageJson",
|
||||
":publicPackageJson",
|
||||
":rootPackageJson",
|
||||
":kotlinNpmInstall",
|
||||
":compileKotlinJs",
|
||||
":nodeTest",
|
||||
) + if (irBackend) listOf(":compileProductionExecutableKotlinJs") else emptyList()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("KT-48241: configuration cache works with test dependencies")
|
||||
@GradleTest
|
||||
fun testTestDependencies(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-project-with-test-dependencies", gradleVersion, forceOutput = true) {
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
"assemble",
|
||||
buildOptions = defaultBuildOptions,
|
||||
executedTaskNames = listOf(":kotlinNpmInstall")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@JsGradlePluginTests
|
||||
class JsConfigurationCacheIT : AbstractJsConfigurationCacheIT(irBackend = false)
|
||||
|
||||
@JsGradlePluginTests
|
||||
class JsIrConfigurationCacheIT : AbstractJsConfigurationCacheIT(irBackend = true)
|
||||
-63
@@ -1015,57 +1015,6 @@ abstract class AbstractKotlin2JsGradlePluginIT(protected val irBackend: Boolean)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is working for kotlin2js plugin")
|
||||
@GradleTest
|
||||
fun testConfigurationCache(gradleVersion: GradleVersion) {
|
||||
project("instantExecutionToJs", gradleVersion) {
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
"assemble",
|
||||
buildOptions = defaultBuildOptions.withConfigurationCache,
|
||||
executedTaskNames = listOf(":compileKotlinJs")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is working for kotlin/js browser project")
|
||||
@GradleTest
|
||||
fun testConfigurationCacheBrowser(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-browser-project", gradleVersion) {
|
||||
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
|
||||
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
":app:build",
|
||||
buildOptions = defaultBuildOptions.withConfigurationCache,
|
||||
executedTaskNames = listOf(
|
||||
":app:packageJson",
|
||||
":app:publicPackageJson",
|
||||
":app:compileKotlinJs",
|
||||
if (irBackend) ":app:compileProductionExecutableKotlinJs" else ":app:processDceKotlinJs",
|
||||
":app:browserProductionWebpack",
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is working for kotlin/js node project")
|
||||
@GradleTest
|
||||
fun testConfigurationCacheNode(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-nodejs-project", gradleVersion) {
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
":build",
|
||||
buildOptions = defaultBuildOptions.withConfigurationCache,
|
||||
executedTaskNames = listOf(
|
||||
":packageJson",
|
||||
":publicPackageJson",
|
||||
":rootPackageJson",
|
||||
":kotlinNpmInstall",
|
||||
":compileKotlinJs",
|
||||
":nodeTest",
|
||||
) + if (irBackend) listOf(":compileProductionExecutableKotlinJs") else emptyList()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private fun TestProject.getSubprojectPackageJson(subProject: String, projectName: String? = null) =
|
||||
projectPath.resolve("build/js/packages/${projectName ?: projectName}-$subProject")
|
||||
.resolve(NpmProject.PACKAGE_JSON)
|
||||
@@ -1135,16 +1084,4 @@ class GeneralKotlin2JsGradlePluginIT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("KT-48241: configuration cache works with test dependencies")
|
||||
@GradleTest
|
||||
fun testConfigurationCacheJsWithTestDependencies(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-project-with-test-dependencies", gradleVersion) {
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
"assemble",
|
||||
buildOptions = defaultBuildOptions.withConfigurationCache,
|
||||
executedTaskNames = listOf(":kotlinNpmInstall")
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -11,7 +11,7 @@ repositories {
|
||||
}
|
||||
|
||||
kotlin {
|
||||
js(IR) {
|
||||
js {
|
||||
nodejs {
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user