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

fix: add support for RN 0.76 #224

Merged
merged 12 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/
lib/
17 changes: 17 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module.exports = {
root: true,
extends: ["@react-native", "prettier"],
plugins: ["prettier"],
rules: {
"prettier/prettier": [
"warn",
{
quoteProps: "consistent",
singleQuote: false,
tabWidth: 2,
trailingComma: "es5",
useTabs: false,
},
],
},
};
2 changes: 0 additions & 2 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ runs:
steps:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc

- name: Cache dependencies
id: yarn-cache
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ on:
branches:
- main
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'cpp/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'
- ".github/workflows/build-android.yml"
- "android/**"
- "cpp/**"
- "example/android/**"
- "yarn.lock"
- "example/yarn.lock"
pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'android/**'
- 'cpp/**'
- 'example/android/**'
- 'yarn.lock'
- 'example/yarn.lock'
- ".github/workflows/build-android.yml"
- "android/**"
- "cpp/**"
- "example/android/**"
- "yarn.lock"
- "example/yarn.lock"

jobs:
build_example:
Expand All @@ -27,10 +27,10 @@ jobs:
steps:
- uses: actions/checkout@v2

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

- name: Get yarn cache directory path
id: yarn-cache-dir-path
Expand Down
26 changes: 12 additions & 14 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ on:
branches:
- main
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- 'cpp/**'
- '*.podspec'
- 'example/ios/**'
- ".github/workflows/build-ios.yml"
- "ios/**"
- "cpp/**"
- "*.podspec"
- "example/ios/**"
pull_request:
paths:
- '.github/workflows/build-ios.yml'
- 'ios/**'
- 'cpp/**'
- '*.podspec'
- 'example/ios/**'
- ".github/workflows/build-ios.yml"
- "ios/**"
- "cpp/**"
- "*.podspec"
- "example/ios/**"

jobs:
build:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
- name: Setup Ruby (bundle)
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7.6'
ruby-version: "2.7.6"
bundler-cache: true
working-directory: example

Expand All @@ -63,10 +63,8 @@ jobs:
~/Library/Caches/CocoaPods
~/.cocoapods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install Pods
run: bundle exec pod check || bundle exec pod install
run: RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
- name: Install xcpretty
run: gem install xcpretty
- name: Build App
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ android.iml
# Cocoapods
#
example/ios/Pods
example/ios/.xcode.env.local

# Ruby
example/vendor/
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"quoteProps": "consistent",
"singleQuote": false,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
}
58 changes: 39 additions & 19 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ add_compile_options(${folly_FLAGS})
find_package(fbjni REQUIRED CONFIG)
find_package(ReactAndroid REQUIRED CONFIG)

if(${JS_RUNTIME} STREQUAL "hermes")
find_package(hermes-engine REQUIRED CONFIG)
endif()

file(GLOB_RECURSE SOURCES_COMMON CONFIGURE_DEPENDS "../cpp/**.cpp")

add_library(
Expand Down Expand Up @@ -59,38 +55,62 @@ target_link_libraries(

target_link_libraries(
${PACKAGE_NAME}
ReactAndroid::folly_runtime
ReactAndroid::glog
ReactAndroid::jsi
ReactAndroid::reactnativejni
fbjni::fbjni
)

if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
target_link_libraries(
${PACKAGE_NAME}
ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
)
else()
target_link_libraries(
${PACKAGE_NAME}
ReactAndroid::reactnativejni # <-- RN: React Native JNI bindings
ReactAndroid::folly_runtime
ReactAndroid::glog
)
endif()

# Add the appropriate JS runtime
if(${JS_RUNTIME} STREQUAL "hermes")
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")
find_package(hermes-engine REQUIRED CONFIG)

# From prefab from module `com.facebook.react:hermes-android`
set(HERMES_LIB hermes-engine::libhermes)
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_HERMES=1")

target_link_libraries(
${PACKAGE_NAME}
${HERMES_LIB}
hermes-engine::libhermes
)

if(${HERMES_ENABLE_DEBUGGER})
set(HERMES_EXECUTOR_LIB ReactAndroid::hermes_executor)
if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
target_link_libraries(
${PACKAGE_NAME}
ReactAndroid::hermestooling
)
else()
target_link_libraries(
${PACKAGE_NAME}
ReactAndroid::hermes_executor
)
endif()
endif()
elseif(${JS_RUNTIME} STREQUAL "jsc")
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")

if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
target_link_libraries(
${PACKAGE_NAME}
${HERMES_EXECUTOR_LIB}
ReactAndroid::jsctooling
)
else()
target_link_libraries(
${PACKAGE_NAME}
ReactAndroid::jscexecutor
)
endif()
elseif(${JS_RUNTIME} STREQUAL "jsc")
string(APPEND CMAKE_CXX_FLAGS " -DJS_RUNTIME_JSC=1")

set(JSEXECUTOR_LIB ReactAndroid::jscexecutor)

target_link_libraries(${PACKAGE_NAME} ${JSEXECUTOR_LIB})
else()
message(FATAL_ERROR "Unknown JS runtime ${JS_RUNTIME}.")
endif()
1 change: 1 addition & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ android {
"**/libhermes.so",
"**/libhermes-executor-debug.so",
"**/libhermes_executor.so",
"**/libreactnative.so",
"**/libreactnativejni.so",
"**/libturbomodulejsijni.so",
"**/libreact_nativemodule_core.so",
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
presets: ["module:@react-native/babel-preset"],
};
9 changes: 6 additions & 3 deletions example/Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby File.read(File.join(__dir__, '.ruby-version')).strip

gem 'cocoapods', '~> 1.11', '>= 1.11.2'
ruby ">= 2.6.10"

# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
62 changes: 39 additions & 23 deletions example/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,49 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (6.1.7.2)
activesupport (7.1.5)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
securerandom (>= 0.3)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
benchmark (0.3.0)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.11.3)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.3)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
Expand All @@ -45,7 +55,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.3)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
Expand All @@ -54,47 +64,53 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.0)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
drb (2.2.1)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
ffi (1.17.0)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
json (2.6.3)
minitest (5.17.0)
json (2.7.6)
logger (1.6.1)
minitest (5.25.1)
molinillo (0.8.0)
mutex_m (0.2.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.7)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
securerandom (0.3.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.22.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.6.6)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.11, >= 1.11.2)
activesupport (>= 6.1.7.5, != 7.1.0)
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
xcodeproj (< 1.26.0)

RUBY VERSION
ruby 2.7.6p219

BUNDLED WITH
2.3.9
2.3.22
Loading
Loading