Upgrade folly to fix NDK 21 build issue (#31802)

Summary:
Upgrade folly for the https://github.com/facebook/folly/pull/1593 fix for NDK 21 failure

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Changed] - Upgrade folly to 2021.06.28.00

Pull Request resolved: https://github.com/facebook/react-native/pull/31802

Test Plan:
`./gradlew :ReactAndroid:installArchives`
`./gradlew packages:rn-tester:android:app:installJscRelease`
`./gradlew packages:rn-tester:android:app:installHermesRelease`

Reviewed By: RSNara

Differential Revision: D29547027

Pulled By: ShikaSD

fbshipit-source-id: a10c7c65f459091bd0e7cca750a9b9e067189b73
This commit is contained in:
Kudo Chien 2021-07-06 10:34:10 -07:00 коммит произвёл Facebook GitHub Bot
Родитель bf2e1c9763
Коммит ebe939b18a
4 изменённых файлов: 4 добавлений и 37 удалений

Просмотреть файл

@ -96,12 +96,6 @@ task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy
eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
includeEmptyDirs = false
into("$thirdPartyNdkDir/folly")
doLast {
ant.patch(
patchfile: "src/main/jni/third-party/folly/FileUtil.cpp.patch",
originalFile: "$thirdPartyNdkDir/folly/folly/FileUtil.cpp"
)
}
}
task downloadFmt(dependsOn: createNativeDepsDirectories, type: Download) {

Просмотреть файл

@ -17,7 +17,7 @@ SO_LOADER_VERSION=0.10.1
BOOST_VERSION=1_63_0
DOUBLE_CONVERSION_VERSION=1.1.6
FOLLY_VERSION=2021.04.26.00
FOLLY_VERSION=2021.06.28.00
FMT_VERSION=6.2.1
LIBEVENT_VERSION=2.1.12
GLOG_VERSION=0.3.5

Просмотреть файл

@ -86,11 +86,13 @@ LOCAL_SRC_FILES := \
folly/io/async/AsyncTimeout.cpp \
folly/io/async/EventBase.cpp \
folly/io/async/EventBaseBackendBase.cpp \
folly/io/async/EventBaseLocal.cpp \
folly/io/async/EventHandler.cpp \
folly/io/async/HHWheelTimer.cpp \
folly/io/async/Request.cpp \
folly/io/async/TimeoutManager.cpp \
folly/io/async/VirtualEventBase.cpp \
folly/lang/Exception.cpp \
folly/memory/MallctlHelper.cpp \
folly/portability/SysMembarrier.cpp \
folly/synchronization/AsymmetricMemoryBarrier.cpp \
@ -106,7 +108,7 @@ LOCAL_SRC_FILES := \
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_CFLAGS += -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare
LOCAL_CFLAGS += -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -Wno-unused-variable
LOCAL_CFLAGS += $(FOLLY_FLAGS)

Просмотреть файл

@ -1,29 +0,0 @@
--- FileUtil.cpp.orig 2021-06-16 20:53:12.000000000 +0800
+++ FileUtil.cpp 2021-06-16 20:53:37.000000000 +0800
@@ -35,7 +35,26 @@
using namespace fileutil_detail;
int openNoInt(const char* name, int flags, mode_t mode) {
+#if defined(__ANDROID__)
+ // NDK bionic with FORTIFY has this definition:
+ // https://android.googlesource.com/platform/bionic/+/9349b9e51b/libc/include/bits/fortify/fcntl.h
+ // ```
+ // __BIONIC_ERROR_FUNCTION_VISIBILITY
+ // int open(const char* pathname, int flags, mode_t modes, ...) __overloadable
+ // __errorattr(__open_too_many_args_error);
+ // ```
+ // This is originally to prevent open() with incorrect parameters.
+ //
+ // However, combined with folly wrapNotInt, template deduction will fail.
+ // In this case, we create a custom Open lambda to bypass the error.
+ // The solution is referenced from
+ // https://github.com/llvm/llvm-project/commit/0a0e411204a2baa520fd73a8d69b664f98b428ba
+ //
+ auto Open = [&]() { return open(name, flags, mode); };
+ return int(wrapNoInt(Open));
+#else
return int(wrapNoInt(open, name, flags, mode));
+#endif
}
static int filterCloseReturn(int r) {