From 4d9fa18fd9018a1b702beab14aea06b060d854d0 Mon Sep 17 00:00:00 2001 From: mrkcsc Date: Tue, 20 Jul 2021 14:48:08 -0700 Subject: [PATCH] Fix Android build.gradle for facebook#28298 --- ReactAndroid/build.gradle | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ReactAndroid/build.gradle b/ReactAndroid/build.gradle index 037e9dc92b0a84..90f520c6e33012 100644 --- a/ReactAndroid/build.gradle +++ b/ReactAndroid/build.gradle @@ -268,11 +268,24 @@ task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) { dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz")) } +// A temporary workaround for build failing on some machines. +// See: https://github.com/facebook/react-native/issues/28298 +def follyReplaceContent = ''' + ssize_t r; + do { + r = open(name, flags, mode); + } while (r == -1 && errno == EINTR); + return r; +''' + task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) { from(dependenciesPath ?: tarTree(downloadFolly.dest)) from("src/main/jni/third-party/folly/") include("folly-${FOLLY_VERSION}/folly/**/*", "CMakeLists.txt") eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") } + // Fixes problem with Folly failing to build on certain systems. + // See https://github.com/facebook/react-native/issues/28298 + filter { line -> line.replaceAll('return int\\(wrapNoInt\\(open, name, flags, mode\\)\\);', follyReplaceContent) } includeEmptyDirs = false into("$thirdPartyNdkDir/folly") }