[Gradle] Update Configuration Cache test for Native tasks

Exclude Metadata Processing tasks that are not compatible yet

^KT-54339 Verification Pending
This commit is contained in:
Anton Lakotka
2022-10-11 09:55:30 +02:00
committed by Space Team
parent 512f7b3231
commit 50b892f2f1
3 changed files with 40 additions and 26 deletions
@@ -11,6 +11,7 @@ import org.gradle.util.GradleVersion
import org.jetbrains.kotlin.gradle.report.BuildReportType
import org.jetbrains.kotlin.gradle.targets.js.dukat.ExternalsOutputFormat
import org.jetbrains.kotlin.gradle.testbase.*
import org.jetbrains.kotlin.konan.target.HostManager
import org.junit.jupiter.api.DisplayName
@DisplayName("Configuration cache")
@@ -81,32 +82,45 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
@GradleTestVersions(minVersion = TestVersions.Gradle.G_7_4)
@GradleTest
fun testNativeTasks(gradleVersion: GradleVersion) {
val expectedTasks = mutableListOf(
":lib:cinteropMyCinteropLinuxX64",
":lib:commonizeCInterop",
":lib:compileKotlinLinuxX64",
":lib:copyCinteropMyCinteropLinuxX64",
":lib:linkExecutableDebugExecutableLinuxX64",
":lib:linkSharedDebugSharedLinuxX64",
":lib:linkStaticDebugStaticLinuxX64",
":lib:linkDebugTestLinuxX64",
)
if (HostManager.hostIsMac) {
expectedTasks += listOf(
":lib:cinteropMyCinteropIosX64",
":lib:compileKotlinIosX64",
":lib:copyCinteropMyCinteropIosX64",
":lib:assembleMyframeDebugFrameworkIosArm64",
":lib:assembleMyfatframeDebugFatFramework",
":lib:assembleLibDebugXCFramework",
":lib:compileTestKotlinIosX64",
":lib:linkDebugTestIosX64",
)
}
project("native-configuration-cache", gradleVersion) {
val buildOptions = defaultBuildOptions.copy(
configurationCacheProblems = BaseGradleIT.ConfigurationCacheProblems.FAIL,
warningMode = WarningMode.All
)
// These tasks currently don't support Configuration Cache and marked as [Task::notCompatibleWithConfigurationCache]
val configCacheIncompatibleTaskTypes = listOf(
"CInteropMetadataDependencyTransformationTask",
"MetadataDependencyTransformationTask"
)
build("build", buildOptions = buildOptions) {
// Reduce the problem numbers when a Task become compatible with GCC.
// When all tasks support GCC, replace these assertions with `testConfigurationCacheOf`
assertOutputContains("4 problems were found storing the configuration cache, 2 of which seem unique.")
configCacheIncompatibleTaskTypes.forEach { taskType ->
assertOutputContains(
"""Task `\S+` of type `[\w.]+$taskType`: .+(at execution time is unsupported)|(not supported with the configuration cache)"""
.toRegex()
testConfigurationCacheOf(
"build",
executedTaskNames = expectedTasks,
checkConfigurationCacheFileReport = false,
buildOptions = defaultBuildOptions.copy(
configurationCacheProblems = BaseGradleIT.ConfigurationCacheProblems.FAIL,
warningMode = WarningMode.All,
freeArgs = listOf(
// remove after KT-49933 is fixed
"-x", ":lib:transformCommonMainDependenciesMetadata",
"-x", ":lib:transformCommonMainCInteropDependenciesMetadata",
)
}
// TODO: Enable `warningMode = Fail` back and remove these asserts when KGP supports Gradle 8.0
assertOutputContains("The TestReport.destinationDir property has been deprecated.")
assertOutputContains("The TestReport.reportOn(Object...) method has been deprecated.")
}
)
)
}
}
@@ -1,3 +1,3 @@
fun foo() = "bar" + my.cinterop.foo()
fun foo() = "bar" //+ my.cinterop.foo()
fun main() = println(foo())
@@ -5,6 +5,6 @@ class CommonTest {
@Test
fun sampleTest() {
assertEquals("bar42", foo())
assertEquals("bar", foo())
}
}