From c72088a137cde9a3f619585578773d538a324a45 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Thu, 28 Apr 2022 06:36:42 -0700 Subject: [PATCH] Execute third-party prepare before configureCMake Summary: ^ :android:third-party task, on ocassions, gets parallelised with the :configureCMake task resulting in build errors. :configureCMake depends on dependencies being in-place and patched. Our current setup was achieving this via setting these tasks as dependencies of the preBuild task. Unfortunately, this seems not be a bullet-proof solution. This patch aims to improve this situation by ensuring the tasks are executed before :configureCMake. Whatever happens first. Changelog: Execute :third-party:prepare before :configureCMake task on Android Reviewed By: passy Differential Revision: D36001637 fbshipit-source-id: 6c53b6852e40e354337c0ac940b5bbad4ef83078 --- android/build.gradle | 8 ++++++++ xplat/build.gradle | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/android/build.gradle b/android/build.gradle index ba7e90750..b2169f2f7 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -79,6 +79,14 @@ android { } } +// Patch below is used in case the 'configureCMake' task +// gets executed in parallel with the 'preBuild' task. +// Our CMakeFile expects third-party dependencies to be already +// in-place and patched. +tasks.matching { it.name.startsWith("configureCMake") }.all { + dependsOn(tasks.getByPath(':third-party:prepare')) +} + preBuild.dependsOn(tasks.getByPath(':third-party:prepare')) apply plugin: 'com.vanniktech.maven.publish' diff --git a/xplat/build.gradle b/xplat/build.gradle index fc48f4f67..71e3e2fa1 100644 --- a/xplat/build.gradle +++ b/xplat/build.gradle @@ -44,4 +44,12 @@ android { } } +// Patch below is used in case the 'configureCMake' task +// gets executed in parallel with the 'preBuild' task. +// Our CMakeFile expects third-party dependencies to be already +// in-place and patched. +tasks.matching { it.name.startsWith("configureCMake") }.all { + dependsOn(tasks.getByPath(':third-party:prepare')) +} + preBuild.dependsOn(tasks.getByPath(':third-party:prepare'))