]> source.dussan.org Git - sonarqube.git/commitdiff
Usage of Gradle option "--parallel" should be safe
authorEvgeny Mandrikov <mandrikov@gmail.com>
Thu, 20 Jun 2019 18:13:38 +0000 (20:13 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 28 Jun 2019 06:45:47 +0000 (08:45 +0200)
Gradle should not execute several "yarn install" in parallel,
because Yarn doesn't support concurrent access to its global cache.

build.gradle

index 2a9e81430cbdf1593d740e1b141ded5337d6816d..03a5884b8d4bf0ffefe3b52eb23c499ff970857d 100644 (file)
@@ -414,6 +414,15 @@ subprojects {
   }
 }
 
+
+// Yarn doesn't support concurrent access to its global cache,
+// i.e. parallel execution of several "yarn install" tasks,
+// since these tasks are independent, we can establish arbitrary total order
+// to prevent their concurrent execution:
+def yarnInstallTasks = allprojects.findResults { it -> it.tasks.findByName('yarn') }
+yarnInstallTasks.eachWithIndex { it, i -> if (i > 0) it.mustRunAfter(yarnInstallTasks.get(i - 1)) }
+
+
 artifactory {
   clientConfig.setIncludeEnvVars(true)
   clientConfig.setEnvVarsExcludePatterns('*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*,*key*,*KEY*')