Skip to content

Commit

Permalink
Clarify the DEVELOPING docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross committed Apr 24, 2024
1 parent 0ebb222 commit 1cd2736
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions lib/ls-sdk-react-native/DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<your android ndk directory>
```
Expand All @@ -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
```
Expand All @@ -50,24 +45,36 @@ This will generate the following artifacts:
- `ios/bindings-swift/Sources/LiquidSwapSDK/LiquidSwapSDK.swift`
- Android
- `android/src/main/java/com/lssdk/ls_sdk.kt`
- `android/src/main/java/com/lssdk/LiquidSwapSDKMapper.kt`
- `android/src/main/java/com/lssdk/LiquidSwapSDKModule.kt`
- `android/src/main/java/com/lssdk/LiquidSwapSDKMapper.kt`
- `android/src/main/java/com/lssdk/LiquidSwapSDKModule.kt`
- `android/src/main/jniLibs/arm64-v8a/libls_sdk_bindings.so`
- `android/src/main/jniLibs/armeabi-v7a/libls_sdk_bindings.so`
- `android/src/main/jniLibs/x86/libls_sdk_bindings.so`
- `android/src/main/jniLibs/x86_64/libls_sdk_bindings.so`
- 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.
Expand All @@ -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:../",
```
Expand All @@ -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
```
Expand Down

0 comments on commit 1cd2736

Please sign in to comment.