Use modern Android libc++ in Yoga and React Native OSS (#39795)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39795
X-link: https://github.com/facebook/yoga/pull/1412

Android NDK 25 uses a version of libc++ that is more than three years old, missing a lot of basic features of C++ 20. This is rectified in NDK 26 (latest LTS NDK), which brings us up to date with latest Clang (17, released this year), and adds a new policy where future NDK versions will bump libc++ as part of bumping LLVM/Clang.

This requires an a beta AGP version (and corresponding Android Studio Preview). Based on how far we are historically, it wouldn't be a surprise if we see the stable release this month (well before the RN 0.74/Yoga 3.0 cut, even in the worse case).

Changelog:
[Android][Changed] - Use NDK 26

Reviewed By: yungsters

Differential Revision: D49895949

fbshipit-source-id: 37bb4d1fdf81137be7f14f6675b4e079c6f861e4
This commit is contained in:
Nick Gerleman 2023-10-04 19:57:14 -07:00 коммит произвёл Facebook GitHub Bot
Родитель aefefdbbba
Коммит 9ce7b56413
6 изменённых файлов: 8 добавлений и 8 удалений

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

@ -30,7 +30,7 @@ version =
group = "com.facebook.react" group = "com.facebook.react"
val ndkPath by extra(System.getenv("ANDROID_NDK")) val ndkPath by extra(System.getenv("ANDROID_NDK"))
val ndkVersion by extra(System.getenv("ANDROID_NDK_VERSION") ?: "25.1.8937393") val ndkVersion by extra(System.getenv("ANDROID_NDK_VERSION") ?: "26.0.10792818")
val sonatypeUsername = findProperty("SONATYPE_USERNAME")?.toString() val sonatypeUsername = findProperty("SONATYPE_USERNAME")?.toString()
val sonatypePassword = findProperty("SONATYPE_PASSWORD")?.toString() val sonatypePassword = findProperty("SONATYPE_PASSWORD")?.toString()
@ -106,11 +106,11 @@ if (project.findProperty("react.internal.useHermesNightly")?.toString()?.toBoole
""" """
******************************************************************************** ********************************************************************************
INFO: You're using Hermes from nightly as you set INFO: You're using Hermes from nightly as you set
react.internal.useHermesNightly=true react.internal.useHermesNightly=true
in the ./gradle.properties file. in the ./gradle.properties file.
That's fine for local development, but you should not commit this change. That's fine for local development, but you should not commit this change.
******************************************************************************** ********************************************************************************
""" """

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

@ -525,7 +525,6 @@ android {
"-DREACT_BUILD_DIR=$buildDir", "-DREACT_BUILD_DIR=$buildDir",
"-DANDROID_STL=c++_shared", "-DANDROID_STL=c++_shared",
"-DANDROID_TOOLCHAIN=clang", "-DANDROID_TOOLCHAIN=clang",
"-DANDROID_PLATFORM=android-21",
// Due to https://github.com/android/ndk/issues/1693 we're losing Android // Due to https://github.com/android/ndk/issues/1693 we're losing Android
// specific compilation flags. This can be removed once we moved to NDK 25/26 // specific compilation flags. This can be removed once we moved to NDK 25/26
"-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON" "-DANDROID_USE_LEGACY_TOOLCHAIN_FILE=ON"

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

@ -11,6 +11,7 @@ add_compile_options(
-O2 -O2
-Wno-unused-function -Wno-unused-function
-Wno-unneeded-internal-declaration -Wno-unneeded-internal-declaration
-Wno-array-parameter # Fixed in 2.2.1 (not yet released)
-std=c11) -std=c11)
add_library(event add_library(event

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

@ -352,7 +352,7 @@ CommitStatus ShadowTree::commit(
const CommitOptions& commitOptions) const { const CommitOptions& commitOptions) const {
SystraceSection s("ShadowTree::commit"); SystraceSection s("ShadowTree::commit");
int attempts = 0; [[maybe_unused]] int attempts = 0;
while (true) { while (true) {
attempts++; attempts++;

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

@ -5,7 +5,7 @@ targetSdk = "34"
compileSdk = "34" compileSdk = "34"
buildTools = "34.0.0" buildTools = "34.0.0"
# Dependencies versions # Dependencies versions
agp = "8.1.1" agp = "8.2.0-beta06"
androidx-annotation = "1.6.0" androidx-annotation = "1.6.0"
androidx-appcompat = "1.6.1" androidx-appcompat = "1.6.1"
androidx-autofill = "1.1.0" androidx-autofill = "1.1.0"

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

@ -6,7 +6,7 @@ buildscript {
minSdkVersion = 23 minSdkVersion = 23
compileSdkVersion = 34 compileSdkVersion = 34
targetSdkVersion = 34 targetSdkVersion = 34
ndkVersion = "25.1.8937393" ndkVersion = "26.0.10792818"
kotlinVersion = "1.8.0" kotlinVersion = "1.8.0"
} }
repositories { repositories {