[Test] Disable Configuration Cache for native tasks

cherry-picked from 538cb41a320df93ca85a194b8566ea44457187ca

^KT-43293
This commit is contained in:
Anton Lakotka
2022-04-14 15:08:17 +02:00
committed by Space
parent d2c6489de9
commit dfd89a45f7
4 changed files with 41 additions and 21 deletions
@@ -728,27 +728,27 @@ class HierarchicalMppIT : KGPBaseTest() {
assertTasksExecuted(":lib:publish") assertTasksExecuted(":lib:publish")
} }
val gccIncompatibleTasks = listOf(
":generateProjectStructureMetadata",
":transformCommonMainDependenciesMetadata",
":cinteropFooLinuxX64",
":compileKotlinLinuxX64",
":linkDebugSharedLinuxX64",
)
build("clean", "assemble", buildOptions = options) { build("clean", "assemble", buildOptions = options) {
assertTasksExecuted( assertTasksExecuted(gccIncompatibleTasks)
":generateProjectStructureMetadata", gccIncompatibleTasks.forEach { task ->
":transformCommonMainDependenciesMetadata" assertOutputContains(
) """Task `:$task` of type `.+`: .+(at execution time is unsupported)|(not supported with the configuration cache)"""
assertOutputContains( .toRegex()
"""Task `:generateProjectStructureMetadata` of type `.+`: invocation of 'Task\.project' at execution time is unsupported""" )
.toRegex() }
)
assertOutputContains(
"""Task `:transformCommonMainDependenciesMetadata` of type `.+`: invocation of 'Task.project' at execution time is unsupported"""
.toRegex()
)
} }
build("clean", "assemble", buildOptions = options) { build("clean", "assemble", buildOptions = options) {
assertOutputContains("Configuration cache entry discarded") assertOutputContains("Configuration cache entry discarded")
assertTasksExecuted( assertTasksExecuted(gccIncompatibleTasks)
":generateProjectStructureMetadata",
":transformCommonMainDependenciesMetadata"
)
} }
} }
} }
@@ -12,7 +12,16 @@ allprojects {
kotlin { kotlin {
jvm() jvm()
linuxX64() linuxX64 {
binaries { sharedLib() }
compilations.getByName("main").apply {
cinterops {
val foo by creating {
defFile(project.file("foo.def"))
}
}
}
}
sourceSets { sourceSets {
val commonMain by getting { val commonMain by getting {
@@ -0,0 +1,7 @@
package = test.cinterop
---
static int testCinterop(char* str) {
return 42;
}
@@ -158,6 +158,10 @@ abstract class AbstractKotlinNativeCompile<
compilation.konanTarget compilation.konanTarget
} }
init {
notCompatibleWithConfigurationCache("Task $name does not support Gradle Configuration Cache. Check KT-43293 for more info")
}
@get:Classpath @get:Classpath
override val libraries: ConfigurableFileCollection by project.provider { override val libraries: ConfigurableFileCollection by project.provider {
// Avoid resolving these dependencies during task graph construction when we can't build the target: // Avoid resolving these dependencies during task graph construction when we can't build the target:
@@ -313,10 +317,6 @@ constructor(
) : AbstractKotlinNativeCompile<KotlinCommonOptions, KotlinNativeCompilationData<*>, StubK2NativeCompilerArguments>(objectFactory), ) : AbstractKotlinNativeCompile<KotlinCommonOptions, KotlinNativeCompilationData<*>, StubK2NativeCompilerArguments>(objectFactory),
KotlinCompile<KotlinCommonOptions> { KotlinCompile<KotlinCommonOptions> {
init {
notCompatibleWithConfigurationCache("Task $name does not support Gradle Configuration Cache. Check KT-43293 for more info")
}
@get:Input @get:Input
override val outputKind = LIBRARY override val outputKind = LIBRARY
@@ -1093,6 +1093,10 @@ open class CInteropProcess @Inject constructor(@get:Internal val settings: Defau
val outputFile: File val outputFile: File
get() = outputFileProvider.get() get() = outputFileProvider.get()
init {
notCompatibleWithConfigurationCache("Task $name does not support Gradle Configuration Cache. Check KT-43293 for more info")
}
// Inputs and outputs. // Inputs and outputs.
@OutputFile @OutputFile