Build: Apply ConcurrencyLimitService to all tests tasks in the project
Some project tasks are not created with projectTest helper, but all tasks should be limited since we can't use `--no-parallel` on CI
This commit is contained in:
+8
@@ -274,8 +274,16 @@ fun Project.configureTests() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val concurrencyLimitService = project.gradle.sharedServices.registerIfAbsent(
|
||||||
|
"concurrencyLimitService",
|
||||||
|
ConcurrencyLimitService::class
|
||||||
|
) {
|
||||||
|
maxParallelUsages = 1
|
||||||
|
}
|
||||||
|
|
||||||
tasks.withType<Test>().configureEach {
|
tasks.withType<Test>().configureEach {
|
||||||
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
|
outputs.doNotCacheIf("https://youtrack.jetbrains.com/issue/KTI-112") { true }
|
||||||
|
usesService(concurrencyLimitService)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggregate task for build related checks
|
// Aggregate task for build related checks
|
||||||
|
|||||||
@@ -138,10 +138,6 @@ fun Project.projectTest(
|
|||||||
defineJDKEnvVariables: List<JdkMajorVersion> = emptyList(),
|
defineJDKEnvVariables: List<JdkMajorVersion> = emptyList(),
|
||||||
body: Test.() -> Unit = {},
|
body: Test.() -> Unit = {},
|
||||||
): TaskProvider<Test> {
|
): TaskProvider<Test> {
|
||||||
val concurrencyLimitService =
|
|
||||||
project.gradle.sharedServices.registerIfAbsent("concurrencyLimitService", ConcurrencyLimitService::class) {
|
|
||||||
maxParallelUsages = 1
|
|
||||||
}
|
|
||||||
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
|
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
|
||||||
.orNull?.toBoolean() != true
|
.orNull?.toBoolean() != true
|
||||||
if (shouldInstrument) {
|
if (shouldInstrument) {
|
||||||
@@ -225,7 +221,6 @@ fun Project.projectTest(
|
|||||||
defaultMaxMemoryPerTestWorkerMb
|
defaultMaxMemoryPerTestWorkerMb
|
||||||
|
|
||||||
maxHeapSize = "${maxHeapSizeMb ?: (memoryPerTestProcessMb - maxMetaspaceSizeMb - reservedCodeCacheSizeMb)}m"
|
maxHeapSize = "${maxHeapSizeMb ?: (memoryPerTestProcessMb - maxMetaspaceSizeMb - reservedCodeCacheSizeMb)}m"
|
||||||
usesService(concurrencyLimitService)
|
|
||||||
|
|
||||||
if (minHeapSizeMb != null) {
|
if (minHeapSizeMb != null) {
|
||||||
minHeapSize = "${minHeapSizeMb}m"
|
minHeapSize = "${minHeapSizeMb}m"
|
||||||
|
|||||||
Reference in New Issue
Block a user