Skip to content

Commit 4d98e79

Browse files
Fix perf metrics android size comparison and iOS cocoa pods code signing Xcode 14 (#2638)
1 parent d75382a commit 4d98e79

29 files changed

+875
-781
lines changed

test/perf/TestAppPlain/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ buck-out/
6161
# Ruby / CocoaPods
6262
/ios/Pods/
6363
/vendor/bundle/
64+
65+
#Codegen
66+
.cxx/

test/perf/TestAppPlain/android/app/build.gradle

Lines changed: 15 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ import com.android.build.OutputFile
7878
*/
7979

8080
project.ext.react = [
81-
enableHermes: false, // clean and rebuild if changing
81+
enableHermes: true, // clean and rebuild if changing
8282
]
8383

8484
apply from: "../../node_modules/react-native/react.gradle"
@@ -147,22 +147,14 @@ android {
147147
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
148148

149149
if (isNewArchitectureEnabled()) {
150-
// We configure the NDK build only if you decide to opt-in for the New Architecture.
150+
// We configure the CMake build only if you decide to opt-in for the New Architecture.
151151
externalNativeBuild {
152-
ndkBuild {
153-
arguments "APP_PLATFORM=android-21",
154-
"APP_STL=c++_shared",
155-
"NDK_TOOLCHAIN_VERSION=clang",
156-
"GENERATED_SRC_DIR=$buildDir/generated/source",
157-
"PROJECT_BUILD_DIR=$buildDir",
158-
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
159-
"REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
160-
"NODE_MODULES_DIR=$rootDir/../node_modules"
161-
cFlags "-Wall", "-Werror", "-fexceptions", "-frtti", "-DWITH_INSPECTOR=1"
162-
cppFlags "-std=c++17"
163-
// Make sure this target name is the same you specify inside the
164-
// src/main/jni/Android.mk file for the `LOCAL_MODULE` variable.
165-
targets "testappplain_appmodules"
152+
cmake {
153+
arguments "-DPROJECT_BUILD_DIR=$buildDir",
154+
"-DREACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
155+
"-DREACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build",
156+
"-DNODE_MODULES_DIR=$rootDir/../node_modules",
157+
"-DANDROID_STL=c++_shared"
166158
}
167159
}
168160
if (!enableSeparateBuildPerCPUArchitecture) {
@@ -176,8 +168,8 @@ android {
176168
if (isNewArchitectureEnabled()) {
177169
// We configure the NDK build only if you decide to opt-in for the New Architecture.
178170
externalNativeBuild {
179-
ndkBuild {
180-
path "$projectDir/src/main/jni/Android.mk"
171+
cmake {
172+
path "$projectDir/src/main/jni/CMakeLists.txt"
181173
}
182174
}
183175
def reactAndroidProjectDir = project(':ReactAndroid').projectDir
@@ -199,15 +191,15 @@ android {
199191
preReleaseBuild.dependsOn(packageReactNdkReleaseLibs)
200192

201193
// Due to a bug inside AGP, we have to explicitly set a dependency
202-
// between configureNdkBuild* tasks and the preBuild tasks.
194+
// between configureCMakeDebug* tasks and the preBuild tasks.
203195
// This can be removed once this is solved: https://issuetracker.google.com/issues/207403732
204-
configureNdkBuildRelease.dependsOn(preReleaseBuild)
205-
configureNdkBuildDebug.dependsOn(preDebugBuild)
196+
configureCMakeRelWithDebInfo.dependsOn(preReleaseBuild)
197+
configureCMakeDebug.dependsOn(preDebugBuild)
206198
reactNativeArchitectures().each { architecture ->
207-
tasks.findByName("configureNdkBuildDebug[${architecture}]")?.configure {
199+
tasks.findByName("configureCMakeDebug[${architecture}]")?.configure {
208200
dependsOn("preDebugBuild")
209201
}
210-
tasks.findByName("configureNdkBuildRelease[${architecture}]")?.configure {
202+
tasks.findByName("configureCMakeRelWithDebInfo[${architecture}]")?.configure {
211203
dependsOn("preReleaseBuild")
212204
}
213205
}

test/perf/TestAppPlain/android/app/src/main/jni/Android.mk

Lines changed: 0 additions & 48 deletions
This file was deleted.

test/perf/TestAppPlain/android/app/src/main/jni/MainApplicationModuleProvider.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#include "MainApplicationModuleProvider.h"
22

3+
#include <rncli.h>
34
#include <rncore.h>
45

56
namespace facebook {
67
namespace react {
78

89
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
9-
const std::string moduleName,
10+
const std::string &moduleName,
1011
const JavaTurboModule::InitParams &params) {
1112
// Here you can provide your own module provider for TurboModules coming from
1213
// either your application or from external libraries. The approach to follow
@@ -17,6 +18,14 @@ std::shared_ptr<TurboModule> MainApplicationModuleProvider(
1718
// return module;
1819
// }
1920
// return rncore_ModuleProvider(moduleName, params);
21+
22+
// Module providers autolinked by RN CLI
23+
auto rncli_module = rncli_ModuleProvider(moduleName, params);
24+
if (rncli_module != nullptr)
25+
{
26+
return rncli_module;
27+
}
28+
2029
return rncore_ModuleProvider(moduleName, params);
2130
}
2231

test/perf/TestAppPlain/android/app/src/main/jni/MainApplicationModuleProvider.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace facebook {
99
namespace react {
1010

1111
std::shared_ptr<TurboModule> MainApplicationModuleProvider(
12-
const std::string moduleName,
12+
const std::string &moduleName,
1313
const JavaTurboModule::InitParams &params);
1414

1515
} // namespace react

test/perf/TestAppPlain/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ void MainApplicationTurboModuleManagerDelegate::registerNatives() {
2222

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

3131
std::shared_ptr<TurboModule>
3232
MainApplicationTurboModuleManagerDelegate::getTurboModule(
33-
const std::string name,
33+
const std::string &name,
3434
const JavaTurboModule::InitParams &params) {
3535
return MainApplicationModuleProvider(name, params);
3636
}
3737

3838
bool MainApplicationTurboModuleManagerDelegate::canCreateTurboModule(
39-
std::string name) {
39+
const std::string &name) {
4040
return getTurboModule(name, nullptr) != nullptr ||
4141
getTurboModule(name, {.moduleName = name}) != nullptr;
4242
}

test/perf/TestAppPlain/android/app/src/main/jni/MainApplicationTurboModuleManagerDelegate.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,24 @@ class MainApplicationTurboModuleManagerDelegate
1414
public:
1515
// Adapt it to the package you used for your Java class.
1616
static constexpr auto kJavaDescriptor =
17-
"Lcom/testappplain/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;";
17+
"Lcom/testappsentry/newarchitecture/modules/MainApplicationTurboModuleManagerDelegate;";
1818

1919
static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject>);
2020

2121
static void registerNatives();
2222

2323
std::shared_ptr<TurboModule> getTurboModule(
24-
const std::string name,
25-
const std::shared_ptr<CallInvoker> jsInvoker) override;
24+
const std::string &name,
25+
const std::shared_ptr<CallInvoker> &jsInvoker) override;
2626
std::shared_ptr<TurboModule> getTurboModule(
27-
const std::string name,
27+
const std::string &name,
2828
const JavaTurboModule::InitParams &params) override;
2929

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

3737
} // namespace react

test/perf/TestAppPlain/android/app/src/main/jni/MainComponentsRegistry.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <fbjni/fbjni.h>
55
#include <react/renderer/componentregistry/ComponentDescriptorProviderRegistry.h>
66
#include <react/renderer/components/rncore/ComponentDescriptors.h>
7+
#include <rncli.h>
78

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

18+
// Autolinked providers registered by RN CLI
19+
rncli_registerProviders(providerRegistry);
20+
1721
// Custom Fabric Components go here. You can register custom
1822
// components coming from your App or from 3rd party libraries here.
1923
//

test/perf/TestAppPlain/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ buildscript {
2222
mavenCentral()
2323
}
2424
dependencies {
25-
classpath("com.android.tools.build:gradle:7.1.1")
25+
classpath("com.android.tools.build:gradle:7.2.1")
2626
classpath("com.facebook.react:react-native-gradle-plugin")
2727
classpath("de.undercouch:gradle-download-task:5.0.1")
2828
// NOTE: Do not place your application dependencies here; they belong
Binary file not shown.

0 commit comments

Comments
 (0)