Skip to content

Commit

Permalink
Include linking instructions from RNNArch repo
Browse files Browse the repository at this point in the history
  • Loading branch information
lindboe committed Jun 20, 2022
1 parent 879b643 commit ac41d2c
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions docs/the-new-architecture/pillars-turbomodule.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,3 +608,51 @@ First, to enable the **New Architecture**:
1. Open the `android/gradle.properties` file
2. Scroll down to the end of the file and switch the `newArchEnabled` property from `false` to `true`.
Then, to manually link your new TurboModule:
1. Open the `NewArchitecture/android/app/build.gradle` file and update the file as it follows:
```diff
"PROJECT_BUILD_DIR=$buildDir",
"REACT_ANDROID_DIR=$rootDir/../node_modules/react-native/ReactAndroid",
- "REACT_ANDROID_BUILD_DIR=$rootDir/../node_modules/react-native/ReactAndroid/build"
+ "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"
```
1. Open the `NewArchitecture/android/app/src/main/jni/Android.mk` file and update the file as it follows:
```diff
# If you wish to add a custom TurboModule or Fabric component in your app you
# will have to include the following autogenerated makefile.
# include $(GENERATED_SRC_DIR)/codegen/jni/Android.mk
+
+ include $(NODE_MODULES_DIR)/rtn-calculator/android/build/generated/source/codegen/jni/Android.mk
include $(CLEAR_VARS)
```
1. In the same file above, go to the `LOCAL_SHARED_LIBRARIES` setting and add the following line:
```diff
libreact_codegen_rncore \
+ libreact_codegen_RTNCalculator \
libreact_debug \
```
1. Open the `NewArchitecture/android/app/src/main/jni/MainApplicationModuleProvider.cpp` file and update the file as it follows:
1. Add the import for the calculator:
```diff
#include <answersolver.h>
+ #include <RTNCalculator.h>
```
1. Add the following check in the `MainApplicationModuleProvider` constructor:
```diff
// auto module = samplelibrary_ModuleProvider(moduleName, params);
// if (module != nullptr) {
// return module;
// }

+ auto module = RTNCalculator_ModuleProvider(moduleName, params);
+ if (module != nullptr) {
+ return module;
+ }

return rncore_ModuleProvider(moduleName, params);
}
```

0 comments on commit ac41d2c

Please sign in to comment.