diff --git a/build.gradle b/build.gradle index cea046a557d..b18d50ce989 100644 --- a/build.gradle +++ b/build.gradle @@ -281,6 +281,12 @@ def javadocSource = [] def javadocClasspath = [] def javadocDependentTasks = [] +def services = [':services:default', + ':services:backend', + ':services:bsa', + ':services:tools', + ':services:pubapi'] + subprojects { // Skip no-op project if (project.name == 'services') return @@ -365,12 +371,6 @@ subprojects { } } - def services = [':services:default', - ':services:backend', - ':services:bsa', - ':services:tools', - ':services:pubapi'] - // Set up all of the deployment projects. if (services.contains(project.path)) { @@ -422,6 +422,13 @@ subprojects { } } +// Force SDK download to be sequential, otherwise parallel tasks will try to +// write to the same location to upgrade gcloud and fail. +for (int i = 1; i < services.size(); i++) { + project("${services[i]}").downloadCloudSdk + .dependsOn(project("${services[i - 1]}").downloadCloudSdk) +} + // If "-P verboseTestOutput=true" is passed in, configure all subprojects to dump all of their // output and final test status (pass/fail, errors) for each test class. //