-
Notifications
You must be signed in to change notification settings - Fork 90
Feat/dart precompiled binary #1307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
dbee4b2
ab987ef
7aa1337
47b89ba
403a268
1e57740
a717894
754974f
2f8d685
00e7fdd
01ce73a
48ab20d
7b709d0
317d395
f0fc5a7
d3ad65f
a1199e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ target | |
| !example.config.toml | ||
| *.sqlite | ||
| Cargo.lock | ||
|
|
||
| .vscode | ||
| mutants.out* | ||
| *.ikm | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,48 @@ | |
|
|
||
| Welcome to the Dart language bindings for the [Payjoin Dev Kit](https://payjoindevkit.org/)! | ||
|
|
||
| ## Using the bindings in your app | ||
|
|
||
| Declare the package as a dependency just like any other Dart package. When developing against the repo directly, point at the local path and let `flutter pub get` (or `dart pub get`) run the build hook: | ||
|
|
||
| ```yaml | ||
| dependencies: | ||
| payjoin: | ||
| path: ../rust-payjoin/payjoin-ffi/dart | ||
| ``` | ||
|
Comment on lines
+10
to
+13
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't the SOP be to get this from |
||
|
|
||
| The `hook/build.dart` script drives `native_toolchain_rust` (plus the precompiled-binaries helper) so that `flutter pub get` downloads the verified binaries when available or builds the native crate locally on demand. | ||
|
|
||
| If you prefer to inspect or regenerate `payjoin.dart` manually, run the binder script from the `payjoin-ffi/dart` directory: | ||
|
|
||
| ```bash | ||
| bash ./scripts/generate_bindings.sh | ||
| ``` | ||
|
|
||
| This produces `lib/payjoin.dart` and the native artifacts under `target/`. These files are not tracked in the repository, so you should regenerate them locally whenever the Rust API changes. | ||
|
|
||
| ## Precompiled binaries | ||
|
|
||
| This package supports downloading signed precompiled binaries or building locally via Dart's Native Assets hook. | ||
| If precompiled binaries are attempted but unavailable or verification fails, it falls back to building from source. | ||
|
|
||
| ### pubspec.yaml configuration | ||
|
|
||
| In your app's `pubspec.yaml`, add the `payjoin` section at the top level (next to `dependencies`), like: | ||
|
|
||
| ```yaml | ||
| payjoin: | ||
| precompiled_binaries: | ||
| mode: auto # auto | always | never | ||
| ``` | ||
|
|
||
| `mode` controls when the precompiled path is used: | ||
| - `auto` prefers local builds if Rust toolchain is detected, otherwise uses precompiled binaries | ||
| - `always` requires precompiled binaries and skips local builds | ||
| - `never` always builds from source via the build hook | ||
|
|
||
| If your tooling must rely on the signed GitHub releases, set `mode: always` and configure `artifact_host`/`public_key` to point at the published assets so `PrecompiledBuilder` can download the `precompiled_<crateHash>` bundles (macOS/iOS + Android builds are published via `.github/workflows/payjoin-dart-precompile-binaries.yml`). | ||
|
|
||
| ## Running Tests | ||
|
|
||
| Follow these steps to clone the repository and run the tests. | ||
|
|
@@ -16,3 +58,5 @@ bash ./scripts/generate_bindings.sh | |
| # Run all tests | ||
| dart test | ||
| ``` | ||
|
|
||
| Maintainers: see `docs/precompiled_binaries.md` for CI details, manual release steps, and configuration. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this file exists as of commit 1e57740 where this is introduced
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, yes, adding it now. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| !Cargo.lock |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
? why include this commit