Generating Turbo Module files to install the bindings
The bindings of the Rust library consist of several C++ files and several typescript files.
There is a host of smaller files that need to be configured with these namespaces, and with configuration from the config YAML file.
These include:
- For Javascript:
- An
index.tsxfile, to call into the installation process, initialize the bindings for each namespace, and re-export the generated bindings for client code. - A Codegen file, to generates install methods from Javascript to Java and Objective C.
- An
- For Android:
- A
Package.javaandModule.javafile, which receives the codegen’d install method calls, to get the HermesJavascriptRuntimeandCallInvokerHolderto pass it via JNI to - A
cpp-adapter.cppto receive the JNI calls, and converts those intojsi::Runtimeandreact::CallInvokerthen calls into generic C++ install code.
- A
- Generic C++ install code:
- A turbo-module installation
.hand.cppwhich catches the calls from Android and iOS and registers the bindings C++ with the Hermesjsi::Runtime.
- A turbo-module installation
- For iOS:
- a
Module.handModule.mmfile which receives the codegen’d install method calls, and digs around to find thejsi::Runtimeandreact::CallInvoker. It then calls into the generic C++ install code.
- a
- To build for iOS:
- A podspec file to tell Xcode about the generated files, and the framework name/location of the compiled Rust library.
- To build for Android
- A
CMakeLists.txtfile to configure the Android specific tool chain for all the generated C++ files. - The
build.gradlefile which tells keeps the codegen package name in-sync and configurescmake. (note to self, this could be done from within theCMakeLists.txtfile).
- A
An up-to-date list can be found in ubrn_cli/src/codegen/templates.