[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
|
@GradleTest
|
||||||
fun testBrowserDistribution(gradleVersion: GradleVersion) {
|
fun testBrowserDistribution(gradleVersion: GradleVersion) {
|
||||||
project("kotlin-js-browser-project", gradleVersion) {
|
project("kotlin-js-browser-project", gradleVersion) {
|
||||||
buildGradleKts.modify(::transformBuildScriptWithPluginsDsl)
|
|
||||||
|
|
||||||
assertSimpleConfigurationCacheScenarioWorks(
|
assertSimpleConfigurationCacheScenarioWorks(
|
||||||
":app:build",
|
":app:build",
|
||||||
buildOptions = defaultBuildOptions,
|
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")
|
@DisplayName("configuration cache is working for kotlin/js node project")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testNodeJs(gradleVersion: GradleVersion) {
|
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")
|
@DisplayName("KT-48241: configuration cache works with test dependencies")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testTestDependencies(gradleVersion: GradleVersion) {
|
fun testTestDependencies(gradleVersion: GradleVersion) {
|
||||||
|
|||||||
+1
@@ -19,6 +19,7 @@ interface TestVersions {
|
|||||||
const val G_7_2 = "7.2"
|
const val G_7_2 = "7.2"
|
||||||
const val G_7_3 = "7.3.3"
|
const val G_7_3 = "7.3.3"
|
||||||
const val G_7_4 = "7.4.2"
|
const val G_7_4 = "7.4.2"
|
||||||
|
const val G_7_5 = "7.5"
|
||||||
const val MIN_SUPPORTED = minSupportedGradleVersion
|
const val MIN_SUPPORTED = minSupportedGradleVersion
|
||||||
const val MIN_SUPPORTED_KPM = G_7_0
|
const val MIN_SUPPORTED_KPM = G_7_0
|
||||||
const val MAX_SUPPORTED = G_7_2
|
const val MAX_SUPPORTED = G_7_2
|
||||||
|
|||||||
+6
-1
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
package org.jetbrains.kotlin.gradle.testbase
|
package org.jetbrains.kotlin.gradle.testbase
|
||||||
|
|
||||||
|
import org.gradle.testkit.runner.BuildResult
|
||||||
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
import org.jetbrains.kotlin.gradle.BaseGradleIT
|
||||||
import java.net.URI
|
import java.net.URI
|
||||||
import java.nio.file.Path
|
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
|
// Then run a build where tasks states are deserialized to check that they work correctly in this mode
|
||||||
build(*buildArguments, buildOptions = buildOptions) {
|
build(*buildArguments, buildOptions = buildOptions) {
|
||||||
assertTasksExecuted(*executedTask.toTypedArray())
|
assertTasksExecuted(*executedTask.toTypedArray())
|
||||||
assertOutputContains("Reusing configuration cache.")
|
assertConfigurationCacheReused()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checkUpToDateOnRebuild) {
|
if (checkUpToDateOnRebuild) {
|
||||||
@@ -82,5 +83,9 @@ private fun GradleProject.assertConfigurationCacheReportNotCreated() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun BuildResult.assertConfigurationCacheReused() {
|
||||||
|
assertOutputContains("Reusing configuration cache.")
|
||||||
|
}
|
||||||
|
|
||||||
val BuildOptions.withConfigurationCache: BuildOptions
|
val BuildOptions.withConfigurationCache: BuildOptions
|
||||||
get() = copy(configurationCache = true, configurationCacheProblems = BaseGradleIT.ConfigurationCacheProblems.FAIL)
|
get() = copy(configurationCache = true, configurationCacheProblems = BaseGradleIT.ConfigurationCacheProblems.FAIL)
|
||||||
Reference in New Issue
Block a user