Files
breez-sdk-liquid/lib/core/build.rs
yse 6782e8beef feat: add real-time sync service (#629)
* feat(rt-sync): add persistency layer (#555)

* feat(rt-sync): add pull and merge (#556)

* feat(rt-sync): add push logic and run method (#568)

* feat(rt-sync): integrate rt-sync with the sdk

fix: add formatting command to build

feat: add secondary trigger to sync

deps: add tonic tls-webpki-roots

feat: prevent double claiming on status stream handlers

fix: add tx commit to chain swap update (#588)

fix: ensure we pull records before prepare_send

fix: fmt and tests

* fix: set initial pulled state to `Recoverable`

* feat(rt-sync): add `last_derivation_index` to sync service

* Single chain source

* Handle Recoverable state

* fix(rt-sync): chain recovery integration (#590)

Co-authored-by: yse <hydra_yse@proton.me>

* feat(rt-sync): add `pair_fees_json`

* fix(rt-sync): clean already persisted incoming records

* feat: cache wallet info (#591)

* log: add status-stream logging for non-local swaps

* Sync improvements (#598)

* Full sync on new Bitcoin block

* Track the last unconfirmed refund tx

* Trigger synced event on partial sync

* fix: remove `REPLACE` clause from swap insert/update

* fix(rt-sync): update chain swap payer/receiver amount (#604)

* Fix syncing last derivation index

* fix: update bindings and lockfile

* remove logs

* fix(rt-sync): avoid reuse of derivation index update logic (#608)

* Add 5 index buffer to full scan

* Fix storing claim_address (#609)

* Filter incoming MRH txs by swap timestamp

* fix liquid panding timestamp

* persist tx data timestamp

* Update unconfirmed transactions

* feat: add API key (#618)

* Use configured lazy connect channel in sync service

* fix: set lower-case header (#624)

* fix error message

* Store & Sync LNURL info (#617)

* Persist and decrypt LNURL info

* Update Notification Plugin

* Sync payment details

* Update list payments to include chain swaps with only user lockup (#620)

* Update payments query to include chain swaps without txs

* Allow emitting a payment event without tx_id

* fix: bindings

---------

Co-authored-by: Ross Savage <hello@satimoto.com>
Co-authored-by: Ross Savage <551697+dangeross@users.noreply.github.com>
Co-authored-by: Roei Erez <roeierez@gmail.com>
2024-12-24 10:39:43 +01:00

55 lines
2.1 KiB
Rust

use anyhow::*;
use glob::glob;
use std::env;
use std::os::unix::process::CommandExt as _;
use std::process::Command;
use std::result::Result::Ok;
/// Adds a temporary workaround for an issue with the Rust compiler and Android
/// in x86_64 devices: https://github.com/rust-lang/rust/issues/109717.
/// The workaround comes from: https://github.com/smartvaults/smartvaults/blob/827805a989561b78c0ea5b41f2c1c9e9e59545e0/bindings/smartvaults-sdk-ffi/build.rs
fn setup_x86_64_android_workaround() {
let target_os = env::var("CARGO_CFG_TARGET_OS").expect("CARGO_CFG_TARGET_OS not set");
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").expect("CARGO_CFG_TARGET_ARCH not set");
if target_arch == "x86_64" && target_os == "android" {
let android_ndk_home = env::var("ANDROID_NDK_HOME").expect("ANDROID_NDK_HOME not set");
let build_os = match env::consts::OS {
"linux" => "linux",
"macos" => "darwin",
"windows" => "windows",
_ => panic!(
"Unsupported OS. You must use either Linux, MacOS or Windows to build the crate."
),
};
let linux_x86_64_lib_pattern = format!(
"{android_ndk_home}/toolchains/llvm/prebuilt/{build_os}-x86_64/lib*/clang/**/lib/linux/"
);
match glob(&linux_x86_64_lib_pattern).unwrap().last() {
Some(Ok(path)) => {
println!("cargo:rustc-link-search={}", path.to_string_lossy());
println!("cargo:rustc-link-lib=static=clang_rt.builtins-x86_64-android");
},
_ => panic!("Path not found: {linux_x86_64_lib_pattern}. Try setting a different ANDROID_NDK_HOME."),
}
}
}
fn compile_protos() -> Result<()> {
tonic_build::configure()
.build_server(false)
.out_dir("src/sync/model")
.compile_protos(&["src/sync/proto/sync.proto"], &["src/sync/proto"])?;
Command::new("rustfmt")
.arg("--edition")
.arg("2021")
.arg("src/sync/model/sync.rs")
.exec();
Ok(())
}
fn main() -> Result<()> {
setup_x86_64_android_workaround();
compile_protos()?;
Ok(())
}