From f0ede1ecd9bbc49aa271c3e6115dfe0c6280471f Mon Sep 17 00:00:00 2001 From: MusabYK Date: Sat, 27 Jun 2026 12:24:32 +0100 Subject: [PATCH 1/3] chore: make justfile fully compatible with Windows/PowerShell --- justfile | 44 ++++++++++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/justfile b/justfile index 00c83af..3b38695 100644 --- a/justfile +++ b/justfile @@ -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: @@ -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" + } }} [group("Dart")] [doc("Format the Dart codebase.")] @@ -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" { + "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\\" + } 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.")] @@ -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/" + } }} From cd8c7069706c4e9210f9f2ff37fab5529e236c5e Mon Sep 17 00:00:00 2001 From: MusabYK Date: Mon, 29 Jun 2026 23:34:54 +0100 Subject: [PATCH 2/3] Fix: Add Linux support to 'repo' recipe using xdg-open. - Replace manual directory switching with native '[working-directory]' attribute. - Add fail-fast error checking ('if (-not $?)') to Windows bindings generation. - Standardize Windows file paths to use forward slashes. --- justfile | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/justfile b/justfile index 3b38695..ea6e6fa 100644 --- a/justfile +++ b/justfile @@ -5,6 +5,8 @@ set shell := ["sh", "-c"] set windows-shell := ["powershell.exe", "-Command"] +opener := if os_family() == "windows" { "Start-Process" } else if os() == "macos" { "open" } else { "xdg-open" } + [group("Repo")] [doc("Default command; list all available commands.")] @list: @@ -13,11 +15,7 @@ set windows-shell := ["powershell.exe", "-Command"] [group("Repo")] [doc("Open repo on GitHub in your default browser.")] repo: - {{ if os() == "windows" { - "Start-Process https://github.com/bitcoindevkit/bdk-dart" - } else { - "open https://github.com/bitcoindevkit/bdk-dart" - } }} + @{{ opener }} "https://github.com/bitcoindevkit/bdk-dart" [group("Dart")] [doc("Format the Dart codebase.")] @@ -43,28 +41,22 @@ test *ARGS: [doc("Build native library and regenerate bindings.")] generate-bindings: {{ if os() == "windows" { - "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\\" + "cd native; if (-not $?) { exit 1 }; cargo build --profile dev; if (-not $?) { exit 1 }; cargo run --profile dev --bin uniffi-bindgen -- generate --library target/debug/bdk_dart_ffi.dll --language dart --config uniffi.toml --out-dir ../lib/" } else { "bash ./scripts/generate_bindings.sh" } }} [group("Demo")] [doc("Run Flutter analysis for the demo app.")] +[working-directory: "bdk_demo"] demo-analyze: - {{ if os() == "windows" { - "cd bdk_demo ; flutter analyze" - } else { - "cd bdk_demo && flutter analyze" - } }} + flutter analyze [group("Demo")] [doc("Run Flutter tests for the demo app.")] +[working-directory: "bdk_demo"] demo-test *ARGS: - {{ if os() == "windows" { - "cd bdk_demo ; flutter test " + (if ARGS == "" { "" } else { ARGS }) - } else { - "cd bdk_demo && flutter test " + (if ARGS == "" { "" } else { ARGS }) - } }} + flutter test {{ if ARGS == "" { "" } else { ARGS } }} [group("CI")] [doc("Run the same checks as CI.")] From cc2505c66bb5b30a80c0c50686bcf821b13bbbf5 Mon Sep 17 00:00:00 2001 From: MusabYK Date: Wed, 1 Jul 2026 00:41:48 +0100 Subject: [PATCH 3/3] fix(justfile): replace multi-line interpolations with variables --- justfile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/justfile b/justfile index ea6e6fa..1aad062 100644 --- a/justfile +++ b/justfile @@ -5,6 +5,14 @@ set shell := ["sh", "-c"] set windows-shell := ["powershell.exe", "-Command"] +windows_generate_bindings := "cd native; if (-not $?) { exit 1 }; cargo build --profile dev; if (-not $?) { exit 1 }; cargo run --profile dev --bin uniffi-bindgen -- generate --library target/debug/bdk_dart_ffi.dll --language dart --config uniffi.toml --out-dir ../lib/" + +unix_generate_bindings := "bash ./scripts/generate_bindings.sh" + +windows_clean := "'.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 $_ }" + +unix_clean := "rm -rf .dart_tool/ build/ native/target/ coverage/ bdk_demo/.dart_tool/ bdk_demo/build/ example/.dart_tool/ example/build/" + opener := if os_family() == "windows" { "Start-Process" } else if os() == "macos" { "open" } else { "xdg-open" } [group("Repo")] @@ -40,11 +48,7 @@ test *ARGS: [group("Bindings")] [doc("Build native library and regenerate bindings.")] generate-bindings: - {{ if os() == "windows" { - "cd native; if (-not $?) { exit 1 }; cargo build --profile dev; if (-not $?) { exit 1 }; cargo run --profile dev --bin uniffi-bindgen -- generate --library target/debug/bdk_dart_ffi.dll --language dart --config uniffi.toml --out-dir ../lib/" - } else { - "bash ./scripts/generate_bindings.sh" - } }} + {{ if os() == "windows" { windows_generate_bindings } else { unix_generate_bindings } }} [group("Demo")] [doc("Run Flutter analysis for the demo app.")] @@ -70,8 +74,4 @@ ci: [group("Dart")] [doc("Remove build and tool artifacts to start fresh.")] clean: - {{ 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/" - } }} + {{ if os() == "windows" { windows_clean } else { unix_clean } }} \ No newline at end of file