Files
breez-sdk-liquid/lib/bindings/langs/flutter/justfile
2024-06-24 13:39:50 +03:00

99 lines
3.2 KiB
Makefile

curr_version := "breez_liquid-v" + `awk '/^version: /{print $2}' ../../../../packages/dart/pubspec.yaml`
frb_bin := "flutter_rust_bridge_codegen generate"
export CARGO_TERM_COLOR := "always"
default:
just --list --unsorted
# Initializes the workspace
bootstrap frb='true' build='false':
just clean
@if {{frb}} == true; then just frb; fi
just init
just gen
@if {{build}} == true; then just build; fi
@if {{build}} == true; then melos build; fi
@if {{build}} == true; then just link; fi
just check
# Install flutter_rust_bridge_codegen dependencies
frb:
cargo install cargo-expand
cargo install flutter_rust_bridge_codegen --version 2.0.0
dart pub global activate ffigen
dart pub global activate ffi
cargo install cargo-xcode
# Generate bindings
gen: codegen && ffigen
# Generate Dart/Flutter bindings && softlink C headers
codegen:
{{frb_bin}}
cd ../../../../packages/dart/lib/src && dart format -l 110 .
-ln -sf $(pwd)/breez_liquid_sdk/include/breez_liquid_sdk.h ../../../../packages/flutter/ios/Classes/breez_liquid_sdk.h
-ln -sf $(pwd)/breez_liquid_sdk/include/breez_liquid_sdk.h ../../../../packages/flutter/macos/Classes/breez_liquid_sdk.h
# Generate FFI bindings
ffigen:
cd ../../../../packages/flutter/ && flutter pub run ffigen --config ffigen.yaml && dart format -l 110 ./lib/flutter_breez_liquid_bindings_generated.dart
# Builds the local library for testing
build *args:
cargo build --package breez-liquid-sdk --manifest-path ../../../core/Cargo.toml --features frb {{args}}
build-apple *args:
dart scripts/build_apple.dart {{args}}
build-android profile='release':
bash scripts/build-android.sh {{profile}}
build-other *args:
dart scripts/build_other.dart {{args}}
# (melos) Run tests on packages in workspace
test build='false':
just test-dart {{build}}
# test-flutter {{build}}
# (melos) Run tests on Dart packages in workspace
test-dart build='true':
@if {{build}} == true; then just build; fi
melos test-dart
# (melos) Run integration tests on Flutter packages in workspace
#test-flutter build='true':
# @if {{build}} == true; then build; fi
# melos test-flutter
# Softlinks library archives from platform-build to their expected locations
link:
-ln -sf $(pwd)/platform-build/breez_liquid_sdk.xcframework.zip ../../../../packages/flutter/macos/Frameworks/{{curr_version}}.zip
-ln -sf $(pwd)/platform-build/breez_liquid_sdk.xcframework.zip ../../../../packages/flutter/ios/Frameworks/{{curr_version}}.zip
-ln -sf $(pwd)/platform-build/other.tar.gz ../../../../packages/flutter/linux/{{curr_version}}.tar.gz
-ln -sf $(pwd)/platform-build/other.tar.gz ../../../../packages/flutter/windows/{{curr_version}}.tar.gz
-ln -sf $(pwd)/platform-build/android.tar.gz ../../../../packages/flutter/android/{{curr_version}}.tar.gz
# (melos) use instead of flutter pub get
init *args:
dart pub global activate melos
melos bootstrap {{args}}
melos pub-upgrade
# (melos) Generate docs for packages in workspace
docs:
melos docs
# (melos) Cleans the current workspace and all its packages of temporary pub & generated Melos IDE files.
clean:
melos clean
# (melos) Analyze & check the format of packages in workspace
check:
melos analyze
melos check-format
# Open melos.yaml
melos:
@$EDITOR melos.yaml