[Gradle, JS] Add test for KT-53374
This commit is contained in:
committed by
Space
parent
7cc42d3fe9
commit
41e6f7efc5
+41
-2
@@ -43,8 +43,6 @@ abstract class AbstractJsConfigurationCacheIT(protected val irBackend: Boolean)
|
||||
@GradleTest
|
||||
fun testBrowserDistribution(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-browser-project", gradleVersion) {
|
||||
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
|
||||
|
||||
assertSimpleConfigurationCacheScenarioWorks(
|
||||
":app:build",
|
||||
buildOptions = defaultBuildOptions,
|
||||
@@ -59,6 +57,25 @@ abstract class AbstractJsConfigurationCacheIT(protected val irBackend: Boolean)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is reused when idea.version system property is changed in browser project")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_5, maxVersion = TestVersions.Gradle.G_7_5)
|
||||
@GradleTest
|
||||
fun testBrowserDistributionOnIdeaPropertyChange(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-browser-project", gradleVersion) {
|
||||
build(":app:build")
|
||||
// check IdeaPropertiesEvaluator for the logic
|
||||
build(":app:build", "-Didea.version=2020.1") {
|
||||
assertConfigurationCacheReused()
|
||||
assertTasksUpToDate(
|
||||
":app:packageJson",
|
||||
":app:publicPackageJson",
|
||||
if (irBackend) ":app:compileProductionExecutableKotlinJs" else ":app:processDceKotlinJs",
|
||||
":app:browserProductionWebpack",
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is working for kotlin/js node project")
|
||||
@GradleTest
|
||||
fun testNodeJs(gradleVersion: GradleVersion) {
|
||||
@@ -78,6 +95,28 @@ abstract class AbstractJsConfigurationCacheIT(protected val irBackend: Boolean)
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("configuration cache is reused when idea.version system property is changed in node project")
|
||||
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_5, maxVersion = TestVersions.Gradle.G_7_5)
|
||||
@GradleTest
|
||||
fun testNodeJsOnIdeaPropertyChange(gradleVersion: GradleVersion) {
|
||||
project("kotlin-js-nodejs-project", gradleVersion) {
|
||||
build(":build")
|
||||
// check IdeaPropertiesEvaluator for the logic
|
||||
build(":build", "-Didea.version=2020.1") {
|
||||
assertConfigurationCacheReused()
|
||||
val upToDateTasks = listOf(
|
||||
":packageJson",
|
||||
":publicPackageJson",
|
||||
":rootPackageJson",
|
||||
":kotlinNpmInstall",
|
||||
":compileKotlinJs",
|
||||
":nodeTest",
|
||||
) + if (irBackend) listOf(":compileProductionExecutableKotlinJs") else emptyList()
|
||||
assertTasksUpToDate(*upToDateTasks.toTypedArray())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("KT-48241: configuration cache works with test dependencies")
|
||||
@GradleTest
|
||||
fun testTestDependencies(gradleVersion: GradleVersion) {
|
||||
|
||||
+1
@@ -19,6 +19,7 @@ interface TestVersions {
|
||||
const val G_7_2 = "7.2"
|
||||
const val G_7_3 = "7.3.3"
|
||||
const val G_7_4 = "7.4.2"
|
||||
const val G_7_5 = "7.5"
|
||||
const val MIN_SUPPORTED = minSupportedGradleVersion
|
||||
const val MIN_SUPPORTED_KPM = G_7_0
|
||||
const val MAX_SUPPORTED = G_7_2
|
||||
|
||||
+6
-1
@@ -5,6 +5,7 @@
|
||||
|
||||
package org.jetbrains.kotlin.gradle.testbase
|
||||
|
||||
import org.gradle.testkit.runner.BuildResult
|
||||
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
||||
import java.net.URI
|
||||
import java.nio.file.Path
|
||||
@@ -41,7 +42,7 @@ fun TestProject.assertSimpleConfigurationCacheScenarioWorks(
|
||||
// Then run a build where tasks states are deserialized to check that they work correctly in this mode
|
||||
build(*buildArguments, buildOptions = buildOptions) {
|
||||
assertTasksExecuted(*executedTask.toTypedArray())
|
||||
assertOutputContains("Reusing configuration cache.")
|
||||
assertConfigurationCacheReused()
|
||||
}
|
||||
|
||||
if (checkUpToDateOnRebuild) {
|
||||
@@ -82,5 +83,9 @@ private fun GradleProject.assertConfigurationCacheReportNotCreated() {
|
||||
}
|
||||
}
|
||||
|
||||
fun BuildResult.assertConfigurationCacheReused() {
|
||||
assertOutputContains("Reusing configuration cache.")
|
||||
}
|
||||
|
||||
val BuildOptions.withConfigurationCache: BuildOptions
|
||||
get() = copy(configurationCache = true, configurationCacheProblems = BaseGradleIT.ConfigurationCacheProblems.FAIL)
|
||||
Reference in New Issue
Block a user