Skip to content

Commit 441e1ee

Browse files
Rename Codegen Component Descriptors Entrypoint for FAC and hook it up in DefaultComponentsRegistry
Summary: As part of [FAC](https://docs.google.com/document/d/1WACeVolFTrsJqbsUpHwYKPVw0EijdG6ZyFPYprSg8QQ/edit?usp=sharing) rollout, we are hooking the code-generated ComponentDescriptors.cpp (the Codegen list of components) via [registerComponentDescriptorsFromEntryPoint](https://www.internalfb.com/code/fbsource/[a60437056a3b58f0bcc9fded7b851cbf09f377c7]/xplat/js/react-native-github/packages/react-native-codegen/DEFS.bzl?lines=147) however in Bridgeless mode this is the same hooking mechanism used by AMA, Twilight, Anna & Ariane to link their individual app registries : **AMA** : https://www.internalfb.com/code/fbsource/[e2855199ad37704c474957162d24efe666de4304]/fbandroid/java/com/facebook/adsmanager/cpp/OnLoad.cpp?lines=13-14 **Twilight** : https://www.internalfb.com/code/fbsource/[e2855199ad37704c474957162d24efe666de4304]/fbandroid/java/com/oculus/twilight/crossapp/reactpackage/fabric/components/jni/OnLoad.cpp?lines=13-14 **Anna** : https://www.internalfb.com/code/fbsource/[e2855199ad37704c474957162d24efe666de4304]/fbandroid/java/com/facebook/anna/app/cpp/OnLoad.cpp?lines=13-14 **Ariane** : https://www.internalfb.com/code/fbsource/[e2855199ad37704c474957162d24efe666de4304]/fbandroid/java/com/facebook/rlr/ariane/crossapp/components/OnLoad.cpp?lines=13-14 Hence for the codegen hooking up renaming the function to `registerCodegenComponentDescriptorsFromEntryPoint` and thus correspondingly changing DefaultComponentsRegistry.h & .cpp Differential Revision: D73535745
1 parent 93f12eb commit 441e1ee

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

packages/react-native/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultComponentsRegistry.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ namespace facebook::react {
1818
std::function<void(std::shared_ptr<const ComponentDescriptorProviderRegistry>)>
1919
DefaultComponentsRegistry::registerComponentDescriptorsFromEntryPoint{};
2020

21+
std::function<void(std::shared_ptr<const ComponentDescriptorProviderRegistry>)>
22+
DefaultComponentsRegistry::
23+
registerCodegenComponentDescriptorsFromEntryPoint{};
24+
2125
void DefaultComponentsRegistry::setRegistryRunction(
2226
jni::alias_ref<jclass>,
2327
ComponentFactory* delegate) {
@@ -31,6 +35,12 @@ void DefaultComponentsRegistry::setRegistryRunction(
3135
.flavor = nullptr};
3236

3337
auto providerRegistry = CoreComponentsRegistry::sharedProviderRegistry();
38+
if (registerCodegenComponentDescriptorsFromEntryPoint) {
39+
registerCodegenComponentDescriptorsFromEntryPoint(providerRegistry);
40+
} else {
41+
LOG(WARNING)
42+
<< "Codegen component descriptors were not configured from JNI_OnLoad";
43+
}
3444
if (registerComponentDescriptorsFromEntryPoint) {
3545
registerComponentDescriptorsFromEntryPoint(providerRegistry);
3646
} else {

packages/react-native/ReactAndroid/src/main/jni/react/newarchdefaults/DefaultComponentsRegistry.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ class DefaultComponentsRegistry
2727
std::shared_ptr<const ComponentDescriptorProviderRegistry>)>
2828
registerComponentDescriptorsFromEntryPoint;
2929

30+
static std::function<void(
31+
std::shared_ptr<const ComponentDescriptorProviderRegistry>)>
32+
registerCodegenComponentDescriptorsFromEntryPoint;
33+
3034
private:
3135
static void setRegistryRunction(
3236
jni::alias_ref<jclass>,

0 commit comments

Comments
 (0)