Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BdkRn.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Pod::Spec.new do |s|

s.source_files = "ios/**/*.{h,m,mm,swift}", "ios/generated/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "cpp/generated/**/*.{hpp,cpp,c,h}"
s.vendored_frameworks = "BdkRnFramework.xcframework"
s.dependency "uniffi-bindgen-react-native", "0.31.0-3"
s.dependency "uniffi-bindgen-react-native", "0.31.0-5"

# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
Expand Down
46 changes: 4 additions & 42 deletions android/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,14 @@ set (CMAKE_VERBOSE_MAKEFILE ON)
set (CMAKE_CXX_STANDARD 17)

# Resolve the path to the uniffi-bindgen-react-native package
#
# TEMPORARY: revert this block (and the `noOverwrite` entry in ubrn.config.yaml)
# once a uniffi-bindgen-react-native release after 0.31.0-3 is out and we bump to
# it. Track https://github.com/jhugman/uniffi-bindgen-react-native/issues/421
#
# 0.31.0-3 publishes an "exports" map that does not expose ./package.json, so the
# upstream resolution below throws ERR_PACKAGE_PATH_NOT_EXPORTED. That surfaces to
# our users as a "'UniffiCallInvoker.h' file not found" compile error, because the
# empty path silently becomes `-I/cpp/includes`. Upstream fixed it by adding
# `"./package.json": "./package.json"` to their exports (PR #407, merged 2b57645),
# but it is unreleased — and since we ship this file in our tarball and pin
# 0.31.0-3, patching it here is the only thing that reaches downstream consumers.
#
# The `try` branch is verbatim what upstream generates and starts working again on
# their next release; the fallback finds the package root by walking up from the
# entry point, which no "exports" map can gate.
execute_process(
COMMAND node -e [==[
const path = require('path');
const fs = require('fs');
let root;
try {
root = path.dirname(
require.resolve('uniffi-bindgen-react-native/package.json'));
} catch (e) {
if (e.code !== 'ERR_PACKAGE_PATH_NOT_EXPORTED') throw e;
root = path.dirname(require.resolve('uniffi-bindgen-react-native'));
while (root !== path.dirname(root) &&
!fs.existsSync(path.join(root, 'cpp', 'includes'))) {
root = path.dirname(root);
}
}
console.log(root);
]==]
COMMAND node -p "require.resolve('uniffi-bindgen-react-native/package.json')"
OUTPUT_VARIABLE UNIFFI_BINDGEN_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE UNIFFI_BINDGEN_ERROR
RESULT_VARIABLE UNIFFI_BINDGEN_RESULT
)
# Fail loudly here. Upstream omits this check, which is why an unresolved package
# turns into a confusing missing-header error much later in the build.
if(NOT UNIFFI_BINDGEN_RESULT EQUAL 0 OR NOT IS_DIRECTORY "${UNIFFI_BINDGEN_PATH}/cpp/includes")
message(FATAL_ERROR
"Could not locate the uniffi-bindgen-react-native C++ headers. "
"node exited with '${UNIFFI_BINDGEN_RESULT}': ${UNIFFI_BINDGEN_ERROR}")
endif()
# Get the directory; get_filename_component and cmake_path will normalize
# paths with Windows path separators.
get_filename_component(UNIFFI_BINDGEN_PATH "${UNIFFI_BINDGEN_PATH}" DIRECTORY)

# Specifies a path to native header files.
include_directories(
Expand Down
4 changes: 2 additions & 2 deletions android/src/main/java/com/bdkrn/BdkRnPackage.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Generated by uniffi-bindgen-react-native
package com.bdkrn

import com.facebook.react.TurboReactPackage
import com.facebook.react.BaseReactPackage
import com.facebook.react.bridge.NativeModule
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.module.model.ReactModuleInfo
import com.facebook.react.module.model.ReactModuleInfoProvider
import java.util.HashMap

class BdkRnPackage : TurboReactPackage() {
class BdkRnPackage : BaseReactPackage() {
override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
return if (name == BdkRnModule.NAME) {
BdkRnModule(reactContext)
Expand Down
6 changes: 1 addition & 5 deletions docs/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

## Known Issues

### 1. cargo-ndk --no-strip Issue

The `cargo-ndk` library removed the `--no-strip` argument and this is creating a build error when using the latest release of `uniffi-bindgen-react-native` (`0.29.3-1`). We are currently building using a commit on their `main` branch which contains the patch. See the `package.json` file for details.

### 2. Emulator Compatibility
### 1. Emulator Compatibility

For some reason the [Android example app](https://github.com/thunderbiscuit/bdk-rn-example-apps) doesn't work on the Pixel 8 API 35 emulator, but does work on the Pixel 5 API 31 and the Pixel 9 API 36.

Expand Down
18 changes: 9 additions & 9 deletions example/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
"version": "0.52.0"
},
"dependencies": {
"@ubjs/core": "0.31.0-3",
"uniffi-bindgen-react-native": "0.31.0-3"
"@ubjs/core": "0.31.0-5",
"uniffi-bindgen-react-native": "0.31.0-5"
}
}
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions tests/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions ubrn.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@ rust:
directory: bdk-ffi/bdk-ffi
manifestPath: Cargo.toml

# TEMPORARY: android/CMakeLists.txt carries a hand-written workaround for
# https://github.com/jhugman/uniffi-bindgen-react-native/issues/421 that `ubrn
# build android --and-generate` would otherwise overwrite on every build. Drop
# this once we bump past 0.31.0-3 and revert the patch.
noOverwrite:
- android/CMakeLists.txt

android:
targets:
- arm64-v8a
Expand Down
Loading