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

chore: update RN version to 0.70.0-rc.4 in example apps #1577

Merged
merged 41 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4701a12
chore(TestsExample): yarn install
kkafar Aug 30, 2022
18e5b8e
chore(TestsExample): package.json
kkafar Aug 30, 2022
e4a8e60
chore(TestsExample): .flowconfig
kkafar Aug 30, 2022
5257b67
chore(TestsExample): .gitignore
kkafar Aug 30, 2022
d0b8d30
chore(TestsExample): .node-version
kkafar Aug 30, 2022
b7e4c2a
chore(TestsExample): android/app/build.gradle
kkafar Aug 30, 2022
9662a8a
chore(TestsExample): android/app/src/main/jni/Android.mk
kkafar Aug 30, 2022
ad74d67
chore(TestsExample): android/app/src/main/jni/CMakeLists.txt
kkafar Aug 30, 2022
e445f08
chore(TestsExample): cpp files in jni directory
kkafar Aug 30, 2022
d40f5f6
chore(TestsExample): android/build.gradle
kkafar Aug 30, 2022
b89c81f
chore(TE): gradle-wrapper.properties
kkafar Aug 30, 2022
77491aa
chore(TestsExample): ios/Podfile & pod install
kkafar Aug 30, 2022
2602233
bookmark(TestsExample): iOS OK
kkafar Aug 30, 2022
3adf3e0
chore(TestsExample): android/gradle.properties
kkafar Aug 30, 2022
dc76870
bookmark(TestsExample): Android OK
kkafar Aug 30, 2022
39aad31
chore(FTE): yarn install
kkafar Aug 30, 2022
01bd97f
chore(FTE): package.json && yarn install
kkafar Aug 30, 2022
dcdc96c
chore(FTE): .flowconfig
kkafar Aug 30, 2022
df08274
chore(FTE): .gitignore
kkafar Aug 30, 2022
8f065c1
chore(FTE): .node-version
kkafar Aug 30, 2022
ccf269b
chore(FTE): android/app/build.gradle
kkafar Aug 30, 2022
257b193
chore(FTE): android/app/src/main/jni/Android.mk
kkafar Aug 30, 2022
0c56cd6
chore(FTE): android/appsrc/main/jni/CMakeLists.txt
kkafar Aug 30, 2022
574988d
chore(FTE): cpp flies in jni directory
kkafar Aug 30, 2022
7d1652f
chore(FTE): android/build.gradle
kkafar Aug 30, 2022
f5e30f0
chore(FTE): android gradle-wrapper.properties
kkafar Aug 30, 2022
e4b66a9
chore(FTE): ios/Podfile & pod install
kkafar Aug 30, 2022
fda0fab
chore(FTE): disable check for multiple instances of libraries
kkafar Aug 30, 2022
74d56ee
bookmark(FTE): Android OK
kkafar Aug 30, 2022
ba00e9f
bookmark(FTE): iOS OK
kkafar Aug 30, 2022
994bc36
chore(FE): package.json & yarn install
kkafar Aug 30, 2022
7706747
chore(FE): .flowconfig
kkafar Aug 30, 2022
edc4d96
chore(FE): .gitignore
kkafar Aug 30, 2022
b3dbd31
chore(FE): .node-version
kkafar Aug 30, 2022
e529104
chore(FE): android/app/build.gradle
kkafar Aug 30, 2022
7e484b6
chore(FE): android/app/src/main/jni/Android.mk
kkafar Aug 30, 2022
1690ebc
chore(FE): android/app/src/main/jni/CMakeLists.txt
kkafar Aug 30, 2022
50d5bb6
chore(FE): cpp files in jni directory
kkafar Aug 30, 2022
cbb8048
chore(FE): android/build.gradle
kkafar Aug 30, 2022
d32b012
chore(FE): android gradle-wrapper.properties
kkafar Aug 30, 2022
3abf839
chore(FE): ios/Podfile & pod install
kkafar Aug 30, 2022
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: 1 addition & 1 deletion FabricExample/.flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,4 @@ untyped-import
untyped-type-import

[version]
^0.176.3
^0.182.0
1 change: 1 addition & 0 deletions FabricExample/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ build/
local.properties
*.iml
*.hprof
.cxx/

# node.js
#
Expand Down
1 change: 1 addition & 0 deletions FabricExample/.node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
42 changes: 24 additions & 18 deletions FabricExample/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ import com.android.build.OutputFile
*/

project.ext.react = [
enableHermes: false, // clean and rebuild if changing
enableHermes: true, // clean and rebuild if changing
]

apply from: "../../node_modules/react-native/react.gradle"
Expand Down Expand Up @@ -144,22 +144,14 @@ android {
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()

if (isNewArchitectureEnabled()) {
// We configure the NDK build only if you decide to opt-in for the New Architecture.
// We configure the CMake build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
ndkBuild {
arguments "APP_PLATFORM=android-21",
"APP_STL=c++_shared",
"NDK_TOOLCHAIN_VERSION=clang",
"GENERATED_SRC_DIR=$buildDir/generated/source",
"PROJECT_BUILD_DIR=$buildDir",
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"NODE_MODULES_DIR=$rootDir/../node_modules"
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
cppFlags "-std=c++17"
// Make sure this target name is the same you specify inside the
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
targets "fabricexample_appmodules"
cmake {
arguments "-DPROJECT_BUILD_DIR=$buildDir",
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
"-DANDROID_STL=c++_shared"
}
}
}
Expand All @@ -168,8 +160,8 @@ android {
if (isNewArchitectureEnabled()) {
// We configure the NDK build only if you decide to opt-in for the New Architecture.
externalNativeBuild {
ndkBuild {
path "$projectDir/src/main/jni/Android.mk"
cmake {
path "$projectDir/src/main/jni/CMakeLists.txt"
}
}
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
Expand All @@ -189,6 +181,20 @@ android {
// preBuild.dependsOn("generateCodegenArtifactsFromSchema")
preDebugBuild.dependsOn(packageReactNdkDebugLibs)
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)

// Due to a bug inside AGP, we have to explicitly set a dependency
// between configureCMakeDebug* tasks and the preBuild tasks.
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
configureCMakeDebug.dependsOn(preDebugBuild)
reactNativeArchitectures().each { architecture ->
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
dependsOn("preDebugBuild")
}
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
dependsOn("preReleaseBuild")
}
}
}
}

Expand Down
49 changes: 0 additions & 49 deletions FabricExample/android/app/src/main/jni/Android.mk

This file was deleted.

5 changes: 5 additions & 0 deletions FabricExample/android/app/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 3.13)
# Define the library name here.
project(fabricexample_appmodules)
# This file includes all the necessary to let you build your application with the New Architecture.
include(${REACT_ANDROID_DIR}/cmake-utils/ReactNative-application.cmake)
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#include "MainApplicationModuleProvider.h"

#include <rncli.h>
#include <rncore.h>

namespace facebook {
namespace react {

std::shared_ptr<TurboModule> MainApplicationModuleProvider(
const std::string moduleName,
const std::string &moduleName,
const JavaTurboModule::InitParams &params) {
// Here you can provide your own module provider for TurboModules coming from
// either your application or from external libraries. The approach to follow
Expand All @@ -17,6 +18,13 @@ std::shared_ptr<TurboModule> MainApplicationModuleProvider(
// return module;
// }
// return rncore_ModuleProvider(moduleName, params);

// Module providers autolinked by RN CLI
auto rncli_module = rncli_ModuleProvider(moduleName, params);
if (rncli_module != nullptr) {
return rncli_module;
}

return rncore_ModuleProvider(moduleName, params);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace facebook {
namespace react {

std::shared_ptr<TurboModule> MainApplicationModuleProvider(
const std::string moduleName,
const std::string &moduleName,
const JavaTurboModule::InitParams &params);

} // namespace react
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ void MainApplicationTurboModuleManagerDelegate::registerNatives() {

std::shared_ptr<TurboModule>
MainApplicationTurboModuleManagerDelegate::getTurboModule(
const std::string name,
const std::shared_ptr<CallInvoker> jsInvoker) {
const std::string &name,
const std::shared_ptr<CallInvoker> &jsInvoker) {
// Not implemented yet: provide pure-C++ NativeModules here.
return nullptr;
}

std::shared_ptr<TurboModule>
MainApplicationTurboModuleManagerDelegate::getTurboModule(
const std::string name,
const std::string &name,
const JavaTurboModule::InitParams &params) {
return MainApplicationModuleProvider(name, params);
}

bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
std::string name) {
const std::string &name) {
return getTurboModule(name, nullptr) != nullptr ||
getTurboModule(name, {.moduleName = name}) != nullptr;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ class MainApplicationTurboModuleManagerDelegate
static void registerNatives();

std::shared_ptr<TurboModule> getTurboModule(
const std::string name,
const std::shared_ptr<CallInvoker> jsInvoker) override;
const std::string &name,
const std::shared_ptr<CallInvoker> &jsInvoker) override;
std::shared_ptr<TurboModule> getTurboModule(
const std::string name,
const std::string &name,
const JavaTurboModule::InitParams &params) override;

/**
* Test-only method. Allows user to verify whether a TurboModule can be
* created by instances of this class.
*/
bool canCreateTurboModule(std::string name);
bool canCreateTurboModule(const std::string &name);
};

} // namespace react
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <fbjni/fbjni.h>
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
#include <react/renderer/components/rncore/ComponentDescriptors.h>
#include <rncli.h>

namespace facebook {
namespace react {
Expand All @@ -14,6 +15,9 @@ std::shared_ptr<ComponentDescriptorProviderRegistry const>
MainComponentsRegistry::sharedProviderRegistry() {
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();

// Autolinked providers registered by RN CLI
rncli_registerProviders(providerRegistry);

// Custom Fabric Components go here. You can register custom
// components coming from your App or from 3rd party libraries here.
//
Expand Down
2 changes: 1 addition & 1 deletion FabricExample/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.1")
classpath("com.android.tools.build:gradle:7.2.1")
classpath("com.facebook.react:react")
classpath("de.undercouch:gradle-download-task:5.0.1")
// NOTE: Do not place your application dependencies here; they belong
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
24 changes: 15 additions & 9 deletions FabricExample/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@ target 'FabricExample' do

use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => flags[:hermes_enabled],
# Hermes is now enabled by default. Disable by setting this flag to false.
# Upcoming versions of React Native may rely on get_default_flags(), but
# we make it explicit here to aid in the React Native upgrade process.
:hermes_enabled => true,
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => FlipperConfiguration.enabled,
# An abosolute path to your application root.
:app_path => "#{Dir.pwd}/.."
)
Expand All @@ -26,14 +33,13 @@ target 'FabricExample' do
# Pods for testing
end

# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()

post_install do |installer|
react_native_post_install(installer)
react_native_post_install(
installer,
# Set `mac_catalyst_enabled` to `true` in order to apply patches
# necessary for Mac Catalyst builds
:mac_catalyst_enabled => false
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
end
end
Loading