Skip to content

Commit

Permalink
[android][ios] Upgrade react-native to 0.67.2 in Expo Go (expo#16400)
Browse files Browse the repository at this point in the history
# Why

upgrade for sdk 45

# How

## upgrade react native fork

code in https://github.com/expo/react-native/tree/sdk-45
basically cherry pick most necessary commits from sdk-44 branch but not these two:

1. expo/react-native@125b36a: because ExpoKit is already deprecated.
2. expo/react-native@82d3ff5: [use the official way to set metro server address](facebook/react-native@e2b5b65)

## migrate project setup

basically reference from: https://react-native-community.github.io/upgrade-helper/?from=0.64.2&to=0.67.2

## other build errors or launch errors

just to deal with these mess one by one.

# Test Plan

- [android] unversioned expo-go build + launch + load unversioned NCL
- [ios] unversioned expo-go build + launch + load unversioned NCL
  • Loading branch information
Kudo authored Feb 24, 2022
1 parent b7c8f46 commit 2ed3104
Show file tree
Hide file tree
Showing 1,166 changed files with 36,050 additions and 19,763 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/android-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ jobs:
name: Restore NDK cache
id: cache-android-ndk
with:
path: /usr/local/lib/android/sdk/ndk/19.2.5345600/
key: ${{ runner.os }}-ndk-19.2.5345600
path: /usr/local/lib/android/sdk/ndk/21.4.7075529/
key: ${{ runner.os }}-ndk-21.4.7075529
restore-keys: |
${{ runner.os }}-ndk-
- name: Install NDK
if: steps.cache-android-ndk.outputs.cache-hit != 'true'
run: |
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;19.2.5345600"
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;21.4.7075529"
- run: echo "$(pwd)/bin" >> $GITHUB_PATH
- name: Patch react-native to support single abi
run: sed -i 's/^APP_ABI := .*$/APP_ABI := $(if $(NDK_ABI_FILTERS),$(NDK_ABI_FILTERS),$(armeabi-v7a x86 arm64-v8a x86_64))/g' ReactAndroid/src/main/jni/Application.mk
working-directory: react-native-lab/react-native
- name: Run Spotless lint check
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/
working-directory: android
run: ./gradlew spotlessCheck || { echo '::error Spotless lint failed. Run `./gradlew spotlessApply` to automatically fix formatting.' && exit 1; }
- name: Run native Android unit tests
timeout-minutes: 30
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/
run: expotools native-unit-tests --platform android
- name: Save test results
if: always()
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/client-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ jobs:
uses: actions/cache@v2
id: cache-android-ndk
with:
path: /usr/local/lib/android/sdk/ndk/19.2.5345600/
key: ${{ runner.os }}-ndk-19.2.5345600
path: /usr/local/lib/android/sdk/ndk/21.4.7075529/
key: ${{ runner.os }}-ndk-21.4.7075529
restore-keys: |
${{ runner.os }}-ndk-
- name: 🛠 Install NDK
if: steps.cache-android-ndk.outputs.cache-hit != 'true'
run: |
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;19.2.5345600"
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;21.4.7075529"
- name: 🔎 Check which flavor to build
id: flavor
uses: dorny/paths-filter@v2
Expand All @@ -118,7 +118,7 @@ jobs:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ExponentKey
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/
IS_APP_BUNDLE: ${{ github.event.inputs.releaseGooglePlay == 'release-google-play' }}
IS_RELEASE_BUILD: ${{ github.event.inputs.releaseAPK == 'release-apk' || github.event.inputs.releaseGooglePlay == 'release-google-play' }}
IS_VERSIONED_FLAVOR: ${{ github.event_name == 'schedule' || steps.flavor.outputs.versioned == 'true' }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/development-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,14 @@ jobs:
- uses: actions/cache@v2
id: cache-android-ndk
with:
path: /usr/local/lib/android/sdk/ndk/19.2.5345600/
key: ${{ runner.os }}-ndk-19.2.5345600
path: /usr/local/lib/android/sdk/ndk/21.4.7075529/
key: ${{ runner.os }}-ndk-21.4.7075529
restore-keys: |
${{ runner.os }}-ndk-
- name: Install NDK
if: steps.cache-android-ndk.outputs.cache-hit != 'true'
run: |
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;19.2.5345600"
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;21.4.7075529"
- run: yarn global add expo-cli
- run: echo "$(yarn global bin)" >> $GITHUB_PATH
- name: Init new expo app
Expand Down Expand Up @@ -91,7 +91,7 @@ jobs:
run: sed -i -e 's/com\.android\.tools\.build:gradle:3\..\../com\.android\.tools\.build:gradle:3\.5\.4/' ./android/build.gradle
- name: Build debug
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/
working-directory: ../development-client-android-test/android
run: ./gradlew assembleDebug

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/dogfooding-clients.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ jobs:
uses: actions/cache@v2
id: cache-android-ndk
with:
path: /usr/local/lib/android/sdk/ndk/19.2.5345600/
key: ${{ runner.os }}-ndk-19.2.5345600
path: /usr/local/lib/android/sdk/ndk/21.4.7075529/
key: ${{ runner.os }}-ndk-21.4.7075529
restore-keys: |
${{ runner.os }}-ndk-
- name: 🛠 Install NDK
if: steps.cache-android-ndk.outputs.cache-hit != 'true'
run: |
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;19.2.5345600"
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;21.4.7075529"
- name: 🦴 Publish dogfood home and generate bundled manifest
run: bin/expotools publish-dogfood-home
env:
Expand All @@ -75,7 +75,7 @@ jobs:
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_ALIAS: ExponentKey
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/
USE_DOGFOODING_PUBLISHED_KERNEL_MANIFEST: true
run: |
BUILD_TYPE="Release"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/shell-app-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ jobs:
- uses: actions/cache@v2
id: cache-android-ndk
with:
path: /usr/local/lib/android/sdk/ndk/19.2.5345600/
key: ${{ runner.os }}-ndk-19.2.5345600
path: /usr/local/lib/android/sdk/ndk/21.4.7075529/
key: ${{ runner.os }}-ndk-21.4.7075529
restore-keys: |
${{ runner.os }}-ndk-
- name: Install NDK
if: steps.cache-android-ndk.outputs.cache-hit != 'true'
run: |
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;19.2.5345600"
sudo $ANDROID_SDK_ROOT/tools/bin/sdkmanager --install "ndk;21.4.7075529"
- name: Build Android packages
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/
run: expotools android-build-packages --packages all
- name: Clean Android build artifacts that would needlessly bloat the shell app
env:
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/19.2.5345600/
ANDROID_NDK_HOME: /usr/local/lib/android/sdk/ndk/21.4.7075529/
run: ./gradlew clean
working-directory: android
- name: Build shell app tarball
Expand Down
85 changes: 82 additions & 3 deletions android/ReactAndroid/Android-prebuilt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,18 @@ LOCAL_EXPORT_C_INCLUDES := $(THIRD_PARTY_NDK_DIR)/glog/exported
LOCAL_SHARED_LIBRARIES := libglog
include $(PREBUILT_SHARED_LIBRARY)

# yoga
include $(CLEAR_VARS)
LOCAL_MODULE := yoga
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libyoga.so
LOCAL_EXPORT_C_INCLUDES := \
$(FIRST_PARTY_NDK_DIR)/yogajni/jni \
$(REACT_COMMON_DIR)/yoga
# Note: Sync with yogajni/Android.mk
LOCAL_CFLAGS += -fvisibility=hidden -fexceptions -frtti -O3
LOCAL_LDLIBS += -landroid -llog
include $(PREBUILT_SHARED_LIBRARY)

# react_nativemodule_core
include $(CLEAR_VARS)
LOCAL_MODULE := react_nativemodule_core
Expand All @@ -85,10 +97,77 @@ LOCAL_EXPORT_C_INCLUDES := \
$(REACT_ANDROID_SRC_DIR)/java/com/facebook/react/turbomodule/core/jni
include $(PREBUILT_SHARED_LIBRARY)

# react_codegen_reactandroidspec
# react_render_core
include $(CLEAR_VARS)
LOCAL_MODULE := react_render_core
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_render_core.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR) \
$(REACT_COMMON_DIR)/react/renderer/core
include $(PREBUILT_SHARED_LIBRARY)

# react_render_debug
include $(CLEAR_VARS)
LOCAL_MODULE := react_render_debug
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_render_debug.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR)/react/renderer/debug
include $(PREBUILT_SHARED_LIBRARY)

# react_render_graphics
include $(CLEAR_VARS)
LOCAL_MODULE := react_render_graphics
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_render_graphics.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR)/react/renderer/graphics \
$(REACT_COMMON_DIR)/react/renderer/graphics/platform/cxx
include $(PREBUILT_SHARED_LIBRARY)

# react_render_imagemanager
include $(CLEAR_VARS)
LOCAL_MODULE := react_render_imagemanager
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_render_imagemanager.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR)/react/renderer/imagemanager \
$(REACT_COMMON_DIR)/react/renderer/imagemanager/platform/cxx
include $(PREBUILT_SHARED_LIBRARY)

# react_render_mounting
include $(CLEAR_VARS)
LOCAL_MODULE := react_render_mounting
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_render_mounting.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR)/react/renderer/mounting
include $(PREBUILT_SHARED_LIBRARY)

# react_render_mapbuffer
include $(CLEAR_VARS)
LOCAL_MODULE := react_render_mapbuffer
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_render_mapbuffer.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR)/react/renderer/mapbuffer
include $(PREBUILT_SHARED_LIBRARY)

# rrc_view
include $(CLEAR_VARS)
LOCAL_MODULE := rrc_view
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/librrc_view.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR)/react/renderer/components/view
include $(PREBUILT_SHARED_LIBRARY)

# jsi
include $(CLEAR_VARS)
LOCAL_MODULE := jsi
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libjsi.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_COMMON_DIR)/jsi
include $(PREBUILT_SHARED_LIBRARY)

# react_codegen_rncore
include $(CLEAR_VARS)
LOCAL_MODULE := react_codegen_reactandroidspec
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_codegen_reactandroidspec.so
LOCAL_MODULE := react_codegen_rncore
LOCAL_SRC_FILES := $(REACT_NDK_EXPORT_DIR)/$(TARGET_ARCH_ABI)/libreact_codegen_rncore.so
LOCAL_EXPORT_C_INCLUDES := \
$(REACT_GENERATED_SRC_DIR)/codegen/jni
include $(PREBUILT_SHARED_LIBRARY)
Expand Down
4 changes: 2 additions & 2 deletions android/ReactAndroid/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Building React Native for Android

See the [docs on the website](https://reactnative.dev/docs/building-from-source.html#android).
See the [docs on the wiki](https://github.com/facebook/react-native/wiki/Building-from-source#prerequisites).

# Running tests

When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see [Testing](https://reactnative.dev/docs/testing.html).
When you submit a pull request CircleCI will automatically run all tests. To run tests locally, see [Testing](https://github.com/facebook/react-native/wiki/Tests).
Loading

0 comments on commit 2ed3104

Please sign in to comment.