Files
breez-sdk-liquid/lib/bindings/langs/flutter/justfile
Ross Savage 3ea6b1a9dc Publish Dart and Flutter packages (#356)
* Publish flutter artifacts and package

* Publish dart package

* Add LICENCE

* Force rm

* Don't copy lock files

* Fix output directory

* Fix podspec name

* Pass SWIFT_RELEASE_TOKEN

* Fix overrides indentation

* Update package version on CMake script

Update example dependencies

* Depend on dart & flutter packages from git on pubspec files

* Correct repository links & add publish_to: 'none'
* run just clean && just init

* Update README.md

* Download framework as part of prepare_command

* Use wget, then fallback to curl
* Remove redundant .zip suffix on the url

* Fix release tag

* Add v to tag replacement

* Fix podspec version

* Copy header file

* Downgrade vm_service

---------

Co-authored-by: Erdem Yerebasmaz <erdem@yerebasmaz.com>
2024-07-03 17:21:47 +02:00

105 lines
3.4 KiB
Makefile

curr_version := "breez_liquid-v" + `awk '/^version: /{print $2}' ../../../../packages/flutter/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 init-sdk
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:
mkdir -p ../../../../packages/flutter/lib/src
{{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 profile='frb-min':
dart scripts/build_apple.dart --profile {{profile}}
build-android profile='frb-min':
bash scripts/build-android.sh --profile {{profile}}
build-other profile='frb-min':
dart scripts/build_other.dart --profile {{profile}}
# (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
# Install Breez Liquid SDK dependencies
init-sdk:
brew install protobuf
# (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