Fake service to limit tests concurrency
Required for KTI-1553
This commit is contained in:
committed by
Space Team
parent
46d16dfb6c
commit
85399bc969
+12
@@ -0,0 +1,12 @@
|
||||
import org.gradle.api.services.BuildService
|
||||
import org.gradle.api.services.BuildServiceParameters
|
||||
|
||||
/*
|
||||
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
abstract class ConcurrencyLimitService : BuildService<ConcurrencyLimitService.Params> {
|
||||
interface Params : BuildServiceParameters
|
||||
|
||||
}
|
||||
@@ -120,6 +120,10 @@ fun Project.projectTest(
|
||||
defineJDKEnvVariables: List<JdkMajorVersion> = emptyList(),
|
||||
body: Test.() -> Unit = {},
|
||||
): TaskProvider<Test> {
|
||||
val concurrencyLimitService =
|
||||
project.gradle.sharedServices.registerIfAbsent("concurrencyLimitService", ConcurrencyLimitService::class) {
|
||||
maxParallelUsages = 1
|
||||
}
|
||||
val shouldInstrument = project.providers.gradleProperty("kotlin.test.instrumentation.disable")
|
||||
.orNull?.toBoolean() != true
|
||||
if (shouldInstrument) {
|
||||
@@ -202,6 +206,7 @@ fun Project.projectTest(
|
||||
defaultMaxMemoryPerTestWorkerMb
|
||||
|
||||
maxHeapSize = "${memoryPerTestProcessMb}m"
|
||||
usesService(concurrencyLimitService)
|
||||
|
||||
if (minHeapSizeMb != null) {
|
||||
minHeapSize = "${minHeapSizeMb}m"
|
||||
|
||||
Reference in New Issue
Block a user