diff --git a/build.gradle.kts b/build.gradle.kts index 4c52d0b..e60abe5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,8 @@ + import com.diffplug.gradle.spotless.SpotlessApply import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask import org.gradle.api.tasks.testing.logging.TestExceptionFormat +import org.jetbrains.kotlin.gradle.dsl.JvmTarget import org.jetbrains.kotlin.gradle.tasks.KotlinCompile buildscript { @@ -50,6 +52,13 @@ allprojects { } } +// Create and register ExecutionService which enforces serial execution of assigned tasks +abstract class SerialExecutionService : BuildService +val serialExecutionService = + gradle.sharedServices.registerIfAbsent("serialExecution", SerialExecutionService::class.java) { + this.maxParallelUsages.set(1) + } + val spotlessApplyAll: Task by tasks.creating subprojects { @@ -122,8 +131,8 @@ subprojects { } tasks.withType { - kotlinOptions { - jvmTarget = "11" + compilerOptions { + jvmTarget.set(JvmTarget.JVM_11) } } @@ -195,6 +204,11 @@ subprojects { password = project.findProperty("deployPassword") as? String } } + + // Prevent parallel publishing + tasks.withType { + usesService(serialExecutionService) + } } } }