xmr-btc-swap/justfile
Mohan f2b23348d7
feat(monero-sys): Build system (#500)
* feat: use contrib/depends to build dependencies

* fix: bump min iOS sdk to 13

* fix: macos targets

* fix: show make output during build
fix: mingw linking issues

* chore: address AI review

* check target only once, stream make output to stdout, init ios project

* check whether patch is already applied before trying again

* copy contrib/depends to target dir and build dependencies there

* fix: use proper triplet for ios-sim

* fix(dprint): ignore monero_c, monero and monero-seed folders

* fix(swap): Missing import

* fix(ci): Add gperf as a required dependency for Linux

* add notes for unsafe usage to CLAUDE.md

* add clean command to justfile

* fix: minimumSystemVersion to 11.0 because tauri doesn't default behavior is wild

* update crunchy dependency to fix linux->windows cross compilation issue

* fix last commit

* link c++ std lib and libgcc statically on windows

* embed WebView2 Bootstrapper

* disable ccache on ios, update tauri deps, set minimumSystemVersion to 13.0

* fix

* fix: build env leaking into contrib/depends

* fix: version '-sim' in target triple 'arm64-apple-ios13.0-simulator-sim' is invalid

* get it working on ios

* Upgrade to nightly Rust toolchain for unstable features

- Change from Rust 1.85 to nightly to support yamux unstable features
- This resolves the unsigned_is_multiple_of compilation error

* fix

* WINDOWS WORKS

* Cargo.lock update

* android progress

* progress on gcc build script

* remove windows binary dependencies from git, running just prepare-windows-build will re-create them

* check for .dll's in src-tauri/build.rs and give hint how to build them

* document new build requirement

* add verification to gcc build script and error message when building windows from os other than linux

* fix windows build

* add just command for building windows  ss

* fix script: remove sudo, copy dlls when finished

* move path setup to its own function

* fix

* try and fix ci

* extract setup to single action

* clean up ci

* add actions/checkout everywhere

* fix missing input prefix

* fix missing autoconf

* fix add build deps to env

* fix add build deps to env

* add deps for cross building windows

* fix action call

* only bundle dll's on windows

* use ubuntu-latest, install yarn, don't use swap

* add build dependencies, remove no longer existing docker test

* add aclocal to macos setup

* include macos build depends

* change platform -> host for setup-build-environment, use matrix for building binaries for all platforms

* fix: prepare build env for docker for ubuntu, don't get host value from matrix

* manually install rust target

* include openssl on ubuntu for sqlx

* build cargo cache once before building individual tests

* only manually install target if provided

* fix: don't need special syntax for variables in if condition

* fix libssl problem by upgrading sqlx cli

* fix: specify host for prepare_docker_tests

* a lot of fixes

---------

Co-authored-by: Czarek Nakamoto <cyjan@mrcyjanek.net>
Co-authored-by: einliterflasche <einliterflasche@pm.me>
Co-authored-by: binarybaron <you@example.com>
Co-authored-by: Raphael <81313171+Einliterflasche@users.noreply.github.com>
2025-08-27 16:45:59 +02:00

124 lines
3.4 KiB
Makefile

# Show help for each of the justfile recipes
help:
@just --list
# Build Monero C++ Codebase (currently disabled)
# build_monero_cpp:
# just update_submodules
# cd monero-sys/monero && make -j8 release
# Clean the Monero C++ Codebase and build cache
clean:
cargo clean
cd monero-sys && rm -rf monero monero_c
just update_submodules
# Builds the Rust bindings for Monero
monero_sys:
just update_submodules
cd monero-sys && cargo build
# Test the FFI bindings using various sanitizers, that can detect memory safety issues.
test-ffi: test-ffi-address
# Tests the FFI bindings using AddressSanitizer (https://doc.rust-lang.org/beta/unstable-book/compiler-flags/sanitizer.html#addresssanitizer). Can detect memory safety issues like use-after-free, double-free, leaks, etc.
test-ffi-address:
cd monero-sys && RUSTFLAGS=-Zsanitizer=address cargo +nightly nextest run -Zbuild-std --target=`rustc --version --verbose | grep "host:" | cut -d' ' -f2`
# Start the Tauri app
tauri:
cd src-tauri && cargo tauri dev --no-watch -- --verbose -- --testnet
tauri-mainnet:
cd src-tauri && cargo tauri dev --no-watch -- -vv
# Install the GUI dependencies
gui_install:
cd src-gui && yarn install
# Start the GUI Dev Server
web:
cd src-gui && yarn dev
gui:
just web & just tauri
gui-mainnet:
just web & just tauri-mainnet
# Build the GUI
gui_build:
cd src-gui && yarn build
build-gui-windows:
cargo tauri build --target x86_64-pc-windows-gnu -- -vv
# Run the Rust tests
tests:
cargo nextest run
docker_test_happy_path:
cargo test --package swap --test happy_path -- --nocapture
docker_test_all:
cargo test --package swap --test all -- --nocapture
# Tests the Rust bindings for Monero
test_monero_sys:
cd monero-sys && cargo nextest run
# Builds the ASB and Swap binaries
swap:
cargo build -p swap-asb --bin asb && cd swap && cargo build --bin=swap
# Run the asb on testnet
asb-testnet:
cargo run -p swap-asb --bin asb -- --trace --testnet start --rpc-bind-port 9944 --rpc-bind-host 0.0.0.0
# Updates our submodules (currently only Monero C++ codebase)
update_submodules:
cd monero-sys && git submodule update --init --recursive --force
# Run clippy checks
clippy:
cargo clippy --workspace --all-targets --all-features -- -D warnings
# Generate the bindings for the Tauri API
bindings:
cd src-gui && yarn run gen-bindings
# Format the code
fmt:
dprint fmt
generate-sqlx-cache:
./regenerate_sqlx_cache.sh
# Run eslint for the GUI frontend
check_gui_eslint:
cd src-gui && yarn run eslint
# Run the typescript type checker for the GUI frontend
check_gui_tsc:
cd src-gui && yarn run tsc --noEmit
# Run the checks for the GUI frontend
check_gui:
just check_gui_eslint || true
just check_gui_tsc
# Sometimes you have to prune the docker network to get the integration tests to work
docker-prune-network:
docker network prune -f
# Install dependencies required for building monero-sys
prepare_mac_os_brew_dependencies:
cd dev_scripts && chmod +x ./brew_dependencies_install.sh && ./brew_dependencies_install.sh
# Takes a crate (e.g monero-rpc-pool) and uses code2prompt to copy to clipboard
# E.g code2prompt . --exclude "*.lock" --exclude ".sqlx/*" --exclude "target"
code2prompt_single_crate crate:
cd {{crate}} && code2prompt . --exclude "*.lock" --exclude ".sqlx/*" --exclude "target"
prepare-windows-build:
cd dev_scripts && ./ubuntu_build_x86_86-w64-mingw32-gcc.sh