From a5b7e04943162e85069a51a13d3a206760cee189 Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 12 Aug 2023 13:23:11 +0200 Subject: [PATCH] Gradle: check whether parallel build is enabled when running 'publish' task https://stackoverflow.com/questions/72664149/gradle-maven-publish-sonatype-creates-multiple-repositories-that-cant-be-clos --- buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts b/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts index 58d2ec29..3dddae71 100644 --- a/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts +++ b/buildSrc/src/main/kotlin/flatlaf-publish.gradle.kts @@ -122,3 +122,11 @@ signing { tasks.withType().configureEach { onlyIf { rootProject.hasProperty( "release" ) } } + +// check whether parallel build is enabled +tasks.withType().configureEach { + doFirst { + if( rootProject.hasProperty( "org.gradle.parallel" ) && rootProject.property( "org.gradle.parallel" ) == "true" ) + throw RuntimeException( "Publishing does not work correctly with enabled parallel build. Disable parallel build with VM option '-Dorg.gradle.parallel=false'." ) + } +}