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 authored and Flewp committed Jan 17, 2023
1 parent 7caed29 commit 4d9fa18
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 @@ -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")
}
Expand Down

0 comments on commit 4d9fa18

Please sign in to comment.