Skip to content

Commit

Permalink
Fix Android build.gradle for facebook#28298
Browse files Browse the repository at this point in the history
  • Loading branch information
mrkcsc committed Jul 20, 2021
1 parent 1a51768 commit 1e2887c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ReactAndroid/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,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/Android.mk")
include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
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")
}
Expand Down

0 comments on commit 1e2887c

Please sign in to comment.