aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Mandrikov <138671+Godin@users.noreply.github.com>2019-07-26 14:50:36 +0200
committerSonarTech <sonartech@sonarsource.com>2019-07-26 20:21:46 +0200
commit6fa9cf49b78f8f49b300890e57398247163a66b1 (patch)
treeacadc32832090da7f8bf6bd8245d686aba471a8d
parent43d710e93b5bbe96e5364e9eb5dc7c88b2a2118c (diff)
downloadsonarqube-6fa9cf49b78f8f49b300890e57398247163a66b1.tar.gz
sonarqube-6fa9cf49b78f8f49b300890e57398247163a66b1.zip
Usage of Gradle option "--parallel" should be safe
Gradle should not execute several "yarn install" in parallel, because Yarn doesn't support concurrent access to its global cache. "task1.mustRunAfter(task2)" ordering has an effect only when both tasks are scheduled for execution, however currently task ":private:docs:yarn" is not executed during execution of "gradle build". Therefore "mustRunAfter" should be established between all pairs of "yarn install" tasks to define their total order and to prevent their concurrent execution even in case when one or more of these tasks not scheduled.
-rw-r--r--build.gradle9
1 files changed, 7 insertions, 2 deletions
diff --git a/build.gradle b/build.gradle
index a2b1fd54c46..9ce55594e38 100644
--- a/build.gradle
+++ b/build.gradle
@@ -422,9 +422,14 @@ 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:
+// to prevent their concurrent execution.
+// Note that "task1.mustRunAfter(task2)" ordering has an effect only when both
+// tasks are scheduled for execution, therefore should be established between
+// all pairs of "yarn install" tasks to define their total order and to prevent
+// their concurrent execution even in case when one or more of these tasks not
+// scheduled.
def yarnInstallTasks = allprojects.findResults { it -> it.tasks.findByName('yarn') }
-yarnInstallTasks.eachWithIndex { it, i -> if (i > 0) it.mustRunAfter(yarnInstallTasks.get(i - 1)) }
+yarnInstallTasks.drop(1).eachWithIndex { it, i -> it.mustRunAfter(yarnInstallTasks[0..i]) }
artifactory {