diff --git a/BdkRn.podspec b/BdkRn.podspec index dbd7103..ae86b59 100644 --- a/BdkRn.podspec +++ b/BdkRn.podspec @@ -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. diff --git a/android/CMakeLists.txt b/android/CMakeLists.txt index 4b9c701..41c0e93 100644 --- a/android/CMakeLists.txt +++ b/android/CMakeLists.txt @@ -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( diff --git a/android/src/main/java/com/bdkrn/BdkRnPackage.kt b/android/src/main/java/com/bdkrn/BdkRnPackage.kt index 1b8d5b6..46bcbc3 100644 --- a/android/src/main/java/com/bdkrn/BdkRnPackage.kt +++ b/android/src/main/java/com/bdkrn/BdkRnPackage.kt @@ -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) diff --git a/docs/notes.md b/docs/notes.md index c72f8e2..588f58e 100644 --- a/docs/notes.md +++ b/docs/notes.md @@ -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. diff --git a/example/pnpm-lock.yaml b/example/pnpm-lock.yaml index ae75287..a2df2db 100644 --- a/example/pnpm-lock.yaml +++ b/example/pnpm-lock.yaml @@ -813,8 +813,8 @@ packages: '@types/yargs@17.0.35': resolution: {integrity: sha512-qUHkeCyQFxMXg79wQfTtfndEC+N9ZZg76HJftDJp+qH2tV7Gj4OJi7l+PiWwJ+pWtW8GwSmqsDj/oymhrTWXjg==} - '@ubjs/core@0.31.0-3': - resolution: {integrity: sha512-39XrJgUZ2VVb561sSnkXPhczNoeBsNiSRArecsV0JE7CJq69ajFkcn9/tBAUS2NpgHkLIDU+z6Ks2+1wXnboxg==} + '@ubjs/core@0.31.0-5': + resolution: {integrity: sha512-oRBRtyYOhaodiOY3rLMZFgAHGFMmD44XefMpsAx4Ja0/rO+45kVdQB1VZsblQMLYxP965i3IHm56eymgo3I5eQ==} '@ungap/structured-clone@1.3.1': resolution: {integrity: sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==} @@ -985,7 +985,7 @@ packages: hasBin: true bdk-rn@file:../bdk-rn-1.1.0-alpha.0.tgz: - resolution: {integrity: sha512-3pacjZuYkja2fo8cmyOj2+8R9FXQOAewQXrKq01bO2c4kYkw0YyV3wCW3KMqz2q6gI2ZM3zgoTaFe7UqfFukTQ==, tarball: file:../bdk-rn-1.1.0-alpha.0.tgz} + resolution: {integrity: sha512-Xed2lu5C6D3QuaILPqyg5YiUZ9GCuMUERx6mZ0m28GodOPyCXhJr7JJ5+QvRIkCUqaZklN6ywv1VtDFpOndLbg==, tarball: file:../bdk-rn-1.1.0-alpha.0.tgz} version: 1.1.0-alpha.0 peerDependencies: react: '*' @@ -2416,8 +2416,8 @@ packages: resolution: {integrity: sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==} engines: {node: '>=4'} - uniffi-bindgen-react-native@0.31.0-3: - resolution: {integrity: sha512-br7giBJRr/j00rdMXhOZGMGuDWMAVUcxC9O3lco0KRqzEAxUz00+gegPW5tKamvKbrnj7NB682XUCYrcagtxFA==} + uniffi-bindgen-react-native@0.31.0-5: + resolution: {integrity: sha512-YtL3gTe+RVXAQx/2P2Iuypic/CunRZC65Cs47v//YRfwWNYU4Ufd1jT3rqxSrH5b5QFCYblP89Nf/9ssZRvNgg==} hasBin: true unpipe@1.0.0: @@ -3741,7 +3741,7 @@ snapshots: dependencies: '@types/yargs-parser': 21.0.3 - '@ubjs/core@0.31.0-3': {} + '@ubjs/core@0.31.0-5': {} '@ungap/structured-clone@1.3.1': {} @@ -3955,10 +3955,10 @@ snapshots: bdk-rn@file:../bdk-rn-1.1.0-alpha.0.tgz(react-native@0.81.5(@babel/core@7.29.0(supports-color@8.1.1))(react@19.1.0)(supports-color@8.1.1))(react@19.1.0): dependencies: - '@ubjs/core': 0.31.0-3 + '@ubjs/core': 0.31.0-5 react: 19.1.0 react-native: 0.81.5(@babel/core@7.29.0(supports-color@8.1.1))(react@19.1.0)(supports-color@8.1.1) - uniffi-bindgen-react-native: 0.31.0-3 + uniffi-bindgen-react-native: 0.31.0-5 better-opn@3.0.2: dependencies: @@ -5561,7 +5561,7 @@ snapshots: unicode-property-aliases-ecmascript@2.2.0: {} - uniffi-bindgen-react-native@0.31.0-3: {} + uniffi-bindgen-react-native@0.31.0-5: {} unpipe@1.0.0: {} diff --git a/package.json b/package.json index ab9ae5d..c462381 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d48526b..413466f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,11 +9,11 @@ importers: .: dependencies: '@ubjs/core': - specifier: 0.31.0-3 - version: 0.31.0-3 + specifier: 0.31.0-5 + version: 0.31.0-5 uniffi-bindgen-react-native: - specifier: 0.31.0-3 - version: 0.31.0-3 + specifier: 0.31.0-5 + version: 0.31.0-5 devDependencies: '@commitlint/config-conventional': specifier: ^19.6.0 @@ -1449,8 +1449,8 @@ packages: resolution: {integrity: sha512-cDF0/Gf81QpY3xYyJKDV14Zwdmid5+uuENhjH2EqFaF0ni+yAyq/LzMaIJdhNJXZI7uLzwIlA+V7oWoyn6Curg==} engines: {node: ^18.18.0 || >=20.0.0} - '@ubjs/core@0.31.0-3': - resolution: {integrity: sha512-39XrJgUZ2VVb561sSnkXPhczNoeBsNiSRArecsV0JE7CJq69ajFkcn9/tBAUS2NpgHkLIDU+z6Ks2+1wXnboxg==} + '@ubjs/core@0.31.0-5': + resolution: {integrity: sha512-oRBRtyYOhaodiOY3rLMZFgAHGFMmD44XefMpsAx4Ja0/rO+45kVdQB1VZsblQMLYxP965i3IHm56eymgo3I5eQ==} JSONStream@1.3.5: resolution: {integrity: sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ==} @@ -4708,8 +4708,8 @@ packages: resolution: {integrity: sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==} engines: {node: '>=18'} - uniffi-bindgen-react-native@0.31.0-3: - resolution: {integrity: sha512-br7giBJRr/j00rdMXhOZGMGuDWMAVUcxC9O3lco0KRqzEAxUz00+gegPW5tKamvKbrnj7NB682XUCYrcagtxFA==} + uniffi-bindgen-react-native@0.31.0-5: + resolution: {integrity: sha512-YtL3gTe+RVXAQx/2P2Iuypic/CunRZC65Cs47v//YRfwWNYU4Ufd1jT3rqxSrH5b5QFCYblP89Nf/9ssZRvNgg==} hasBin: true universal-user-agent@6.0.1: @@ -6822,7 +6822,7 @@ snapshots: '@typescript-eslint/types': 7.18.0 eslint-visitor-keys: 3.4.3 - '@ubjs/core@0.31.0-3': {} + '@ubjs/core@0.31.0-5': {} JSONStream@1.3.5: dependencies: @@ -10676,7 +10676,7 @@ snapshots: unicorn-magic@0.1.0: {} - uniffi-bindgen-react-native@0.31.0-3: {} + uniffi-bindgen-react-native@0.31.0-5: {} universal-user-agent@6.0.1: {} diff --git a/tests/pnpm-lock.yaml b/tests/pnpm-lock.yaml index 302175b..f6530b8 100644 --- a/tests/pnpm-lock.yaml +++ b/tests/pnpm-lock.yaml @@ -1162,8 +1162,8 @@ packages: resolution: {integrity: sha512-f1UQF7ggd42YiwI5wGrRaPsa+P0CINBlrkLPmGfpq/u/I/oVtecoEIfFR9ag/oa1sLOsRNZ6xehf6qMZhQGBDg==} engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} - '@ubjs/core@0.31.0-3': - resolution: {integrity: sha512-39XrJgUZ2VVb561sSnkXPhczNoeBsNiSRArecsV0JE7CJq69ajFkcn9/tBAUS2NpgHkLIDU+z6Ks2+1wXnboxg==} + '@ubjs/core@0.31.0-5': + resolution: {integrity: sha512-oRBRtyYOhaodiOY3rLMZFgAHGFMmD44XefMpsAx4Ja0/rO+45kVdQB1VZsblQMLYxP965i3IHm56eymgo3I5eQ==} '@ungap/structured-clone@1.3.1': resolution: {integrity: sha512-mUFwbeTqrVgDQxFveS+df2yfap6iuP20NAKAsBt5jDEoOTDew+zwLAOilHCeQJOVSvmgCX4ogqIrA0mnyr08yQ==} @@ -1359,7 +1359,7 @@ packages: hasBin: true bdk-rn@file:../bdk-rn-1.1.0-alpha.0.tgz: - resolution: {integrity: sha512-RmKbfu8Q/VzYxiztclFpdv0u4tq4Ry12mGwWlf/qkIbqx+jNvhPtkqZkB4QWqZdvz+kNLrsqVBaORdR6dinguw==, tarball: file:../bdk-rn-1.1.0-alpha.0.tgz} + resolution: {integrity: sha512-Xed2lu5C6D3QuaILPqyg5YiUZ9GCuMUERx6mZ0m28GodOPyCXhJr7JJ5+QvRIkCUqaZklN6ywv1VtDFpOndLbg==, tarball: file:../bdk-rn-1.1.0-alpha.0.tgz} version: 1.1.0-alpha.0 peerDependencies: react: '*' @@ -3363,8 +3363,8 @@ packages: resolution: {integrity: sha512-hpbDzxUY9BFwX+UeBnxv3Sh1q7HFxj48DTmXchNgRa46lO8uj3/1iEn3MiNUYTg1g9ctIqXCCERn8gYZhHC5lQ==} engines: {node: '>=4'} - uniffi-bindgen-react-native@0.31.0-3: - resolution: {integrity: sha512-br7giBJRr/j00rdMXhOZGMGuDWMAVUcxC9O3lco0KRqzEAxUz00+gegPW5tKamvKbrnj7NB682XUCYrcagtxFA==} + uniffi-bindgen-react-native@0.31.0-5: + resolution: {integrity: sha512-YtL3gTe+RVXAQx/2P2Iuypic/CunRZC65Cs47v//YRfwWNYU4Ufd1jT3rqxSrH5b5QFCYblP89Nf/9ssZRvNgg==} hasBin: true universalify@0.1.2: @@ -5083,7 +5083,7 @@ snapshots: '@typescript-eslint/types': 8.59.3 eslint-visitor-keys: 5.0.1 - '@ubjs/core@0.31.0-3': {} + '@ubjs/core@0.31.0-5': {} '@ungap/structured-clone@1.3.1': {} @@ -5335,10 +5335,10 @@ snapshots: bdk-rn@file:../bdk-rn-1.1.0-alpha.0.tgz(react-native@0.82.1(@babel/core@7.29.0)(@react-native-community/cli@20.0.0(typescript@5.9.3))(@react-native/metro-config@0.82.1(@babel/core@7.29.0))(@types/react@19.2.14)(react@19.1.1))(react@19.1.1): dependencies: - '@ubjs/core': 0.31.0-3 + '@ubjs/core': 0.31.0-5 react: 19.1.1 react-native: 0.82.1(@babel/core@7.29.0)(@react-native-community/cli@20.0.0(typescript@5.9.3))(@react-native/metro-config@0.82.1(@babel/core@7.29.0))(@types/react@19.2.14)(react@19.1.1) - uniffi-bindgen-react-native: 0.31.0-3 + uniffi-bindgen-react-native: 0.31.0-5 bl@4.1.0: dependencies: @@ -7812,7 +7812,7 @@ snapshots: unicode-property-aliases-ecmascript@2.2.0: {} - uniffi-bindgen-react-native@0.31.0-3: {} + uniffi-bindgen-react-native@0.31.0-5: {} universalify@0.1.2: {} diff --git a/ubrn.config.yaml b/ubrn.config.yaml index 8135089..8e978ff 100644 --- a/ubrn.config.yaml +++ b/ubrn.config.yaml @@ -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