Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 32 additions & 12 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# Allow experimental features like [group(...)]
set unstable := true

set shell := ["sh", "-c"]

set windows-shell := ["powershell.exe", "-Command"]

[group("Repo")]
[doc("Default command; list all available commands.")]
@list:
Expand All @@ -6,7 +13,11 @@
[group("Repo")]
[doc("Open repo on GitHub in your default browser.")]
repo:
open https://github.com/bitcoindevkit/bdk-dart
{{ if os() == "windows" {
"Start-Process https://github.com/bitcoindevkit/bdk-dart"
} else {
"open https://github.com/bitcoindevkit/bdk-dart"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small cross-platform note: this still uses macOS open for every non-Windows OS. Since this PR is improving cross-platform Justfile support, should we use xdg-open on Linux and keep open only for macOS?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good idea, i assumed the current justfile support Linux as well, I just test all the just commands on my WSL, they all passed except the just repo command.
I'll look into that as well. Thanks!

} }}

[group("Dart")]
[doc("Format the Dart codebase.")]
Expand All @@ -31,17 +42,29 @@ test *ARGS:
[group("Bindings")]
[doc("Build native library and regenerate bindings.")]
generate-bindings:
bash ./scripts/generate_bindings.sh
{{ if os() == "windows" {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This multi-line interpolation has the same parser issue as the generate-bindings recipe: just --list --unsorted fails with error: Unterminated interpolation before any recipe can run.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed the requested fix now.

"cd native; cargo build --profile dev; cargo run --profile dev --bin uniffi-bindgen -- generate --library target\\debug\\bdk_dart_ffi.dll --language dart --config uniffi.toml --out-dir ..\\lib\\"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small behavior note: PowerShell ; always runs the next command, so if cd native or cargo build fails, the following command can still run. Could we keep this fail-fast like the original script behavior?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, great point I'll look into fixing that.

} else {
"bash ./scripts/generate_bindings.sh"
} }}

[group("Demo")]
[doc("Run Flutter analysis for the demo app.")]
demo-analyze:
cd bdk_demo && flutter analyze
{{ if os() == "windows" {
"cd bdk_demo ; flutter analyze"
} else {
"cd bdk_demo && flutter analyze"
} }}

[group("Demo")]
[doc("Run Flutter tests for the demo app.")]
demo-test *ARGS:
cd bdk_demo && flutter test {{ if ARGS == "" { "" } else { ARGS } }}
{{ if os() == "windows" {
"cd bdk_demo ; flutter test " + (if ARGS == "" { "" } else { ARGS })
} else {
"cd bdk_demo && flutter test " + (if ARGS == "" { "" } else { ARGS })
} }}

[group("CI")]
[doc("Run the same checks as CI.")]
Expand All @@ -55,11 +78,8 @@ ci:
[group("Dart")]
[doc("Remove build and tool artifacts to start fresh.")]
clean:
rm -rf .dart_tool/
rm -rf build/
rm -rf native/target/
rm -rf coverage/
rm -rf bdk_demo/.dart_tool/
rm -rf bdk_demo/build/
rm -rf example/.dart_tool/
rm -rf example/build/
{{ if os() == "windows" {
"'.dart_tool', 'build', 'native/target', 'coverage', 'bdk_demo/.dart_tool', 'bdk_demo/build', 'example/.dart_tool', 'example/build' | Where-Object { Test-Path $_ } | ForEach-Object { Remove-Item -Recurse -Force $_ }"
} else {
"rm -rf .dart_tool/ build/ native/target/ coverage/ bdk_demo/.dart_tool/ bdk_demo/build/ example/.dart_tool/ example/build/"
} }}
Loading