Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Migrate to React Native 0.71 #480

Merged
merged 37 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
1e1cb66
feat: Migrate to RN 71 buildscript w/ prefabs
mrousavy Nov 10, 2022
5b2f961
Remove Kotlin
mrousavy Nov 10, 2022
5a97173
Remove KTX
mrousavy Nov 10, 2022
89679bb
Upgrade to Gradle 7.3.3
mrousavy Nov 10, 2022
7c8c88b
Remove Spotless Gradle Plugin
mrousavy Nov 10, 2022
2325aea
Remove Reanimated
mrousavy Nov 10, 2022
86d9c11
Fix CMakeLists.txt path
mrousavy Nov 10, 2022
a3d3ae6
Upgrade AppCompat
mrousavy Nov 10, 2022
3374048
Remove AppCompat
mrousavy Nov 10, 2022
b276ae8
Remove JsonSlurper
mrousavy Nov 10, 2022
44771c7
chore: Migrate Example to RN 0.71
mrousavy Nov 10, 2022
c064bed
Add package to AndroidManifest
mrousavy Nov 10, 2022
6dec683
Rebuild lockfiles
mrousavy Nov 10, 2022
e4caa2c
Rebuild Podfile
mrousavy Nov 10, 2022
f21c19b
AppDelegate.m -> AppDelegate.mm
mrousavy Nov 10, 2022
94dd80e
fix TS error
mrousavy Nov 10, 2022
32f0a72
Set up JDK version 11
mrousavy Nov 10, 2022
6662ddd
Upgrade Android version to 31
mrousavy Nov 10, 2022
5426123
Add JVM Args
mrousavy Nov 10, 2022
b33eef2
Add `de.undercouch.download` plugin
mrousavy Nov 10, 2022
0a56c85
Enable new architecture
mrousavy Nov 10, 2022
20b9144
Simplify buildscript to always assume new architecture
mrousavy Nov 10, 2022
a94126b
Remove `de.undercouch.download`
mrousavy Nov 10, 2022
d529d2c
Enable Prefab
mrousavy Nov 10, 2022
e03dda6
Fix BuildConfig import
mrousavy Nov 10, 2022
1afd3ce
Add dirty hotfix to solve maven-local
mrousavy Nov 10, 2022
5da87cb
Fix CMakeLists to use Prefab
mrousavy Nov 10, 2022
1f2010b
Fix Android namespace
mrousavy Nov 10, 2022
55231b1
fix: Manually link `MmkvPackage` in Example app
mrousavy Nov 10, 2022
49d2322
Remove `@types/react-native` from package.json as it's a dependency o…
mrousavy Nov 17, 2022
df57ba5
chore: Upgrade to RN 71 stable
mrousavy Jan 16, 2023
60d0f00
Merge branch 'master' into feat/migrate-rn-71
mrousavy Jan 16, 2023
3e7a826
simplify
mrousavy Jan 16, 2023
fc6495c
Fix build on 0.71 old & new arch
Titozzz Jan 16, 2023
362f627
Update build-android.yml
Titozzz Jan 16, 2023
6d27a94
Update Workflows
mrousavy Jan 16, 2023
c4f10a8
Update packages
mrousavy Jan 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup JDK 1.8
- name: Setup JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -57,7 +57,5 @@ jobs:
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Run Gradle Build for android/
run: cd android && ./gradlew assembleDebug --build-cache && cd ..
- name: Run Gradle Build for example/android/
run: cd example/android && ./gradlew assembleDebug --build-cache && cd ../..
10 changes: 5 additions & 5 deletions .github/workflows/validate-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./android
working-directory: ./example/android
steps:
- uses: actions/checkout@v2
- name: Setup JDK 1.8
- name: Setup JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand All @@ -42,9 +42,9 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile --cwd ..
run: yarn install --frozen-lockfile --cwd ../..
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ../example
run: yarn install --frozen-lockfile --cwd ..

- name: Restore Gradle cache
uses: actions/cache@v2
Expand Down
58 changes: 14 additions & 44 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,71 +1,41 @@
project(ReactNativeMMKV)
cmake_minimum_required(VERSION 3.9.0)

set (PACKAGE_NAME "react-native-mmkv")
set (BUILD_DIR ${CMAKE_SOURCE_DIR}/build)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 17)

add_subdirectory(../MMKV/Core core)

# Add headers search paths
include_directories(
../MMKV/Core
../cpp
"${NODE_MODULES_DIR}/react-native/React"
"${NODE_MODULES_DIR}/react-native/React/Base"
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi"
)

if(${REACT_NATIVE_VERSION} LESS 66)
file(
TO_CMAKE_PATH
"${NODE_MODULES_DIR}/react-native/ReactCommon/jsi/jsi/jsi.cpp"
INCLUDE_JSI_CPP
)
endif()

# Add MMKV core sources
add_subdirectory(../MMKV/Core core)
# Add react-native-mmkv sources
add_library(reactnativemmkv # <-- Library name
SHARED
src/main/cpp/cpp-adapter.cpp
src/main/cpp/MmkvHostObject.cpp
../cpp/TypedArray.cpp
${INCLUDE_JSI_CPP} # only on older RN versions
)

# Configure C++ 17
set_target_properties(
reactnativemmkv PROPERTIES
CXX_STANDARD 17
CXX_EXTENSIONS OFF
POSITION_INDEPENDENT_CODE ON
)

file (GLOB LIBRN_DIR "${PREBUILT_DIR}/${ANDROID_ABI}")

find_library(
log-lib
log
)
find_library(
REACT_NATIVE_JNI_LIB
reactnativejni
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
if(${REACT_NATIVE_VERSION} LESS 66)
# JSI lib didn't exist on RN 0.65 and before. Simply omit it.
set (JSI_LIB "")
else()
# RN 0.66 distributes libjsi.so, can be used instead of compiling jsi.cpp manually.
find_library(
JSI_LIB
jsi
PATHS ${LIBRN_DIR}
NO_CMAKE_FIND_ROOT_PATH
)
endif()
find_package(ReactAndroid REQUIRED CONFIG)
find_library(log-lib log)

target_link_libraries(
reactnativemmkv
core
${log-lib}
${JSI_LIB}
${REACT_NATIVE_JNI_LIB}
android
core # <-- MMKV core
${log-lib} # <-- Logcat logger
ReactAndroid::jsi # <-- JSI
android # <-- Android JNI core
)