From 9ac5c03a538f33496dd9a84a7c8c2aa62064755c Mon Sep 17 00:00:00 2001 From: Evgeny Mandrikov Date: Thu, 20 Jun 2019 20:13:38 +0200 Subject: [PATCH] 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. --- build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/build.gradle b/build.gradle index 2a9e81430cb..03a5884b8d4 100644 --- a/build.gradle +++ b/build.gradle @@ -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*') -- 2.39.5