From 0ed8489395f1544a25304b1c043f700be1c9b813 Mon Sep 17 00:00:00 2001 From: Ross Savage Date: Tue, 23 Apr 2024 16:20:38 +0200 Subject: [PATCH] Clarify the DEVELOPING docs --- lib/ls-sdk-react-native/DEVELOPING.md | 37 ++++++++++++++++----------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/lib/ls-sdk-react-native/DEVELOPING.md b/lib/ls-sdk-react-native/DEVELOPING.md index 23836c679..72594920a 100644 --- a/lib/ls-sdk-react-native/DEVELOPING.md +++ b/lib/ls-sdk-react-native/DEVELOPING.md @@ -8,9 +8,11 @@ The Liquid Swap SDK React Native plugin consumes the underlying Liquid Swap SDK When developing, it can be useful to work with a locally built version of the Liquid Swap SDK instead of relying on what is published already on CocoaPods / Jitpack. To do this, you first need to build the Liquid Swap SDK bindings locally and then point the plugin to make use of the locally built Liquid Swap SDK bindings. +All the following commands can be run in the `lib/ls-sdk-react-native` directory. + ## Prerequisites -Set the ANDROID_NDK_HOME env variable to your SDK home folder: +Set the ANDROID_NDK_HOME env variable to your SDK home directory: ``` export ANDROID_NDK_HOME= ``` @@ -26,16 +28,9 @@ On first usage you will need to run: make init ``` -## Generating the bridging code - -When there are changes to the UDL file in `lib/ls-sdk-binding/src` the React Native bridging code needs to be regenerated: -```bash -make react-native-codegen -``` - ## Building the bindings -Then to build and copy the Kotlin and Swift bindings into the React Native plugin: +Then to build and copy the Kotlin, Swift and React Native bindings into the React Native package run: ```bash make all ``` @@ -59,15 +54,27 @@ This will generate the following artifacts: - Typescript - `src/index.ts` +### Building for one platform only + +You can also build for Android or iOS only, in that case run: +```bash +make android react-native +``` +or +```bash +make ios react-native +``` + ## Using the locally built bindings -To use the locally built bindings instead of integrating them remotely: +To use the locally built bindings instead of integrating them remotely, make the following changes: - For iOS: - - Rename `ls_sdk.podspec` to `ls_sdk.podspec.prod` - - Rename `LiquidSwapSDK.podspec.dev` to `LiquidSwapSDK.podspec` + - Rename the podspec files in `lib/ls-sdk-react-native/`: + - Rename `ls_sdk.podspec` to `ls_sdk.podspec.prod` + - Rename `LiquidSwapSDK.podspec.dev` to `LiquidSwapSDK.podspec` - For Android: - - Remove the following line from the dependencies section in `android/build.gradle`: + - Comment out the following line from the dependencies section in `lib/ls-sdk-react-native/android/build.gradle`: - `implementation("com.github.breez:breez-sdk-liquid:${getVersionFromNpmPackage()}") { exclude group:"net.java.dev.jna" }` Reinstall the dependencies in the example project and run it. @@ -76,7 +83,7 @@ It will now use the locally built bindings. ## Testing with the example app To test locally built bindings in the example app, the npm dependencies need to be updated to use the local package. -In `example/package.json` replace the current version with `file:../`: +In `lib/ls-sdk-react-native/example/package.json` replace the current version with `file:../`: ```json "@breeztech/react-native-liquid-swap-sdk": "file:../", ``` @@ -86,7 +93,7 @@ Run the npm/yarn install to download dependences for both the react-native-liqui yarn bootstrap ``` -Finally in `example/` start either the iOS or Android app: +Finally in the `lib/ls-sdk-react-native/example/` directory start either the iOS or Android app: ```bash yarn android ```